|
| 1 | +# citation.py: generate citation.txt |
| 2 | + |
| 3 | +import sys |
| 4 | +import re |
| 5 | + |
| 6 | +if len(sys.argv) != 1: |
| 7 | + print("Usage: python3 citation.py") |
| 8 | + exit(1) |
| 9 | + |
| 10 | +output = "src/citation.txt" |
| 11 | + |
| 12 | +# Read HISTORY |
| 13 | +with open('HISTORY', 'r') as file: |
| 14 | + history_lines = file.read() |
| 15 | + |
| 16 | +version = "" |
| 17 | +year = "" |
| 18 | + |
| 19 | +# NOTE: We do not capture 3.1.3-p1. We just want the last proper version. |
| 20 | +pattern = re.compile(r"(\d+)\.(\d+).(\d+)\s+(\d{4})-\d{2}-\d{2}") |
| 21 | +for line in history_lines.splitlines(): |
| 22 | + match = pattern.match(line) |
| 23 | + if match: |
| 24 | + version = f"{match.group(1)}.{match.group(2)}.{match.group(3)}" |
| 25 | + year = f"{match.group(4)}" |
| 26 | + |
| 27 | +page = r"""<h2>Citing FLINT</h2> |
| 28 | +
|
| 29 | +<p>When citing FLINT, the following form is recommended:</p> |
| 30 | +
|
| 31 | +<blockquote>The FLINT team. FLINT: Fast Library for Number Theory, """ + year + r""". |
| 32 | +Version """ + version + r""", https://flintlib.org.</blockquote> |
| 33 | +
|
| 34 | +<pre> |
| 35 | +@manual{flint, |
| 36 | + key = {{FLINT}}, |
| 37 | + author = {The {FLINT} team}, |
| 38 | + title = {{FLINT}: {F}ast {L}ibrary for {N}umber {T}heory}, |
| 39 | + year = {""" + year + r"""}, |
| 40 | + note = {Version """ + version + r""", \url{https://flintlib.org}} |
| 41 | +} |
| 42 | +</pre> |
| 43 | +
|
| 44 | +<p> |
| 45 | +Please consider also looking up whether there is a paper discussing |
| 46 | +the specific feature(s) in FLINT which you are using. In many cases, there is such a paper! |
| 47 | +For example, research using the ball arithmetic component of FLINT (Arb) may cite:</p> |
| 48 | +
|
| 49 | +<blockquote> |
| 50 | +F. Johansson. "Arb: efficient arbitrary-precision midpoint-radius interval arithmetic", IEEE Transactions on Computers, 66(8):1281-1292, 2017. DOI: <a href="https://doi.org/10.1109/TC.2017.2690633">10.1109/TC.2017.2690633</a> |
| 51 | +</blockquote> |
| 52 | +
|
| 53 | +<pre> |
| 54 | +@article{7891956, |
| 55 | + author = {Fredrik Johansson}, |
| 56 | + journal = {{IEEE} Transactions on Computers}, |
| 57 | + title = {{A}rb: Efficient Arbitrary-Precision Midpoint-Radius Interval Arithmetic}, |
| 58 | + year = {2017}, |
| 59 | + volume = {66}, |
| 60 | + number = {8}, |
| 61 | + pages = {1281-1292}, |
| 62 | + doi = {10.1109/TC.2017.2690633} |
| 63 | +} |
| 64 | +</pre> |
| 65 | +
|
| 66 | +<p>Research using FLINT's number fields may cite:</p> |
| 67 | +
|
| 68 | +<blockquote>William B. Hart. "ANTIC: Algebraic number theory in C", Computeralgebra-Rundbrief: Vol. 56, 2015</blockquote> |
| 69 | +
|
| 70 | +<p>Many other references can be found <a href="https://www.flintlib.org/doc/references.html">in the bibliography of the FLINT documentation</a>.</p> |
| 71 | +
|
| 72 | +<p>For a list of changes in each release, see the <a href="https://www.flintlib.org/doc/history.html">history</a> section of the documentation.</p> |
| 73 | +""" |
| 74 | + |
| 75 | +with open(output, "w") as file: |
| 76 | + file.write(page) |
0 commit comments