diff --git a/README.md b/README.md index 1a34eeaa006abfb47be0893f2a82f25a43d15d6f..4541d8897c386d563d61ae30594a1a62b8d506c8 100644 --- a/README.md +++ b/README.md @@ -134,10 +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 """ - 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 b652b65fc6bc715bed80437ee7f4180ef6b902e0..7904c3f44f403f483d07e71f5b5c606f220f676d 100644 --- a/example/output/citations.py +++ b/example/output/citations.py @@ -1,8 +1,8 @@ """ - 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 cad506a5c9c777bdec18848256196d71ff5e9d4d..f4f2a6a15da1ceb5b8ad897d8a875183ee0e919c 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 561b5f137e218ababd2469cab993c99224eeb5c5..475e44d5f36f80dd441574fc757cd6dec32c8b18 100644 --- a/src/snipper/fix_cite.py +++ b/src/snipper/fix_cite.py @@ -63,11 +63,11 @@ def fix_bibtex(lines, bibtex): cpr = "" if not s.startswith(COMMENT): - s = f"{COMMENT}\n{cpr}\n{COMMENT}\n" + s + s = f"{COMMENT}\n{COMMENT}\n" + s if len(all_refs) > 0: i = s.find(COMMENT, s.find(COMMENT)+1) all_refs = [" " + r.strip() for r in all_refs] - s = s[:i] + "References:\n" + "\n".join(all_refs) + s[i:] + s = s[:i] + "References:\n" + "\n".join(all_refs) +"\n"+ s[i:] # s = s.replace(cpr, info['code_copyright']) return s.splitlines() \ No newline at end of file