<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="L0072" default="finalize">

<!--Pipeline for the lemma FORNICATIO. started 01.04.25 CR
    DOCX2TEI
    -->    
    <property name="diff.dir" value="diff"/>
    <property name="log.dir" value="log"/>
    <property name="xml.dir" value="xml"/>
    <property name="docx.dir" value="docx"/>
    <property name="xsl.dir" value="xsl"/>
    <property name="xslt.log" value="${log.dir}/${ant.project.name}_xslt.log"/>
    <property name="xslt.processor" value="../../../lib/xsltproc/Saxon-HE-9.8.0-12.jar"/>
    <property name="xslt.class" value="net.sf.saxon.TransformerFactoryImpl"/>
        
    <property name="orig.file" value="../../orig/Fornicatio_L0072/ForTEI-2025-04-08-Fornicatio_Endfassung.docx"/>
    <!--Copy original file to the docx folder as _000.docx / _v1-0.docx-->
    <target name="initialize">
        <echo>Initializing L0072.</echo>
        <mkdir dir="${xml.dir}"/>
        <mkdir dir="${log.dir}"/>
        <copy file="${orig.file}" tofile="${docx.dir}/L0072_000.docx"/> 
        <!--L0072_000.docx: copy of original Word document from author "ForTEI-2025-04-08-Fornicatio_Endfassung.docx"-->        
    </target>
    <!--Manual work in Word: L0072_001.docx toc, titles 1-3, terms, 
        saved links from footnotes inline as links.-->
    <target name="patch-000"> <!--depends="initialize"-->
        <copy file="${docx.dir}/L0072_000.docx" tofile="${docx.dir}/L0072_001.docx" patchfile="${diff.dir}/L0072_000.diff"/>
        <echo>Checkpoint: L0072_000.docx saved as L0072_001.docx. 
            Do not delete or regenerate L0072_001.docx, it was used for manual chages in Word.
            L0072_001.docx has corrected links, which failed in the original version.</echo>
    </target>
<!--Manual transformation DOCX2TEI
    
    In this pipeline:
    
    From SVN/trunk/teiedit/lemma-edit/build/L0072/docx/L0072_001.docx!/word/styles.xml run the transformation scenario DOCX TEI P5 
    Saved as L0072_001-TEI-P5.xml, and this as L0072_001.xml for manual changes   
-->
    <target name="patch-000a"> <!--depends="patch-000"-->
        <copy file="${docx.dir}/L0072_001.docx" tofile="${docx.dir}/L0072_001-TEI-P5.xml" patchfile="${diff.dir}/L0072_001.diff"/>
        <echo>DOCX2TEI Transformation.</echo>
    </target>
<!--Structural annotation and manual changes Fornicatio TEI-->        
    <target name="patch-001"> <!-- depends="patch-000" -->
        <echo>Structural annotation.</echo>
        <patch originalfile="${xml.dir}/L0072_001-TEI-P5.xml" destfile="${xml.dir}/L0072_001.xml" patchfile="${diff.dir}/L0072_002.diff"/>
    </target>
    <target name="xslt-001"> <!--depends="patch-001"-->
        <echo>Transformation TEI-P5 to SvSal-TEI.</echo>
        <record name="${xslt.log}" action="start" loglevel="verbose"/>
        <xslt force="true" in="${xml.dir}/L0072_001.xml" out="${xml.dir}/L0072_002.xml" style="${xsl.dir}/L0072_001.xsl" classpath="${xslt.processor}">
            <factory name="${xslt.class}"/>
        </xslt>
        <record name="${xslt.log}" action="stop"/>
    </target>
    <target name="xslt-002" depends="xslt-001">
        <echo>Annotate names, autors as author/persName and SvSal authors with gnd links.</echo>
        <record name="${xslt.log}" action="start" loglevel="verbose"/>
        <xslt force="true" in="${xml.dir}/L0072_002.xml" out="${xml.dir}/L0072_003.xml" style="${xsl.dir}/L0072_002.xsl" classpath="${xslt.processor}">
            <factory name="${xslt.class}"/>
        </xslt>
        <record name="${xslt.log}" action="stop"/>
    </target>
    <target name="xslt-003" depends="xslt-002">
        <echo>Annotate date and biblScope in body//bibl.</echo>
        <record name="${xslt.log}" action="start" loglevel="verbose"/>
        <xslt force="true" in="${xml.dir}/L0072_003.xml" out="${xml.dir}/L0072_004.xml" style="${xsl.dir}/L0072_003.xsl" classpath="${xslt.processor}">
            <factory name="${xslt.class}"/>
        </xslt>
        <record name="${xslt.log}" action="stop"/>
    </target>
    <target name="xslt-004" depends="xslt-003"> 
        <echo>Update div xml:id(s) and toc ref @targets.</echo>
        <record name="${xslt.log}" action="start" loglevel="verbose"/>
        <xslt force="true" in="${xml.dir}/L0072_004.xml" out="${xml.dir}/L0072_005.xml" style="${xsl.dir}/L0072_004.xsl" classpath="${xslt.processor}">
            <factory name="${xslt.class}"/>
        </xslt>
        <record name="${xslt.log}" action="stop"/>
    </target>
    <target name="finalize" depends="xslt-004">
        <echo>Reached end of pipeline.</echo>
    </target>

<!--


CR Starting Word tagging 01.04.25
Ready for online publication 29.04.25

Manually added?

examples from L0007

    Structural annotation. front, body, back, div(s).
    
    * (“\w+”) -> <quote>$1</quote> should not appear inside <bibl> for instance “Ludus”
    * the rest by finding  “\w+
    * double space "  " -> in one space " "
    * if words starting with → were not tagged in word as <hi rend="Term">, 
      use <g style="font-family:Wingdings;" n="F0E0"/> (in Word →) -> <term>...</term>
    * Short citations: <bibl><biblScope>SP 1.5.57</biblScope></bibl> and <bibl><biblScope>1.6.34</biblScope></bibl>
    * Added  type="section", type="subsection" in div(s)  
    * correct <head>\n titles in one line.
    * deleted </seg><seg rend="smallcaps"> so it remains smallcaps as <seg rend="smallcaps">[Name]</seg>
    * in div[@type eq 'sources'], <p><ref>..</ref></p> with only links belong to a preceding::p. 
    * Change first name lastname to lastname, firstname 
        use regex:

        (<hi rend="cite-rec-body">)(\w+)(\s+)(<seg rend="smallcaps">\w+</seg>) replace with $1$4,$3$2
        (<hi rend="cite-rec-body">)(\S+)(\s+)(<seg rend="smallcaps">\w+</seg>) replace with $1$4,$3$2
    
        e.g. <hi rend="cite-rec-body">Melchior <seg rend="smallcaps">Cano</seg>
        
        should be:
                    <hi rend="cite-rec-body"><seg rend="smallcaps">Cano</seg>, Melchior

       

        (<hi rend="cite-rec-body">)(\S+\s+\w+)(\s+)(<seg rend="smallcaps">\w+</seg>) replace with $1$4,$3$2

        <hi rend="cite-rec-body">Luis de <seg rend="smallcaps">Granada</seg>
        should be:
        <hi rend="cite-rec-body"><seg rend="smallcaps">Granada</seg>, Luis de
       
        (<hi rend="cite-rec-body">)(\S+\s+\w+)(\s+)(<seg rend="smallcaps">\S+\s+\S+</seg>)

    The rest manually
    
    * Added new persNames in SVN/trunk/teiedit/lemma-edit/build/L0007/xsl/Names.xml:
        Salas
        Azor
        Villaroel
        Pedraza
        Diáz de Luco
        Alfonso X
        Macdonald
        Villalón
        Mercado
        Montalvo
        Moreno
        Aquinas
        Bonaventura
        Hostiensis
        Villa-Flores
        Wohlhaupter
        Pino Abad
        Lucchesi
        Ceccarelli
        Kéry


-->
</project>