Added anchors to themes in book text.
authorMarek Stępniowski <marek@stepniowski.com>
Tue, 16 Sep 2008 10:32:29 +0000 (12:32 +0200)
committerMarek Stępniowski <marek@stepniowski.com>
Tue, 16 Sep 2008 10:32:29 +0000 (12:32 +0200)
lib/librarian/book2html.xslt
lib/librarian/html.py

index d6c9db1..827c696 100644 (file)
@@ -1,7 +1,7 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:wl="http://wolnelektury.pl/functions" >
 
-<xsl:output method="xml" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes" />
+<xsl:output encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" indent="yes" />
 
 
 <xsl:template match="utwor">
 <!-- Themes -->
 <xsl:template match="begin" mode="inline">
     <xsl:variable name="mnum" select="concat('m', substring(@id, 2))" />
-    <span class="theme-begin" fid="{substring(@id, 2)}">
-        <a name="m{substring(@id, 2)}" />
+    <a name="m{substring(@id, 2)}" class="theme-begin" fid="{substring(@id, 2)}">
         <xsl:value-of select="string(following::motyw[@id=$mnum]/text())" />
-    </span>
+    </a>
 </xsl:template>
 
 <xsl:template match="end" mode="inline">
index bb5a637..3dd70f5 100644 (file)
@@ -109,7 +109,7 @@ def extract_fragments(input_filename):
 
     for event, element in etree.iterparse(input_filename, events=('start', 'end')):
         # Process begin and end elements
-        if element.tag == 'span' and element.get('class', '') in ('theme-begin', 'theme-end'):
+        if element.get('class', '') in ('theme-begin', 'theme-end'):
             if not event == 'end': continue # Process elements only once, on end event
 
             # Open new fragment