OSDN Git Service

add def-ref system.
authorhylom <hylom@users.sourceforge.jp>
Thu, 21 May 2009 09:44:35 +0000 (18:44 +0900)
committerhylom <hylom@users.sourceforge.jp>
Thu, 21 May 2009 09:44:35 +0000 (18:44 +0900)
markupper.py

index 0bdcf98..e21fd2a 100755 (executable)
@@ -267,14 +267,14 @@ class Markupper(object):
         except AttributeError:
             str_title = ""
         print "<p><b>%s</b></p>" % (str_title)
-        print self._list_start(line)
+        print self._list_start()
 
         for line in self.input_iter:
             line = line.strip()
             line = line.replace("&", "&amp;")
             line = line.replace("<", "&lt;")
             line = line.replace(">", "&gt;")
-            if line == "----":
+            if re.search(ur"""^☆\+---""", line):
                 break
             print line
         print self._list_end()
@@ -414,12 +414,12 @@ class Markupper(object):
 
 
     def _table_start(self, cap):
-        return """<table align="center" border="1" width="90%%">
+        return """<div style="width:90%%; margin-left:auto;margin-right:auto;"><table align="center" border="1">
     <caption><b>%s</b></caption>
     """ % cap
 
-    def _table_end(self):
-        return "</table>\n"
+    def _table_end(self, footnote=""):
+        return "</table>\n%s</div>\n" % (footnote,)
 
     def _table(self, line):
         str_title = ""
@@ -436,10 +436,14 @@ class Markupper(object):
 
         num_row = 0
         table_contents = []
+        footnote = ""
         for line in self.input_iter:
             line = line.strip(" \n")
             if re.search(ur"^\s*$", line):
                 break
+            if re.search(ur"^※", line):
+                footnote = re.search(ur"^(※.*)$", line).group(1)
+                break
             line = self._default_markup_rule(line)
             if re.search(ur"^〓", line):
                 line = re.sub(ur"^〓", "", line)
@@ -496,7 +500,7 @@ class Markupper(object):
             # line = line.replace("\t", "</td><td>")
             # print line
 
-        print self._table_end()
+        print self._table_end(footnote)
         self._table_buf1 =  self._table_buf1 + self._table_end()
         if self.index_haskey("tables"):
             self.index("tables")[fig_name] = self._table_buf1