X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=plugins%2Fread_markdown.py;h=c8d4fad18e63349fb4249d1efccd9fa9ffa3beaa;hb=b474fa6988c57d44ea9ded09c9286e510d77136f;hp=06ed2adcaeafa92db18d91cfe241158a335ba67e;hpb=3248fa7b6671cfeb28cefc11313b223ec5e5737d;p=webber.git diff --git a/plugins/read_markdown.py b/plugins/read_markdown.py index 06ed2ad..c8d4fad 100644 --- a/plugins/read_markdown.py +++ b/plugins/read_markdown.py @@ -11,7 +11,7 @@ from webber import * # * call to _do_links() # * logging # * allow "= Header =" in addition to "# Header #" -# +# import os, sys, re, codecs try: @@ -98,7 +98,7 @@ class Markdown(object): self.tab_width = tab_width # For compatibility with earlier markdown2.py and with - # markdown.py's safe_mode being a boolean, + # markdown.py's safe_mode being a boolean, # safe_mode == True -> "replace" if safe_mode is True: self.safe_mode = "replace" @@ -286,7 +286,7 @@ class Markdown(object): text = self._liberal_tag_block_re.sub(hash_html_block_sub, text) # Special case just for
"
for tup in inner:
- yield tup
+ yield tup
yield 0, "
"
def wrap(self, source, outfile):
@@ -1080,26 +1080,26 @@ class Markdown(object):
def _do_code_spans(self, text):
# * Backtick quotes are used for
spans.
- #
+ #
# * You can use multiple backticks as the delimiters if you want to
# include literal backticks in the code span. So, this input:
- #
+ #
# Just type ``foo `bar` baz`` at the prompt.
- #
+ #
# Will translate to:
- #
+ #
# Just type foo `bar` baz
at the prompt.
`bar`
...
return self._code_span_re.sub(self._code_span_sub, text)
@@ -1141,7 +1141,7 @@ class Markdown(object):
text = self._strong_re.sub(r"\2", text)
text = self._em_re.sub(r"\2", text)
return text
-
+
_block_quote_re = re.compile(r'''
( # Wrap whole match in \1
@@ -1231,7 +1231,7 @@ class Markdown(object):
# Smart processing for ampersands and angle brackets that need
# to be encoded.
text = self._ampersand_re.sub('&', text)
-
+
# Encode naked <'s
text = self._naked_lt_re.sub('<', text)
@@ -1289,7 +1289,7 @@ class Markdown(object):
addr = '%s' \
% (''.join(chars), ''.join(chars[7:]))
return addr
-
+
def _do_link_patterns(self, text):
"""Caveat emptor: there isn't much guarding against link
patterns being formed inside other standard Markdown links, e.g.
@@ -1320,7 +1320,7 @@ class Markdown(object):
for hash, link in link_from_hash.items():
text = text.replace(hash, link)
return text
-
+
def _unescape_special_chars(self, text):
# Swap back in all the special characters we've hidden.
for ch, hash in g_escape_table.items():
@@ -1390,18 +1390,18 @@ def _regex_from_encoded_pattern(s):
# Recipe: dedent (0.1.2)
def _dedentlines(lines, tabsize=8, skip_first_line=False):
"""_dedentlines(lines, tabsize=8, skip_first_line=False) -> dedented lines
-
+
"lines" is a list of lines to dedent.
"tabsize" is the tab width to use for indent width calculations.
"skip_first_line" is a boolean indicating if the first line should
be skipped for calculating the indent width and for dedenting.
This is sometimes useful for docstrings and similar.
-
+
Same as dedent() except operates on a sequence of lines. Note: the
lines list is modified **in-place**.
"""
DEBUG = False
- if DEBUG:
+ if DEBUG:
print "dedent: dedent(..., tabsize=%d, skip_first_line=%r)"\
% (tabsize, skip_first_line)
indents = []
@@ -1466,7 +1466,7 @@ def _dedent(text, tabsize=8, skip_first_line=False):
"skip_first_line" is a boolean indicating if the first line should
be skipped for calculating the indent width and for dedenting.
This is sometimes useful for docstrings and similar.
-
+
textwrap.dedent(s), but don't expand tabs to spaces
"""
lines = text.splitlines(1)
@@ -1531,7 +1531,7 @@ def _hr_tag_re_from_tab_width(tab_width):
[ ]{0,%d}
<(hr) # start tag = \2
\b # word break
- ([^<>])*? #
+ ([^<>])*? #
/?> # the matching end tag
[ \t]*
(?=\n{2,}|\Z) # followed by a blank line or end of document