diff --git a/README.md b/README.md index e140d68..22bc37f 100644 --- a/README.md +++ b/README.md @@ -59,23 +59,23 @@ Call the attributes, for example ## Documentation -| Field | EpiDoc source element (XPath) | -|---------------------------|--------------------------------------------------------------------------------| -| commentary | `//body/div[@type='commentary' and @subtype='general']` | -| edition_foreign_languages | `//body/div[@type='edition']//foreign/@xml:lang` | -| edition_language | `//body/div[@type='edition']/@xml:lang` | -| idno | `//teiHeader/fileDesc/publicationStmt/idno` | -| authority | `//teiHeader/fileDesc/publicationStmt/authority` | -| availability | `//teiHeader/fileDesc/publicationStmt/availability` | -| languages | `//teiHeader/profileDesc/langUsage/language` | -| material | `//teiHeader/fileDesc/sourceDesc/msDesc/physDesc/objectDesc//support/material` | -| 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` | +| Field | EpiDoc source element (XPath) | +|---------------------------|--------------------------------------------------------------------------------------------------------| +| commentary | `//body/div[@type='commentary' and @subtype='general']` | +| edition_foreign_languages | `//body/div[@type='edition']//foreign/@xml:lang` | +| edition_language | `//body/div[@type='edition']/@xml:lang` | +| idno | `//teiHeader/fileDesc/publicationStmt/idno` `//teiHeader/fileDesc/sourceDesc/msDesc/msIdentifier/idno` | +| authority | `//teiHeader/fileDesc/publicationStmt/authority` | +| availability | `//teiHeader/fileDesc/publicationStmt/availability` | +| languages | `//teiHeader/profileDesc/langUsage/language` | +| material | `//teiHeader/fileDesc/sourceDesc/msDesc/physDesc/objectDesc//support/material` | +| 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` | ## Development diff --git a/epidoc_parser/api.py b/epidoc_parser/api.py index ab0046b..853f86c 100644 --- a/epidoc_parser/api.py +++ b/epidoc_parser/api.py @@ -116,6 +116,12 @@ def loads(s: str) -> EpiDoc: if sourcedesc: msdesc = sourcedesc.msdesc if msdesc: + msidentifier = msdesc.msidentifier + if msidentifier: + idno = msidentifier.idno + if idno and hasattr(idno, "type"): + if idno.get("type") == "invNo": + doc.idno["invno"] = idno.text physdesc = msdesc.physdesc if physdesc: objectdesc = physdesc.objectdesc diff --git a/tests/test_api.py b/tests/test_api.py index 22b6f65..aa26e01 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -46,7 +46,13 @@ def test_all(self): os.path.join("apis", "yale.apis.0000540000.xml"), EpiDoc.create( title="Receipt, Roman CE ii (ca. 162) [BPG]", - idno={"apisid": "yale.apis.0000540000", "controlno": "(cty)54", "hgv": "20671", "tm": "20671"}, + idno={ + "apisid": "yale.apis.0000540000", + "controlno": "(cty)54", + "hgv": "20671", + "invno": "P.CtYBR inv. 54", + "tm": "20671", + }, authority="APIS", origin_dates=[{"notafter": "0199", "notbefore": "0100", "text": "Roman CE ii (ca. 162) [BPG]"}], terms=[{"text": "Receipt"}, {"text": "Papyri"}], @@ -95,6 +101,7 @@ def test_all(self): "dclp": "26761", "dclp-hybrid": "sb;16;13045", "filename": "26761", + "invno": "Vienna, Nationalbibliothek G 39978", "ldab": "5148", "tm": "26761", }, @@ -143,6 +150,7 @@ def test_all(self): "dclp": "135858", "dclp-hybrid": "tm;;135858", "filename": "135858", + "invno": "Cairo, Coptic Museum 901", "ldab": "135858", "tm": "135858", },