Skip to content

Commit

Permalink
let caselaw recognize page-range pincites
Browse files Browse the repository at this point in the history
  • Loading branch information
raindrum committed Sep 27, 2024
1 parent 1ce5332 commit 4abb413
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 37 deletions.
9 changes: 6 additions & 3 deletions citeurl/templates/caselaw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ U.S. Caselaw (CAP):
mandatory: no
volume: {regex: \d+}
page: {regex: \d+}
pincite: {regex: \d+}
pincite: {regex: '\d+(-\d+)?'}
footnote: {regex: \d+}
pattern: '{volume} {reporter} {page}(,?( at)? {pincite}(,? ((foot)?note|f?n\.?) ?{footnote})?\b(?! \w))?'
shortform pattern: '{same volume} {same reporter},? at (p(age|p?\.) ?)?{pincite}(,? ((foot)?note|f?n\.?) ?{footnote})?\b(?! \w)'
idform patterns:
- '[Ii]d\.,?( at)? (p(ages? |p?\. ?))?{pincite}(,? ((foot)?note|f?n\.?) ?{footnote})?\b(?! \w)'
- '[Ii]d\.,?( at)? ((foot)?note|f?n\.?) ?{footnote}\b(?! \w)'
URL builder:
edits:
- token: pincite
sub: ['(, |-).+', '']
parts:
- https://cite.case.law/{reporter}/{volume}/{page}
- '#p{pincite}'
Expand All @@ -41,7 +44,7 @@ U.S. Caselaw (CourtListener):
mandatory: no
volume: {regex: \d+}
page: {regex: \d+}
pincite: {regex: \d+}
pincite: {regex: '\d+(-\d+)?'}
footnote: {regex: \d+}
URL builder:
parts: ['https://www.courtlistener.com/c/{reporter}/{volume}/{page}']
Expand All @@ -56,7 +59,7 @@ National Labor Relations Board Decisions:
tokens:
volume: {regex: \d+}
page: {regex: \d+}
pincite: {regex: \d+}
pincite: {regex: '\d+(-\d+)?'}
pattern: '{volume} N\.? ?L\.? ?R\.? ?B\.? {page}(, {pincite})?'
idform pattern: '[Ii]d\.,?( at)? {pincite}'
shortform pattern: '{same volume} N\.? ?L\.? ?R\.? ?B\.? at {pincite}'
Expand Down
8 changes: 4 additions & 4 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@


<link rel="icon" href="/assets/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.34">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.37">



<title>CiteURL</title>



<link rel="stylesheet" href="/assets/stylesheets/main.35f28582.min.css">
<link rel="stylesheet" href="/assets/stylesheets/main.8c3ca2c6.min.css">


<link rel="stylesheet" href="/assets/stylesheets/palette.06af60db.min.css">
Expand Down Expand Up @@ -354,10 +354,10 @@ <h1>404 - Not found</h1>
</div>


<script id="__config" type="application/json">{"base": "/", "features": [], "search": "/assets/javascripts/workers/search.07f07601.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.4.4"}</script>
<script id="__config" type="application/json">{"base": "/", "features": [], "search": "/assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.5.0"}</script>


<script src="/assets/javascripts/bundle.56dfad97.min.js"></script>
<script src="/assets/javascripts/bundle.d6f25eb3.min.js"></script>


</body>
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/assets/stylesheets/main.35f28582.min.css

This file was deleted.

1 change: 0 additions & 1 deletion docs/assets/stylesheets/main.35f28582.min.css.map

This file was deleted.

1 change: 1 addition & 0 deletions docs/assets/stylesheets/main.8c3ca2c6.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/stylesheets/main.8c3ca2c6.min.css.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/frontends/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@


<link rel="icon" href="../assets/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.34">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.37">



<title>CiteURL Frontends - CiteURL</title>



<link rel="stylesheet" href="../assets/stylesheets/main.35f28582.min.css">
<link rel="stylesheet" href="../assets/stylesheets/main.8c3ca2c6.min.css">


<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
Expand Down Expand Up @@ -534,10 +534,10 @@ <h2 id="gnome-shell-search-provider">GNOME Shell Search Provider</h2>
</div>


<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.07f07601.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.4.4"}</script>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.5.0"}</script>


<script src="../assets/javascripts/bundle.56dfad97.min.js"></script>
<script src="../assets/javascripts/bundle.d6f25eb3.min.js"></script>


</body>
Expand Down
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@


<link rel="icon" href="assets/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.34">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.37">



<title>CiteURL</title>



<link rel="stylesheet" href="assets/stylesheets/main.35f28582.min.css">
<link rel="stylesheet" href="assets/stylesheets/main.8c3ca2c6.min.css">


<link rel="stylesheet" href="assets/stylesheets/palette.06af60db.min.css">
Expand Down Expand Up @@ -545,10 +545,10 @@ <h2 id="credits">Credits</h2>
</div>


<script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.07f07601.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.4.4"}</script>
<script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.5.0"}</script>


<script src="assets/javascripts/bundle.56dfad97.min.js"></script>
<script src="assets/javascripts/bundle.d6f25eb3.min.js"></script>


</body>
Expand Down
8 changes: 4 additions & 4 deletions docs/library/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@


<link rel="icon" href="../assets/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.34">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.37">



<title>Library Reference - CiteURL</title>



<link rel="stylesheet" href="../assets/stylesheets/main.35f28582.min.css">
<link rel="stylesheet" href="../assets/stylesheets/main.8c3ca2c6.min.css">


<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
Expand Down Expand Up @@ -6965,10 +6965,10 @@ <h2 id="citeurl.StringBuilder.to_dict" class="doc doc-heading">
</div>


<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.07f07601.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.4.4"}</script>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.5.0"}</script>


<script src="../assets/javascripts/bundle.56dfad97.min.js"></script>
<script src="../assets/javascripts/bundle.d6f25eb3.min.js"></script>


</body>
Expand Down
Binary file modified docs/sitemap.xml.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions docs/template-yamls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@


<link rel="icon" href="../assets/favicon.png">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.34">
<meta name="generator" content="mkdocs-1.6.0, mkdocs-material-9.5.37">



<title>Writing Your Own Templates - CiteURL</title>



<link rel="stylesheet" href="../assets/stylesheets/main.35f28582.min.css">
<link rel="stylesheet" href="../assets/stylesheets/main.8c3ca2c6.min.css">


<link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
Expand Down Expand Up @@ -969,10 +969,10 @@ <h3 id="template-inheritance">Template Inheritance</h3>
</div>


<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.07f07601.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.4.4"}</script>
<script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": "11.5.0"}</script>


<script src="../assets/javascripts/bundle.56dfad97.min.js"></script>
<script src="../assets/javascripts/bundle.d6f25eb3.min.js"></script>


</body>
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ markdown_extensions:
- pymdownx.superfences

extra:
version: 11.4.4
version: 11.5.0
history_buttons: false
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name = 'citeurl',
version = '11.4.4',
version = '11.5.0',
description = 'an extensible tool to process legal citations in text',
author = 'Simon Raindrum Sherred',
author_email = 'simonraindrum@gmail.com',
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_list_citations():
def test_insert_links():
citations = list_cites(TEXT)
output = insert_links(TEXT)
assert output == """Federal law provides that courts should award prevailing civil rights plaintiffs reasonable attorneys fees, <a class="citation" href="https://www.law.cornell.edu/uscode/text/42/1988#b" title="42 U.S.C. § 1988(b)">42 USC § 1988(b)</a>, and, by discretion, expert fees, <a class="citation" href="https://www.law.cornell.edu/uscode/text/42/1988#c" title="42 U.S.C. § 1988(c)">id. at (c)</a>. This is because the importance of civil rights litigation cannot be measured by a damages judgment. See Riverside v. Rivera, <a class="citation" href="https://cite.case.law/us/477/561" title="477 U.S. 561">477 U.S. 561</a> (1986). But Evans v. Jeff D. upheld a settlement where the plaintiffs got everything they wanted, on condition that they waive attorneys\' fees. <a class="citation" href="https://cite.case.law/us/475/717" title="475 U.S. 717">475 U.S. 717</a> (1986). This ruling lets savvy defendants create a wedge between plaintiffs and their attorneys, discouraging civil rights suits and undermining the court\'s logic in Riverside, <a class="citation" href="https://cite.case.law/us/477/561#p574" title="477 U.S. 561, 574">477 U.S. at 574</a>-78."""
assert output == """Federal law provides that courts should award prevailing civil rights plaintiffs reasonable attorneys fees, <a class="citation" href="https://www.law.cornell.edu/uscode/text/42/1988#b" title="42 U.S.C. § 1988(b)">42 USC § 1988(b)</a>, and, by discretion, expert fees, <a class="citation" href="https://www.law.cornell.edu/uscode/text/42/1988#c" title="42 U.S.C. § 1988(c)">id. at (c)</a>. This is because the importance of civil rights litigation cannot be measured by a damages judgment. See Riverside v. Rivera, <a class="citation" href="https://cite.case.law/us/477/561" title="477 U.S. 561">477 U.S. 561</a> (1986). But Evans v. Jeff D. upheld a settlement where the plaintiffs got everything they wanted, on condition that they waive attorneys\' fees. <a class="citation" href="https://cite.case.law/us/475/717" title="475 U.S. 717">475 U.S. 717</a> (1986). This ruling lets savvy defendants create a wedge between plaintiffs and their attorneys, discouraging civil rights suits and undermining the court\'s logic in Riverside, <a class="citation" href="https://cite.case.law/us/477/561#p574" title="477 U.S. 561, 574-78">477 U.S. at 574-78</a>."""

#def test_list_authorities():
# citations = Citator().list_cites(TEXT)
Expand Down

0 comments on commit 4abb413

Please sign in to comment.