[sword-svn] r370 - trunk/modules/python

chrislit at crosswire.org chrislit at crosswire.org
Thu Aug 9 18:21:19 MST 2012


Author: chrislit
Date: 2012-08-09 18:21:19 -0700 (Thu, 09 Aug 2012)
New Revision: 370

Modified:
   trunk/modules/python/usfm2osis.py
Log:
various TODO notes


Modified: trunk/modules/python/usfm2osis.py
===================================================================
--- trunk/modules/python/usfm2osis.py	2012-08-09 11:38:14 UTC (rev 369)
+++ trunk/modules/python/usfm2osis.py	2012-08-10 01:21:19 UTC (rev 370)
@@ -292,6 +292,7 @@
 
         # \h#_text...  ###TESTED###
         osis = re.sub(r'\\h\b\s+(.+)\s*\n', r'<title type="runningHead">\1</title>\n', osis)
+        # TODO: \h1-5
 
         # \toc1_text...
         osis = re.sub(r'\\toc1\b\s+(.+)\s*\n', r'<milestone type="x-toc1" n="\1"/>\n', osis)
@@ -318,8 +319,8 @@
         NB: tags are generally 'supported' to the degree that their non-introduction equivalents are supported
         """
         # \imt#
-        # \is#  ###TESTED###
-        # \ip  ###TESTED###
+        # \is#
+        # \ip
         # \ipi
         # \im
         # \imi
@@ -328,19 +329,19 @@
         # \ipr
         # \iq#
         # \ib
-        # \ili
+        # \ili#
         # \iot
         # \io#
         # \ior...\ior*
         # \iex
         # \iqt...\iqt*
-        # \imte
+        # \imte#
         # \ie
         # encapsulate introduction elements in a <div>
-        osis = re.sub(r'(\\i(mt|mt\d+|s|d\d+|p|pi|m|mi|pq|mq|pr|q|q\d+|b|li|ot|o|o\d+|or|or*|ex|qt|qt*|mte|e)\b.+?)(?=\n\\(c|s|m|p|d))', u'<div type="introduction">'+r'\1'+u'</div>\n', osis, flags=re.DOTALL)
+        #osis = re.sub(r'(\\i(mt|mt\d+|s|d\d+|p|pi|m|mi|pq|mq|pr|q|q\d+|b|li|ot|o|o\d+|or|or*|ex|qt|qt*|mte|e)\b.+?)(?=\n\\(c|s|m|p|d))', u'<div type="introduction">'+r'\1'+u'</div>\n', osis, flags=re.DOTALL)
         # map all introduction elements to their non-introduction equivalents
-        for e in [r'mt', r'mt\d+', r's', r'd\d+', r'p', r'pi', r'm', r'mi', r'pq', r'mq', r'pr', r'q', r'q\d+', r'b', r'li', r'ot', r'o', r'o\d+', r'or', r'or*', r'ex', r'qt', r'qt*', r'mte', r'e']:
-            osis = re.sub(r'\\i('+e+r')\b', r'\\\1', osis)
+        #for e in [r'mt', r'mt\d+', r's', r'd\d+', r'p', r'pi', r'm', r'mi', r'pq', r'mq', r'pr', r'q', r'q\d+', r'b', r'li', r'ot', r'o', r'o\d+', r'or', r'or*', r'ex', r'qt', r'qt*', r'mte', r'e']:
+        #    osis = re.sub(r'\\i('+e+r')\b', r'\\\1', osis)
         return osis
 
 
@@ -773,7 +774,7 @@
             return figure
         osis = re.sub(r'\\fig\b\s+([^\|]*)\s*\|([^\|]*)\s*\|([^\|]*)\s*\|([^\|]*)\s*\|([^\|]*)\s*\|([^\|]*)\s*\|([^\\]*)\s*\\fig\*', makeFigure, osis)
 
-        # \ndx_...\ndx*
+        # \ndx_...\ndx* #TODO tag with x-glossary instead of <index/>? Is <index/> containerable?
         osis = re.sub(r'\\ndx\s+(.+?)(\s*)\\ndx\*', r'\1<index index="Index" level1="\1"/>\2', osis, flags=re.DOTALL)
 
         # \pro_...\pro*
@@ -1126,3 +1127,39 @@
             print('Unhandled USFM tags: ' + ', '.join(sorted(unhandledTags)) + ' (' + str(len(unhandledTags)) + ' total)')
             if not relaxedConformance:
                 print('Consider using the -r option for relaxed markup processing.')
+
+
+# TOOD: relaxed tags to add:
+# \restore: unpublished, seek example
+# \addpn...\addpn*: For chinese words to be dot underline & underline
+# \p#: Front or back matter text paragraph, level # (if multiple levels)
+# \k#: Concordance main entry text or keyword, level #
+# \xtSee..\xtSee*: Concordance and Names Index markup for an alternate entry target reference.
+# \xtSeeAlso...\xtSeeAlso: Concordance and Names Index markup for an additional entry target reference.
+# \tr#: DEP: map to \tr
+# \phi: DEP: Paragraph text, indented with hanging indent
+# \ps: DEP: Paragraph text, no break with next paragraph text at chapter boundary
+# \psi: DEP: Paragraph text, indented, with no break with next paragraph text (at chapter boundary)
+# \wr...\wr*: OBS:  Auxiliary - Wordlist/Glossary Reference
+
+# 2.0 periphs to remap
+# FRONT MATTER
+# \pub : \periph Publication Data
+# \toc : \periph Table of Contents
+# \pref : \periph Preface
+# \intro : \periph Introduction
+# BACK MATTER
+# \conc : \periph Concordance
+# \glo : \periph Glossary
+# \idx : \periph Index
+# \maps : \periph Map Index
+# OTHER
+# \cov : \periph Cover
+# \spine : \periph Spine
+# \pubinfo: \periph Publication Information
+
+# publishing assistant markers
+# \zpa-xb...\zpa-xb* : \periph Book
+# \zpa-xc...\zpa-xc* : \periph Chapter
+# \zpa-xv...\zpa-xv* : \periph Verse
+# \zpa-xd...\zpa-xd* : \periph Description




More information about the sword-cvs mailing list