Ejemplo 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
Ejemplo 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
Ejemplo 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
 def formatted_entry(entry):
     try:
         return entry['<autocomplete_formatted>']
     except:
         return bibformat.format_entry(
             cite_autocomplete_format, entry
         )
Ejemplo n.º 5
0
 def formatted_entry(entry):
     try:
         return entry['<autocomplete_formatted>']
     except:
         return bibformat.format_entry(
             cite_autocomplete_format, entry
         )
 def formatted_entry(entry):
     try:
         return entry["<panel_formatted>"]
     except:
         return [
             bibformat.format_entry(s, entry) for s in cite_panel_format
         ]
Ejemplo n.º 7
0
 def formatted_entry(entry):
     try:
         return entry["<panel_formatted>"]
     except:
         return [
             bibformat.format_entry(s, entry)
             for s in cite_panel_format
         ]
Ejemplo n.º 8
0
 def formatted_entry(entry):
     try:
         result = entry["<panel_formatted>"]
         if isinstance(result, tuple):
             result = list(result)
         return result
     except:
         return [
             bibformat.format_entry(s, entry) for s in cite_panel_format
         ]
 def formatted_entry(entry):
     try:
         result = entry["<panel_formatted>"]
         if isinstance(result, tuple):
             result = list(result)
         return result
     except:
         return [
             bibformat.format_entry(s, entry)
             for s in cite_panel_format
         ]