示例#1
0
    import json
    with open(simplified_bibliography_path, 'w') as o: json.dump(
        {c: bib_lookup(c) for c in set(citations)},
        o,
        sort_keys = True,
        indent = 2,
        separators = (',', ': '))
    exit()

# ------------------------------------------------------------

cites, ids, bibl = quickbib.bib(
    environ['APA_CSL_PATH'],
    [bib_lookup(c) for c in citations],
    formatter = org_bib_formatter,
    return_cites_and_keys = True,
    **(dict() if apa else dict(
        always_include_issue = True,
        include_isbn = True,
        url_after_doi = True,
        publisher_website = False)))

# Strip outer parentheses.
cites = [c[1:-1] for c in cites]

# Fill in the description parts of 'bib' and 'bibp' links.

cite_n = -1
def f(mo):
    if re.search('^# .*\Z', mo.string[:mo.start()], flags = re.MULTILINE):
      # This citation was in a comment, so skip it.
        return mo.group(0)
示例#2
0
def f(ds, multi = False, **kw):
    if not multi: ds = [ds]
    for d in ds:
        for k in d: d[k.replace('_', '-')] = d.pop(k)
    bibl = bib(environ['APA_CSL_PATH'], ds, apa_tweaks = True, **kw)
    return bibl if multi else bibl[0]