Commit 4c5d4598 authored by Edith Cannet's avatar Edith Cannet Committed by Jerome Chauveau
Browse files

import TEI : bio auteur, planche, formules de maths, linguistique, annexe,...

import TEI : bio auteur, planche, formules de maths, linguistique, annexe, block sources citations, listes, typo
parent 01182f9e
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ section.body h4 {
    /*line-height: 15%;*/
}

/************/
/***** figure *******/
figure {
    width: 100%;
    min-height: 100px;
@@ -275,6 +275,15 @@ img {
    margin-top: -26px;
}

/****** formula ******/
.fig-formula {
    background-color:white;
    color: black;
}

figure[class='fig-formula inline'] {
    display:inline;
}
/* tables */
table caption {
    font-size: 1.2rem;
@@ -286,6 +295,13 @@ table {
    width: 100%;
}

table[class='linguistic'] {
    display: table;
    width: 100%;
    margin-top:1em;
    margin-bottom: 1em;
}

td,th {
    border-bottom:1px solid #ccc;
    font-size:1.1rem;
@@ -584,6 +600,10 @@ div[id^="footnotes"] .label {
    text-decoration: underline;
}

.bio {
    margin-bottom:2ex;
}

/******************************/
div.boxed-text{
    border: 1px solid var(--grey-color);
+180 −45
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@
    </xsl:template>
    
    <xsl:template match="tei:back">
        <xsl:apply-templates select="child::tei:div[@type='bibliography']"/>
        <xsl:apply-templates select="child::tei:div[@type='bibliography']|child::tei:div[@type='appendix']"/>
    </xsl:template>

    <xsl:template match="tei:front">
@@ -127,7 +127,7 @@
                <div id="toc-contents">

                    <ol>
                        <xsl:for-each select="../tei:body//tei:div|../tei:back//tei:div[@type='bibliography']|../tei:back//tei:listBibl">
                        <xsl:for-each select="../tei:body//tei:div|../tei:back//tei:div[@type='bibliography']|../tei:back//tei:listBibl|../tei:back//tei:div[@type='appendix']">
                            <xsl:call-template name="sec-toc-item">
                                <xsl:with-param name="item" select="."/>
                            </xsl:call-template>
@@ -138,7 +138,7 @@
            </div>
            
            <div id="figures" class="content-tab" style="display:none">
                <xsl:for-each select="..//tei:figure[not(child::tei:table)]">
                <xsl:for-each select="..//tei:figure[not(child::tei:table) and not(child::tei:formula) and not(ancestor::tei:figure)]">
                    <xsl:apply-templates select="." mode="panel"/>
                </xsl:for-each>
            </div>
@@ -313,6 +313,12 @@
                <xsl:value-of select="concat(local-name(.),' meta-field')"></xsl:value-of>
            </xsl:attribute>
            <xsl:apply-templates/>
            <xsl:if test="child::tei:ref[@type='biography']">
                <xsl:variable name="bioLink" select="substring-after(child::tei:ref[@type='biography']/@target,'#')"/>
                <div class="bio">
                    <xsl:apply-templates select="ancestor::tei:TEI//tei:div[@type='biography' and @xml:id=$bioLink]/*"/>
                </div>
            </xsl:if>
        </div>
    </xsl:template>
    
@@ -344,22 +350,56 @@
        </span>
    </xsl:template>
    
    <xsl:template match="tei:hi[@rend='italic']">
        <em>
    <xsl:template match="tei:hi">
        <xsl:choose>
            <xsl:when test="@rend='italic'">
                <i>
                    <xsl:apply-templates/>
        </em>
    </xsl:template>

    <xsl:template match="tei:hi[@rend='bold']">
        <strong>
                </i>
            </xsl:when>
            <xsl:when test="@rend='bold'">
                <b>
                    <xsl:apply-templates/>
        </strong>
    </xsl:template>
    
    <xsl:template match="tei:hi[@rend='sup']">
                </b>
            </xsl:when>
            <xsl:when test="@rend='small-caps'">
                <span style="font-variant:small-caps;">
                    <xsl:apply-templates/>
                </span>
            </xsl:when>
            <xsl:when test="@rend='sup'">
                <sup>
                    <xsl:apply-templates/>
                </sup>
            </xsl:when>
            <xsl:when test="@rend='sub'">
                <sub>
                    <xsl:apply-templates/>
                </sub>
            </xsl:when>
            <xsl:when test="@rend='underline'">
                <span style="text-decoration:underline;">
                    <xsl:apply-templates/>
                </span>
            </xsl:when>
            <xsl:when test="@rend='strikethrough'">
                <s>
                    <xsl:apply-templates/>
                </s>
            </xsl:when>
            <xsl:when test="@rend='bold italic'">
                <b><i><xsl:apply-templates/></i></b>
            </xsl:when>
            <xsl:when test="@rend='small-caps italic'">
                <i><span style="font-variant:small-caps;"><xsl:apply-templates/></span></i>
            </xsl:when>
            <xsl:when test="@rend='sup italic'">
                <sup><i><xsl:apply-templates/></i></sup>
            </xsl:when>
            <xsl:when test="@rend='sub italic'">
                <sub><i><xsl:apply-templates/></i></sub>
            </xsl:when>
        </xsl:choose>        
    </xsl:template>

    <xsl:template match="styled-content">
@@ -462,7 +502,7 @@
            <xsl:attribute name="class">
                <xsl:choose>
                    <xsl:when test="child::tei:table">fig-table</xsl:when>
                    <xsl:when test="child::tei:formula">fig-formula</xsl:when>
                    <xsl:when test="child::tei:formula">fig-formula <xsl:value-of select="@rend"/></xsl:when>
                    <xsl:otherwise>fig-ill</xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
@@ -583,32 +623,37 @@
        </div>
    </xsl:template>

    <!-- list -->
    <xsl:template match="tei:list[@type='ordered']">
        <ol>
            <xsl:apply-templates/>
        </ol>
    </xsl:template>

    <xsl:template match="tei:list[@type='unordered']">
        <ul>
            <xsl:apply-templates/>
        </ul>
    </xsl:template>
    
    <!-- index -->
    <xsl:template match="tei:list[contains(@type,'level')]">
        <ul class="{concat('index-',@type)}">
    <!-- liste -->
    <xsl:template match="tei:list">
        <xsl:variable name="listType" select="if( @type = 'ordered' )
        then ( 'ol' ) else ( 'ul' )"/>
        <xsl:variable name="attributeValue" select="replace(@rendition, '^#?list-', 'list-style-type:')"/>
        <xsl:element name="{$listType}">
            <xsl:attribute name="class" select="concat('index-',@type)"/>
            <xsl:attribute name="id" select="@xml:id"/>
            <xsl:attribute name="style">
                <xsl:choose>
                    <xsl:when test="contains($attributeValue,'ndash')">
                        <xsl:text>list-style-type: "– ";</xsl:text>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$attributeValue"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:attribute>
            <xsl:apply-templates/>
        </ul>
        </xsl:element>
    </xsl:template>

    <xsl:template match="tei:item">
        <li><xsl:apply-templates/></li>
        <li>
            <xsl:apply-templates/>
        </li>
    </xsl:template>
    
    <!-- citations -->
    <xsl:template match="tei:cit">
    <xsl:template match="tei:cit[not(@type='linguistic')]">
        <blockquote><xsl:apply-templates/></blockquote>
    </xsl:template>
    
@@ -616,16 +661,106 @@
        <p><xsl:apply-templates/></p>
    </xsl:template>
    
    <xsl:template match="tei:formula[@notation='latex']">
        <div class="disp-formula">
    <!-- maths -->
    <xsl:template match="tei:formula[@notation='mathml']|tei:formula[@notation='mml']">
        <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="tei:formula[@notation='latex']">
        <xsl:choose>
            <xsl:when test="parent::tei:figure[@rend='inline']">
                <span class="{@notation}">
                    <xsl:copy-of select="concat('$$',node(),'$$')"/>
                </span>
            </xsl:when>
            <xsl:otherwise>
                <div class="formula-tex">
                    <xsl:copy-of select="@*"/>
                    <xsl:copy-of select="concat('$$',node(),'$$')"/>
                </div>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="mml:*">
        <xsl:element name="{local-name(.)}">
            <xsl:apply-templates select="@*|*|text()"/>
    <xsl:template match="*[namespace-uri()='http://www.w3.org/1998/Math/MathML']">
        <xsl:element name="{local-name()}">
            <xsl:copy-of select="@* except(@display)"/>
            <xsl:apply-templates select="node()"/>
        </xsl:element>
    </xsl:template>
    
    <!-- linguistique -->
    <xsl:template match="tei:cit[@type='linguistic']">
        <table class="linguistic">
            <tbody>
                <xsl:for-each select="child::tei:quote/*">
                    <tr>
                        <xsl:apply-templates select="."/>
                    </tr>
                </xsl:for-each>
            </tbody>
        </table>
    </xsl:template>

    <xsl:template match="tei:label">
        <td>
            <xsl:apply-templates/>
        </td>
    </xsl:template>

    <xsl:template match="tei:seg">
        <xsl:choose>
            <xsl:when test="not(preceding-sibling::tei:seg or following-sibling::tei:seg) and parent::tei:quote[@type='example']">
                <xsl:apply-templates/>
            </xsl:when>
            <xsl:otherwise>
                <td>
                    <xsl:apply-templates/>
                </td>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="tei:num[not(parent::tei:label)]">
        <td>
            <xsl:apply-templates/>
        </td>
    </xsl:template>

    <xsl:template match="tei:quote[ancestor::tei:cit[@type='linguistic']]">
        <xsl:variable name="maxCount">
          <xsl:for-each select="ancestor::tei:cit[@type='linguistic']/tei:quote/tei:quote[@type='example']">
            <xsl:sort select="count(*)" data-type="number" order="descending"/>
            <xsl:if test="position() = 1">
              <xsl:value-of select="count(*)"/>
            </xsl:if>
          </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="nbSeg">
            <xsl:value-of select="count(child::tei:seg)"/>
        </xsl:variable>
        <xsl:choose>
            <xsl:when test="@type='trl'">
                <td>
                    <xsl:attribute name="number-columns-spanned">
                        <xsl:value-of select="$maxCount"/>
                    </xsl:attribute>
                    <xsl:apply-templates/>
                </td>
            </xsl:when>
            <xsl:when test="$nbSeg='1'">
                <td>
                    <xsl:attribute name="number-columns-spanned">
                        <xsl:value-of select="$maxCount"/>
                    </xsl:attribute>
                        <xsl:apply-templates/>
                </td>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    

</xsl:stylesheet>