CETEIcean 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +6 -0
 - package/README.md +1 -4
 - package/TEI-CE_specification.md +86 -0
 - package/package.json +1 -1
 - package/src/CETEI.js +53 -44
 - package/src/behaviors.js +1 -1
 - package/src/defaultBehaviors.js +6 -2
 - package/src/dom.js +1 -1
 - package/src/utilities.js +57 -32
 - package/test/CETEIcean.css +3 -0
 - package/test/P5.css +362 -0
 - package/test/addBehaviorTest.html +1 -1
 - package/test/nodeTest.js +13 -3
 - package/test/tcw20.html +960 -0
 - package/test/tcw22.xml +468 -0
 - package/test/testTEI.xml +5 -1
 - package/tutorial_es/Ruy_Diaz-La_Argentina_Manuscrita.tei.xml +11579 -0
 - package/xslt/make-CETEIcean-3.xsl +79 -0
 
| 
         @@ -0,0 +1,79 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <?xml version="1.0" encoding="UTF-8"?>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         
     | 
| 
      
 3 
     | 
    
         
            +
              xmlns:xs="http://www.w3.org/2001/XMLSchema"
         
     | 
| 
      
 4 
     | 
    
         
            +
              xmlns:t="http://www.tei-c.org/ns/1.0"
         
     | 
| 
      
 5 
     | 
    
         
            +
              xmlns:eg="http://www.tei-c.org/ns/Examples"
         
     | 
| 
      
 6 
     | 
    
         
            +
              exclude-result-prefixes="t eg xs"
         
     | 
| 
      
 7 
     | 
    
         
            +
              version="3.0" expand-text="yes">
         
     | 
| 
      
 8 
     | 
    
         
            +
              
         
     | 
| 
      
 9 
     | 
    
         
            +
              <xsl:output method="html" version="5" indent="no"/>
         
     | 
| 
      
 10 
     | 
    
         
            +
              <xsl:param name="title">---</xsl:param>
         
     | 
| 
      
 11 
     | 
    
         
            +
              
         
     | 
| 
      
 12 
     | 
    
         
            +
              <!-- Simple XSLT that turns TEI into HTML Custom Elements inside an HTML <div>, with
         
     | 
| 
      
 13 
     | 
    
         
            +
                   the Javascript to run CETEIcean and apply any relevant behaviors. The resulting
         
     | 
| 
      
 14 
     | 
    
         
            +
                   <div> will need to be embedded in an HTML document that links to a CETEI.js and
         
     | 
| 
      
 15 
     | 
    
         
            +
                   any CSS needed to style the output. The first template could be modified to 
         
     | 
| 
      
 16 
     | 
    
         
            +
                   generate a full HTML page. -->
         
     | 
| 
      
 17 
     | 
    
         
            +
              
         
     | 
| 
      
 18 
     | 
    
         
            +
              <xsl:template match="/">
         
     | 
| 
      
 19 
     | 
    
         
            +
                <html>
         
     | 
| 
      
 20 
     | 
    
         
            +
                  <head> 
         
     | 
| 
      
 21 
     | 
    
         
            +
                    <meta charset="UTF-8"/>
         
     | 
| 
      
 22 
     | 
    
         
            +
                    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
         
     | 
| 
      
 23 
     | 
    
         
            +
                    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
         
     | 
| 
      
 24 
     | 
    
         
            +
                    <title>{$title}</title>
         
     | 
| 
      
 25 
     | 
    
         
            +
                    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"/>
         
     | 
| 
      
 26 
     | 
    
         
            +
                    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
         
     | 
| 
      
 27 
     | 
    
         
            +
                    <script src="js/CETEI.js"></script>
         
     | 
| 
      
 28 
     | 
    
         
            +
                    <script src="js/behaviors.js">></script>
         
     | 
| 
      
 29 
     | 
    
         
            +
                  </head>
         
     | 
| 
      
 30 
     | 
    
         
            +
                  <body>
         
     | 
| 
      
 31 
     | 
    
         
            +
                    <div><xsl:text>
         
     | 
| 
      
 32 
     | 
    
         
            +
            </xsl:text>
         
     | 
| 
      
 33 
     | 
    
         
            +
                      <xsl:apply-templates select="node()|comment()"/><xsl:text>
         
     | 
| 
      
 34 
     | 
    
         
            +
            </xsl:text>
         
     | 
| 
      
 35 
     | 
    
         
            +
                      <script type="text/javascript">
         
     | 
| 
      
 36 
     | 
    
         
            +
                        const c = new CETEI();
         
     | 
| 
      
 37 
     | 
    
         
            +
                        c.addBehaviors(behaviors);
         
     | 
| 
      
 38 
     | 
    
         
            +
                        c.processPage();
         
     | 
| 
      
 39 
     | 
    
         
            +
                      </script>
         
     | 
| 
      
 40 
     | 
    
         
            +
                    </div>
         
     | 
| 
      
 41 
     | 
    
         
            +
                  </body>
         
     | 
| 
      
 42 
     | 
    
         
            +
                </html>
         
     | 
| 
      
 43 
     | 
    
         
            +
              </xsl:template>
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
              <xsl:template match="@*|comment()">
         
     | 
| 
      
 46 
     | 
    
         
            +
                <xsl:copy><xsl:apply-templates select="node()|@*|comment()"/></xsl:copy>
         
     | 
| 
      
 47 
     | 
    
         
            +
              </xsl:template>
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
              <xsl:template match="*[namespace-uri(.) = 'http://www.tei-c.org/ns/1.0']">
         
     | 
| 
      
 50 
     | 
    
         
            +
                <xsl:element name="tei-{lower-case(local-name(.))}" >
         
     | 
| 
      
 51 
     | 
    
         
            +
                  <xsl:if test="namespace-uri(parent::*) != namespace-uri(.)"><xsl:attribute name="data-xmlns"><xsl:value-of select="namespace-uri(.)"/></xsl:attribute></xsl:if>
         
     | 
| 
      
 52 
     | 
    
         
            +
                  <xsl:if test="@xml:id">
         
     | 
| 
      
 53 
     | 
    
         
            +
                    <xsl:attribute name="id"><xsl:value-of select="@xml:id"/></xsl:attribute>
         
     | 
| 
      
 54 
     | 
    
         
            +
                  </xsl:if>
         
     | 
| 
      
 55 
     | 
    
         
            +
                  <xsl:if test="@xml:lang">
         
     | 
| 
      
 56 
     | 
    
         
            +
                    <xsl:attribute name="lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>
         
     | 
| 
      
 57 
     | 
    
         
            +
                  </xsl:if>
         
     | 
| 
      
 58 
     | 
    
         
            +
                  <xsl:attribute name="data-origname"><xsl:value-of select="local-name(.)"/></xsl:attribute>
         
     | 
| 
      
 59 
     | 
    
         
            +
                  <xsl:if test="@*">
         
     | 
| 
      
 60 
     | 
    
         
            +
                    <xsl:attribute name="data-origatts">
         
     | 
| 
      
 61 
     | 
    
         
            +
                      <xsl:for-each select="@*">
         
     | 
| 
      
 62 
     | 
    
         
            +
                        <xsl:value-of select="name(.)"/>
         
     | 
| 
      
 63 
     | 
    
         
            +
                        <xsl:if test="not(position() = last())"><xsl:text> </xsl:text></xsl:if>
         
     | 
| 
      
 64 
     | 
    
         
            +
                      </xsl:for-each>
         
     | 
| 
      
 65 
     | 
    
         
            +
                    </xsl:attribute>
         
     | 
| 
      
 66 
     | 
    
         
            +
                  </xsl:if>
         
     | 
| 
      
 67 
     | 
    
         
            +
                  <xsl:for-each select="@*[namespace-uri() = '']">
         
     | 
| 
      
 68 
     | 
    
         
            +
                    <xsl:copy-of select="."/>
         
     | 
| 
      
 69 
     | 
    
         
            +
                  </xsl:for-each>
         
     | 
| 
      
 70 
     | 
    
         
            +
                  <xsl:apply-templates select="node()|comment()|processing-instruction()"/>
         
     | 
| 
      
 71 
     | 
    
         
            +
                </xsl:element>
         
     | 
| 
      
 72 
     | 
    
         
            +
              </xsl:template>
         
     | 
| 
      
 73 
     | 
    
         
            +
              
         
     | 
| 
      
 74 
     | 
    
         
            +
              <xsl:function name="t:elementList">
         
     | 
| 
      
 75 
     | 
    
         
            +
                <xsl:param name="doc"/>
         
     | 
| 
      
 76 
     | 
    
         
            +
                <xsl:for-each select="distinct-values($doc//*[namespace-uri(.) = 'http://www.tei-c.org/ns/1.0']/local-name())">"<xsl:value-of select="."/>"<xsl:if test="position() != last()">,</xsl:if></xsl:for-each>
         
     | 
| 
      
 77 
     | 
    
         
            +
              </xsl:function>
         
     | 
| 
      
 78 
     | 
    
         
            +
              
         
     | 
| 
      
 79 
     | 
    
         
            +
            </xsl:stylesheet>
         
     |