diff --git a/README.md b/README.md index e8e0a4517cfc19a424d5da403b61270105551069..1a34eeaa006abfb47be0893f2a82f25a43d15d6f 100644 --- a/README.md +++ b/README.md @@ -134,14 +134,10 @@ Next, we load the python file containing the reference code and fix all referenc The middle command is a convenience feature: It allows us to specify a special citation command `\nref{..}` which always compiles to `\cite[\ref{...}]{herlau}`. This is useful if e.g. `herlau` is the bibtex key for your lecture notes. The result is as follows: ```python """ -{{copyright}} References: [Ber07] Dimitri P. Bertsekas. Dynamic Programming and Optimal Control, Vol. II. Athena Scientific, 3rd edition, 2007. ISBN 1886529302. - - [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021. - -""" + [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021.""" def myfun(): #!s """ To solve this exercise, look at eq. (1) in Section 1. diff --git a/example/output/citations.py b/example/output/citations.py index a081fabe3fd3e651bc09ae49c2a51aefc01a0f1d..b652b65fc6bc715bed80437ee7f4180ef6b902e0 100644 --- a/example/output/citations.py +++ b/example/output/citations.py @@ -1,12 +1,8 @@ """ -{{copyright}} References: [Ber07] Dimitri P. Bertsekas. Dynamic Programming and Optimal Control, Vol. II. Athena Scientific, 3rd edition, 2007. ISBN 1886529302. - - [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021. - -""" + [Her21] Tue Herlau. Sequential decision making. (See 02465_Notes.pdf), 2021.""" def myfun(): #!s """ To solve this exercise, look at eq. (1) in Section 1. diff --git a/src/snipper/__pycache__/fix_cite.cpython-38.pyc b/src/snipper/__pycache__/fix_cite.cpython-38.pyc index 25fca9463f8b858cdaef0c4b55b0579b45ebbe74..cad506a5c9c777bdec18848256196d71ff5e9d4d 100644 Binary files a/src/snipper/__pycache__/fix_cite.cpython-38.pyc and b/src/snipper/__pycache__/fix_cite.cpython-38.pyc differ diff --git a/src/snipper/fix_cite.py b/src/snipper/fix_cite.py index 9c6aadce84bb008d1fb2bf9d193336426e0f197d..561b5f137e218ababd2469cab993c99224eeb5c5 100644 --- a/src/snipper/fix_cite.py +++ b/src/snipper/fix_cite.py @@ -61,13 +61,13 @@ def fix_bibtex(lines, bibtex): s = s[:i] + rtxt + s[j+1:] i = i + len(rtxt) - cpr = "{{copyright}}" + cpr = "" if not s.startswith(COMMENT): s = f"{COMMENT}\n{cpr}\n{COMMENT}\n" + s if len(all_refs) > 0: i = s.find(COMMENT, s.find(COMMENT)+1) - all_refs = [" " + r for r in all_refs] - s = s[:i] + "\nReferences:\n" + "\n".join(all_refs) + "\n" + s[i:] + all_refs = [" " + r.strip() for r in all_refs] + s = s[:i] + "References:\n" + "\n".join(all_refs) + s[i:] # s = s.replace(cpr, info['code_copyright']) return s.splitlines() \ No newline at end of file