Esempio n. 1
0
    def _create_formatted_entries(self, bib_entries):
        # create the formatted entries
        autocomplete_format = get_setting("cite_autocomplete_format")
        panel_format = get_setting("cite_panel_format")

        meta_data = frozendict(
            cache_time=long(time.time()),
            version=_VERSION,
            autocomplete_format=autocomplete_format,
            panel_format=panel_format
        )

        formatted_entries = tuple(
            frozendict(**{
                "keyword": entry["keyword"],
                "<prefix_match>": bibformat.create_prefix_match_str(entry),
                "<panel_formatted>": tuple(
                    bibformat.format_entry(s, entry) for s in panel_format
                ),
                "<autocomplete_formatted>":
                    bibformat.format_entry(autocomplete_format, entry)
            })
            for entry in bib_entries
        )

        return meta_data, formatted_entries
Esempio n. 2
0
    def _create_formatted_entries(self, bib_entries):
        # create the formatted entries
        autocomplete_format = get_setting("cite_autocomplete_format")
        panel_format = get_setting("cite_panel_format")

        meta_data = frozendict(cache_time=long(time.time()),
                               version=_VERSION,
                               autocomplete_format=autocomplete_format,
                               panel_format=panel_format)

        formatted_entries = tuple(
            frozendict(
                **{
                    "keyword":
                    entry["keyword"],
                    "<prefix_match>":
                    bibformat.create_prefix_match_str(entry),
                    "<panel_formatted>":
                    tuple(
                        bibformat.format_entry(s, entry)
                        for s in panel_format),
                    "<autocomplete_formatted>":
                    bibformat.format_entry(autocomplete_format, entry)
                }) for entry in bib_entries)

        return meta_data, formatted_entries
Esempio n. 3
0
def _create_formatted_entries(formatted_cache_name, bib_entries, cache_time):
    # create the formatted entries
    autocomplete_format = get_setting("cite_autocomplete_format")
    panel_format = get_setting("cite_panel_format")

    meta_data = {
        "cache_time": cache_time,
        "version": _VERSION,
        "autocomplete_format": autocomplete_format,
        "panel_format": panel_format
    }
    formatted_entries = [
        {
            "keyword": entry["keyword"],
            "<prefix_match>": bibformat.create_prefix_match_str(entry),
            "<panel_formatted>": [
                bibformat.format_entry(s, entry) for s in panel_format
            ],
            "<autocomplete_formatted>":
                bibformat.format_entry(autocomplete_format, entry)
        }
        for entry in bib_entries
    ]

    cache.write_global(formatted_cache_name, (meta_data, formatted_entries))
    return formatted_entries
Esempio n. 4
0
def _is_prefix(lower_prefix, entry):
    try:
        return lower_prefix in entry["<prefix_match>"]
    except:
        return lower_prefix in bibformat.create_prefix_match_str(entry)
Esempio n. 5
0
def _is_prefix(lower_prefix, entry):
    try:
        return lower_prefix in entry["<prefix_match>"]
    except:
        return lower_prefix in bibformat.create_prefix_match_str(entry)