浏览代码

Activated ulink.hyphenate.
Added hyphenate-url support to several inline tags.

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/new-xsl@8035 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Manuel Canales Esparcia 18 年之前
父节点
当前提交
65626c1497
共有 2 个文件被更改,包括 65 次插入0 次删除
  1. 5 0
      lfs-pdf.xsl
  2. 60 0
      pdf/lfs-mixed.xsl

+ 5 - 0
lfs-pdf.xsl

@@ -48,6 +48,11 @@
     <!-- Hyphenate? -->
   <xsl:param name="hyphenate">false</xsl:param>
 
+    <!-- Allow URLs to be automatically hyphenated -->
+  <xsl:param name="ulink.hyphenate" select="'&#x200B;'"></xsl:param>
+
+ <xsl:param name="ulink.hyphenate.chars" select="'/._-'"></xsl:param>
+
     <!-- Specify the default text alignment. -->
   <xsl:param name="alignment">justify</xsl:param>
 

+ 60 - 0
pdf/lfs-mixed.xsl

@@ -90,6 +90,66 @@
     </fo:inline>
   </xsl:template>
 
+    <!-- inline.monoseq:
+           Added hyphenate-url support to classname, exceptionname, interfacename,
+           methodname, computeroutput, constant, envar, filename, function, code,
+           literal, option, promt, systemitem, varname, sgmltag, tag, and uri -->
+    <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
+  <xsl:template name="inline.monoseq">
+    <xsl:param name="content">
+      <xsl:call-template name="simple.xlink">
+        <xsl:with-param name="content">
+          <xsl:call-template name="hyphenate-url">
+            <xsl:with-param name="url">
+              <xsl:apply-templates/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:param>
+    <fo:inline xsl:use-attribute-sets="monospace.properties">
+      <xsl:if test="@dir">
+        <xsl:attribute name="direction">
+          <xsl:choose>
+            <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+            <xsl:otherwise>rtl</xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:copy-of select="$content"/>
+    </fo:inline>
+  </xsl:template>
+
+    <!-- inline.italicmonoseq:
+           Added hyphenate-url support to parameter, replaceable, structfield,
+           function/parameter, and function/replaceable -->
+    <!-- The original template is in {docbook-xsl}/fo/inline.xsl -->
+  <xsl:template name="inline.italicmonoseq">
+    <xsl:param name="content">
+      <xsl:call-template name="simple.xlink">
+        <xsl:with-param name="content">
+          <xsl:call-template name="hyphenate-url">
+            <xsl:with-param name="url">
+              <xsl:apply-templates/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:param>
+    <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
+      <xsl:call-template name="anchor"/>
+      <xsl:if test="@dir">
+        <xsl:attribute name="direction">
+          <xsl:choose>
+            <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+            <xsl:otherwise>rtl</xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:copy-of select="$content"/>
+    </fo:inline>
+  </xsl:template>
+
     <!-- Show external URLs in italic font -->
   <xsl:attribute-set name="xref.properties">
     <xsl:attribute name="font-style">