Skip to content

Commit

Permalink
Finish support for reprint fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Xennis committed May 31, 2024
1 parent 74b950a commit 6d8855a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Call the attributes, for example
| origin_dates | `//teiHeader/fileDesc/sourceDesc/msDesc/history/origin/origDate` |
| origin_place | `//teiHeader/fileDesc/sourceDesc/msDesc/history/origin/origPlace` |
| provenances | `//teiHeader/fileDesc/sourceDesc/msDesc/history/provenance` |
| reprint_from | `//body/ref[@type='reprint-from']` |
| reprint_in | `//body/ref[@type='reprint-in']` |
| terms | `//teiHeader/profileDesc/textClass//term` |
| title | `//teiHeader/fileDesc/titleStmt/title` |

Expand Down
13 changes: 12 additions & 1 deletion epidoc/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from bs4 import BeautifulSoup

from .body import _Edition
from .body import _Edition, _Head
from .header import _History, _ProfileDesc
from .normalize import _normalize, _normalized_get_text

Expand All @@ -18,6 +18,8 @@ class EpiDoc:
commentary = None
edition_language = None
edition_foreign_languages: dict[str, int] = {}
reprint_from: list[str] = []
reprint_in: list[str] = []

@classmethod
def create(
Expand All @@ -33,6 +35,8 @@ def create(
commentary=None,
edition_language=None,
edition_foreign_languages=None,
reprint_from=None,
reprint_in=None,
):
h = cls()
h.title = title
Expand All @@ -52,6 +56,10 @@ def create(
h.edition_language = edition_language
if edition_foreign_languages is not None:
h.edition_foreign_languages = edition_foreign_languages
if reprint_from is not None:
h.reprint_from = reprint_from
if reprint_in is not None:
h.reprint_in = reprint_in
return h

def __repr__(self):
Expand Down Expand Up @@ -103,4 +111,7 @@ def loads(s):
doc.edition_language = _Edition.language(body)
doc.edition_foreign_languages = _Edition.foreign_languages(body)

doc.reprint_from = _Head.reprint_from(body)
doc.reprint_in = _Head.reprint_in(body)

return doc

0 comments on commit 6d8855a

Please sign in to comment.