]> git.draconx.ca Git - homepage.git/commitdiff
Try to allow word wrapping to occur in email addresses.
authorNick Bowler <nbowler@draconx.ca>
Wed, 24 Feb 2021 01:53:09 +0000 (20:53 -0500)
committerNick Bowler <nbowler@draconx.ca>
Wed, 24 Feb 2021 03:53:00 +0000 (22:53 -0500)
content/style.scss
layouts/default.xsl

index e517d90c08b7270b49c70d24ae9fbfdb5e3e59cd..5e91c9e5c6631122146e70844836506a77b3c1a1 100644 (file)
@@ -366,6 +366,8 @@ table.filelist {
 #footer p { color: $annotationcolour; }
 #article-info p { font-style: italic; }
 
+.wbr:after { content: "\200b"; }
+
 // "unordered" lists with explicit ordering in content
 ul.ordered > {
     li { list-style: none; }
index f0fddc97bb27cf9063ad403f27612f4c35b48953..a97f784c2d3e2cb63a4446e4b6eaadf0ed2f7f21 100644 (file)
   <pre>&#x2060;<code><xsl:value-of select='f:strip-leading(.)' /></code></pre>
 </xsl:template>
 
+<!--
+  Attempt to wrap the first bit of linked email addresses to allow
+  linewrapping to occur after the '@'.
+-->
+<xsl:template match='xhtml:a[starts-with(@href,"mailto:")]/text()'>
+  <xsl:variable name='addr' select='substring-after(../@href, "mailto:")' />
+
+  <xsl:variable name='wrap'
+    select='concat(substring-before($addr, "@"), "@")' />
+
+  <xsl:choose>
+    <xsl:when test='contains(., $wrap)'>
+      <xsl:value-of select='substring-before(., $wrap)' />
+      <span class='wbr'>
+        <xsl:value-of select='$wrap' />
+      </span>
+      <xsl:value-of select='substring-after(., $wrap)' />
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy />
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <!--
   Add a simple way to reference a document node by ID and include the XHTML
   code listing directly in the document.