diff --git a/README.md b/README.md
index 7a8aa19..1123952 100644
--- a/README.md
+++ b/README.md
@@ -132,4 +132,4 @@ In order to apply the workflow to any other publication copy it into the `input/
1. eoaTEI -> html
- $ tei2html.py output/125/with_bibl -o output/125/html
+ $ tei2html.py -o output/125/html output/125/with_bibl
diff --git a/dependencies.conf b/dependencies.conf
index 0df1f0e..1cd7964 100644
--- a/dependencies.conf
+++ b/dependencies.conf
@@ -13,7 +13,7 @@ hash = 2a01be46ee82fce5eba6074359b3d18db2222e0c
[eoa-publication-model]
uri = https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git
-hash = 5237e12c6205cff45d46c7d5f62d5222040be7a1
+hash = 62eb49dd05ebe3697e47acac31a1cff2f60c6f7a
# init not needed, since only example publication is needed
[webdesign_platform]
diff --git a/src/stylesheets/insert_bibliography.xsl b/src/stylesheets/insert_bibliography.xsl
index 4ad9367..11a3fba 100644
--- a/src/stylesheets/insert_bibliography.xsl
+++ b/src/stylesheets/insert_bibliography.xsl
@@ -15,8 +15,17 @@
version="1.0"
/>
-
-
+
+
+
+
@@ -43,7 +52,20 @@
-
+
+ print bibliography in chapter
+
+
+
+
+ inserting from file
+
+
+
+
+
diff --git a/src/stylesheets/tex4ht_2_tei.xsl b/src/stylesheets/tex4ht_2_tei.xsl
index 5d80102..addad6a 100644
--- a/src/stylesheets/tex4ht_2_tei.xsl
+++ b/src/stylesheets/tex4ht_2_tei.xsl
@@ -28,7 +28,7 @@
- Title
+ Bibliography for
Publication Information
@@ -116,7 +116,7 @@
rendering citations
-
+
diff --git a/src/tei_add_bibl.py b/src/tei_add_bibl.py
index 53662aa..a9aa30d 100755
--- a/src/tei_add_bibl.py
+++ b/src/tei_add_bibl.py
@@ -76,16 +76,16 @@ def publication_info(xml_tree):
}
-def create_bibl_and_insert(
- tei_tree,
+def create_bibl(
+ tei_node,
publ_info,
temp_dir,
tei_bib_file,
tei_file,
- tei_with_bibl_file
+ # tei_with_bibl_file
):
translations = {"de" : "german", "en" : "english", "it" : "italian", "fr" : "french"}
- tei_info = bib2html.get_bibl_info( tei_tree )
+ tei_info = bib2html.get_bibl_info( tei_node )
logging.debug( f"info from tei file: {tei_info}" )
bib2html.bib2tei(
bib_file = publ_info['bib_file'],
@@ -97,12 +97,6 @@ def create_bibl_and_insert(
output_file = tei_bib_file,
log_dir = temp_dir / "log"
)
- run_xslt(
- tei_file,
- BASE_DIR / "stylesheets/insert_bibliography.xsl",
- params = [ f"tei_bib_file={tei_bib_file.absolute()}" ],
- output_file = tei_with_bibl_file
- )
if __name__ == '__main__':
@@ -200,26 +194,53 @@ def create_bibl_and_insert(
output_dir,
# ignore = ignore_patterns( tei_file_input ) if not(tei_file_input . is_absolute()) else None
)
+ tei_with_bibl_file = \
+ (output_dir / (tei_file.with_suffix("").name + "_with_bibl")) . with_suffix( ".xml" )
if publ_info["publ_type"] == "monograph":
- create_bibl_and_insert(
+ # create bibliography in tei format:
+ tei_bib_file = \
+ (output_dir/ "bibliography/bibliography_all") . with_suffix(".tei")
+ create_bibl(
tei_tree,
publ_info = publ_info,
temp_dir = output_dir / "temp/all",
- tei_bib_file = (output_dir/ "bibliography/bibliography_all") . with_suffix(".tei"),
+ tei_bib_file = tei_bib_file,
tei_file = tei_file,
- tei_with_bibl_file = (output_dir / (tei_file.with_suffix("").name + "_with_bibl")) . with_suffix( ".xml" )
+ # tei_with_bibl_file = tei_with_bibl_file
+ )
+ # insert bibliography:
+ run_xslt(
+ tei_file,
+ BASE_DIR / "stylesheets/insert_bibliography.xsl",
+ params = [ f"tei_bib_files={tei_bib_file.absolute()}" ],
+ output_file = tei_with_bibl_file
)
elif publ_info["publ_type"] == "anthology":
- for chap_node in tei_tree.xpath("//tei:body//tei:div[@type = 'chapter']"):
-
- chapter_id = chap_node.xpath("@xml:id", namespaces=NS_MAP)
- create_bibl_and_insert(
- tei_tree,
+ all_chapter_bibl_filepaths = []
+ # for every chapter:
+ for chap_node in tei_tree.xpath("//tei:body//tei:div[@type = 'chapter']", namespaces = NS_MAP):
+
+ chapter_id = chap_node.xpath("@xml:id", namespaces=NS_MAP)[0]
+ logging.info( f"creating bibliography for chapter: {chapter_id}" )
+ # create bibliography in tei format:
+ tei_bib_file = (output_dir/ f"bibliography/bibliography_chap_{chapter_id}") . with_suffix(".tei")
+ create_bibl(
+ chap_node,
publ_info = publ_info,
temp_dir = output_dir / f"temp/chap_{chapter_id}",
- tei_bib_file = (output_dir/ f"bibliography/bibliography_chap_{chapter_id}") . with_suffix(".tei"),
+ tei_bib_file = tei_bib_file,
tei_file = tei_file,
- tei_with_bibl_file = (output_dir / (tei_file.with_suffix("").name + "_with_bibl")) . with_suffix( ".xml" ),
)
+ all_chapter_bibl_filepaths += [tei_bib_file]
+ # insert bibliography:
+ all_teibibs_arg = ";".join(
+ [str(f.absolute()) for f in all_chapter_bibl_filepaths]
+ )
+ run_xslt(
+ tei_file,
+ BASE_DIR / "stylesheets/insert_bibliography.xsl",
+ params = [ f"tei_bib_files={all_teibibs_arg}" ],
+ output_file = tei_with_bibl_file
+ )
else:
raise( Exception("unknown publication type!"))
diff --git a/src/utils/bib2html.py b/src/utils/bib2html.py
index ce0775b..9f028fa 100755
--- a/src/utils/bib2html.py
+++ b/src/utils/bib2html.py
@@ -424,5 +424,5 @@ def teibib_to_eoa1(
language = translations[language],
temp_dir = args.temp_dir
)
- print( etree.tostring( references_in_html ) )
+ # print( etree.tostring( references_in_html ) )
# finis