From: hylom Date: Thu, 21 May 2009 09:44:35 +0000 (+0900) Subject: add def-ref system. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a5dd70f3341c25c8218604aaeac4ac6745431395;hp=174868c6be1a8ceb56c4138c80f7befce7c2cde7;p=otptools%2Fotptools.git add def-ref system. --- diff --git a/markupper.py b/markupper.py index 0bdcf98..e21fd2a 100755 --- a/markupper.py +++ b/markupper.py @@ -267,14 +267,14 @@ class Markupper(object): except AttributeError: str_title = "" print "

%s

" % (str_title) - print self._list_start(line) + print self._list_start() for line in self.input_iter: line = line.strip() line = line.replace("&", "&") line = line.replace("<", "<") line = line.replace(">", ">") - 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 """ + return """
""" % cap - def _table_end(self): - return "
%s
\n" + def _table_end(self, footnote=""): + return "\n%s\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", "") # 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