[jsword-svn] r1004 - trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml

dmsmith at crosswire.org dmsmith at crosswire.org
Tue Feb 14 14:26:48 MST 2006


Author: dmsmith
Date: 2006-02-14 14:26:27 -0700 (Tue, 14 Feb 2006)
New Revision: 1004

Added:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbstractTag.java
Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ATag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AliasTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BlockquoteTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BrTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CenterTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ForeignTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HrTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ITag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LiTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NameTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NoteTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/OlTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PbTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/RootTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScripRefTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScriptureTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SmallTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SupTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SyncTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TableTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/Tag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TdTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TermTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ThTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TrTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UlTag.java
Log:
Bug fix in ThML Code.
Whitespace improvements.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ATag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ATag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ATag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ATag implements Tag
+public class ATag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Added: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbstractTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbstractTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbstractTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -0,0 +1,54 @@
+/**
+ * Distribution License:
+ * JSword is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License, version 2.1 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * The License is available on the internet at:
+ *       http://www.gnu.org/copyleft/lgpl.html
+ * or by writing to:
+ *      Free Software Foundation, Inc.
+ *      59 Temple Place - Suite 330
+ *      Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ *     The copyright to this program is held by it's authors.
+ *
+ * ID: $Id: AliasTag.java 763 2005-07-27 23:26:43Z dmsmith $
+ */
+package org.crosswire.jsword.book.filter.thml;
+
+import org.jdom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * The AbstractTag ignores the tag.
+ * 
+ * @see gnu.lgpl.License for license details.
+ *      The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public abstract class AbstractTag implements Tag
+{
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
+     */
+    public Element processTag(Element ele, Attributes attrs)
+    {
+        // Ignore the tag
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.Tag#processContent(org.jdom.Element)
+     */
+    public void processContent(Element ele)
+    {
+        // By default do nothing
+    }
+
+}


Property changes on: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AbstractTag.java
___________________________________________________________________
Name: astChangedRevision
   + 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AliasTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AliasTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/AliasTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -31,7 +31,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class AliasTag implements Tag
+public class AliasTag extends AbstractTag
 {
     /**
      * simple ctor

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class BTag implements Tag
+public class BTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BlockquoteTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BlockquoteTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BlockquoteTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class BlockquoteTag implements Tag
+public class BlockquoteTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -48,6 +48,7 @@
     public Element processTag(Element ele, Attributes attrs)
     {
         Element q = OSISUtil.factory().createQ();
+        ele.setAttribute(OSISUtil.ATTRIBUTE_Q_TYPE, OSISUtil.Q_BLOCK);
         ele.addContent(q);
         return q;
     }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BrTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BrTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/BrTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class BrTag implements Tag
+public class BrTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -47,8 +47,8 @@
      */
     public Element processTag(Element ele, Attributes attrs)
     {
-        Element p = OSISUtil.factory().createP();
-        ele.addContent(p);
-        return p;
+        Element lb = OSISUtil.factory().createLB();
+        ele.addContent(lb);
+        return lb;
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CenterTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CenterTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CenterTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class CenterTag implements Tag
+public class CenterTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CitationTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class CitationTag implements Tag
+public class CitationTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -48,6 +48,7 @@
     public Element processTag(Element ele, Attributes attrs)
     {
         Element q = OSISUtil.factory().createQ();
+        ele.setAttribute(OSISUtil.ATTRIBUTE_Q_TYPE, OSISUtil.Q_BLOCK);
         ele.addContent(q);
         return q;
     }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/CustomHandler.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -75,24 +75,8 @@
             }
         }
 
-        Tag t = (Tag) TAG_MAP.get(qname);
+        Tag t = getTag(localname, qname);
 
-        // Some of the THML books are broken in that they use uppercase
-        // element names, which the spec disallows, but we might as well
-        // look out for them
-        if (t == null)
-        {
-            t = (Tag) TAG_MAP.get(qname.toLowerCase());
-
-            if (t == null)
-            {
-                log.warn("unknown thml element: " + localname + " qname=" + qname); //$NON-NLS-1$ //$NON-NLS-2$
-                return;
-            }
-
-            DataPolice.report("Wrong case used in thml element: " + qname); //$NON-NLS-1$
-        }
-
         stack.addFirst(t.processTag(ele, attrs));
     }
 
@@ -114,8 +98,8 @@
         int size = current.getContentSize();
 
         // what we are adding
-        String text = new String(data, offset, length);
-
+        String text = 
+            new String(data, offset, length);
         // If the last element in the list is a string then we should add
         // this string on to the end of it rather than add a new list item
         // because (probably as an atrifact of the HTML/XSL transform we get
@@ -142,6 +126,8 @@
         // When we are done processing an element we need to remove
         // it from the stack so that nothing more is attached to it.
         Element finished = (Element) stack.removeFirst();
+        Tag t = getTag(localname, qname);
+        t.processContent(finished);
 
         // If it was the last element then it was the root element
         // so save it
@@ -156,6 +142,28 @@
         return rootElement;
     }
 
+    private Tag getTag(String localname, String qname)
+    {
+        Tag t = (Tag) TAG_MAP.get(qname);
+    
+        // Some of the THML books are broken in that they use uppercase
+        // element names, which the spec disallows, but we might as well
+        // look out for them
+        if (t == null)
+        {
+            t = (Tag) TAG_MAP.get(qname.toLowerCase());
+    
+            if (t == null)
+            {
+                log.warn("unknown thml element: " + localname + " qname=" + qname); //$NON-NLS-1$ //$NON-NLS-2$
+                return t;
+            }
+    
+            DataPolice.report("Wrong case used in thml element: " + qname); //$NON-NLS-1$
+        }
+        return t;
+    }
+
     /**
      * When the document is parsed,
      * this is the last element popped off the stack.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class DivTag implements Tag
+public class DivTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/FontTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -34,7 +34,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class FontTag implements Tag
+public class FontTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ForeignTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ForeignTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ForeignTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ForeignTag implements Tag
+public class ForeignTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HrTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HrTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/HrTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -21,8 +21,6 @@
  */
 package org.crosswire.jsword.book.filter.thml;
 
-import org.jdom.Element;
-import org.xml.sax.Attributes;
 
 /**
  * THML Tag to process the hr element.
@@ -31,7 +29,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class HrTag implements Tag
+public class HrTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -40,13 +38,4 @@
     {
         return "hr"; //$NON-NLS-1$
     }
-
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
-     */
-    public Element processTag(Element ele, Attributes attrs)
-    {
-        // NOTE(joe): are we right to ignore HR tags in THML?
-        return null;
-    }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ITag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ITag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ITag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ITag implements Tag
+public class ITag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/IgnoreTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -21,8 +21,6 @@
  */
 package org.crosswire.jsword.book.filter.thml;
 
-import org.jdom.Element;
-import org.xml.sax.Attributes;
 
 /**
  * THML Tag to process the pb element.
@@ -31,7 +29,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class IgnoreTag implements Tag
+public class IgnoreTag extends AbstractTag
 {
     /**
      * Simple ctor
@@ -49,14 +47,6 @@
         return name;
     }
 
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
-     */
-    public Element processTag(Element ele, Attributes attrs)
-    {
-        return null;
-    }
-
     /**
      * The tag name that we are ignoring
      */

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LiTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LiTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/LiTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class LiTag implements Tag
+public class LiTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NameTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NameTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NameTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class NameTag implements Tag
+public class NameTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NoteTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NoteTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/NoteTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class NoteTag implements Tag
+public class NoteTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/OlTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/OlTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/OlTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class OlTag implements Tag
+public class OlTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -48,6 +48,7 @@
     public Element processTag(Element ele, Attributes attrs)
     {
         Element list = OSISUtil.factory().createList();
+        ele.setAttribute(OSISUtil.ATTRIBUTE_LIST_TYPE, OSISUtil.LIST_ORDERED);
         ele.addContent(list);
         return list;
     }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class PTag implements Tag
+public class PTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PbTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PbTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/PbTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -21,17 +21,16 @@
  */
 package org.crosswire.jsword.book.filter.thml;
 
-import org.jdom.Element;
-import org.xml.sax.Attributes;
 
 /**
- * THML Tag to process the pb element.
+ * THML Tag to process the pb (page break) element.
+ * Do nothing since pages are a hard copy kind of thing.
  * 
  * @see gnu.lgpl.License for license details.
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class PbTag implements Tag
+public class PbTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -41,12 +40,4 @@
         return "pb"; //$NON-NLS-1$
     }
 
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.filter.thml.Tag#processTag(org.jdom.Element, org.xml.sax.Attributes)
-     */
-    public Element processTag(Element ele, Attributes attrs)
-    {
-        // Only for print edition
-        return null;
-    }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/RootTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/RootTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/RootTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class RootTag implements Tag
+public class RootTag extends AbstractTag
 {
     /**
      * This is added by the parser to we make the string accessible

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScripRefTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScripRefTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScripRefTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -37,7 +37,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ScripRefTag implements Tag
+public class ScripRefTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -68,22 +68,39 @@
             {
                 DataPolice.report("Unparsable passage:" + refstr + " due to " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
             }
-            ele.addContent(reference);
         }
         else
         {
-            // Don't lose the text
-            reference = OSISUtil.factory().createDiv();
-            // NOTE(joe): is it right to ignore a missing passage
-            //DataPolice.report("Missing passage.");
-            //XMLUtil.debugSAXAttributes(attrs);
+            // The reference will be filled in by processContent
+            reference = OSISUtil.factory().createReference();
         }
 
+        ele.addContent(reference);
+
         return reference;
     }
 
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.filter.thml.AbstractTag#processContent(org.jdom.Element)
+     */
+    public void processContent(Element ele)
+    {
+        String refstr = ele.getValue();
+        try
+        {
+            Passage ref = (Passage) keyf.getKey(refstr);
+            String osisname = ref.getOsisRef();
+            ele.setAttribute(OSISUtil.ATTRIBUTE_REFERENCE_OSISREF, osisname);
+        }
+        catch (NoSuchKeyException ex)
+        {
+            DataPolice.report("Unparsable passage:" + refstr + " due to " + ex.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+    }
+
     /**
      * To convert strings into Biblical keys
      */
     protected KeyFactory keyf = PassageKeyFactory.instance();
+
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScriptureTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScriptureTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ScriptureTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ScriptureTag implements Tag
+public class ScriptureTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SmallTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SmallTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SmallTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class SmallTag implements Tag
+public class SmallTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SupTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SupTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SupTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class SupTag implements Tag
+public class SupTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SyncTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SyncTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/SyncTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -44,7 +44,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class SyncTag implements Tag
+public class SyncTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TableTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TableTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TableTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class TableTag implements Tag
+public class TableTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/Tag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/Tag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/Tag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -49,4 +49,10 @@
      * @return the element to which content is attached
      */
     Element processTag(Element ele, Attributes attrs);
+
+    /**
+     * Do additional processing of the tag after the element has been created.
+     * @param ele the created element to process
+     */
+    void processContent(Element ele);
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TdTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TdTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TdTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class TdTag implements Tag
+public class TdTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TermTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TermTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TermTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class TermTag implements Tag
+public class TermTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ThTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ThTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/ThTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class ThTag implements Tag
+public class ThTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TrTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TrTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/TrTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class TrTag implements Tag
+public class TrTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class UTag implements Tag
+public class UTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UlTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UlTag.java	2006-02-14 21:24:58 UTC (rev 1003)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/UlTag.java	2006-02-14 21:26:27 UTC (rev 1004)
@@ -32,7 +32,7 @@
  *      The copyright to this program is held by it's authors.
  * @author Joe Walker [joe at eireneh dot com]
  */
-public class UlTag implements Tag
+public class UlTag extends AbstractTag
 {
     /* (non-Javadoc)
      * @see org.crosswire.jsword.book.filter.thml.Tag#getTagName()
@@ -48,6 +48,7 @@
     public Element processTag(Element ele, Attributes attrs)
     {
         Element list = OSISUtil.factory().createList();
+        ele.setAttribute(OSISUtil.ATTRIBUTE_LIST_TYPE, OSISUtil.LIST_UNORDERED);
         ele.addContent(list);
         return list;
     }



More information about the jsword-svn mailing list