aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-11-04 17:49:57 -0500
committerWaylan Limberg <waylan@gmail.com>2012-11-04 17:49:57 -0500
commit54a00d12c03ab3c05ffb57f5797b96b31b6d894f (patch)
tree06adfce1a6211b4803e25b2ac646b959e2c8ec6c
parent6aa18462014e9c6327b84bf39108dd5f56db37e5 (diff)
parentf7cb43fdc351904306851699a3c84cf19e64ea35 (diff)
downloadmarkdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.tar.gz
markdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.tar.bz2
markdown-54a00d12c03ab3c05ffb57f5797b96b31b6d894f.zip
Merge branch 'master' of https://github.com/waylan/Python-Markdown2.2.1.final
-rw-r--r--docs/_template.html2
-rw-r--r--docs/basic.css23
-rw-r--r--docs/extensions/attr_list.txt2
-rw-r--r--docs/extensions/index.txt72
-rw-r--r--[-rwxr-xr-x]markdown/extensions/fenced_code.py0
-rw-r--r--markdown/inlinepatterns.py23
6 files changed, 90 insertions, 32 deletions
diff --git a/docs/_template.html b/docs/_template.html
index 202fefb..d3780dd 100644
--- a/docs/_template.html
+++ b/docs/_template.html
@@ -62,7 +62,7 @@
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
- <a href="siteindex.html" title="General Index">index</a></li>
+ <a href="%(base)ssiteindex.html" title="General Index">index</a></li>
<li class="right">
<a href="%(next_url)s" title="%(next_title)s"
accesskey="N">next</a> |</li>
diff --git a/docs/basic.css b/docs/basic.css
index 2b47622..3f7ad80 100644
--- a/docs/basic.css
+++ b/docs/basic.css
@@ -246,18 +246,21 @@ div.body p.centered {
/* -- tables ---------------------------------------------------------------- */
-table.docutils {
+table {
border: 0 solid #dce;
border-collapse: collapse;
}
-table.docutils td, table.docutils th {
+table td, table th {
padding: 2px 5px 2px 5px;
- border-left: 0;
- background-color: #eef;
}
-table.docutils td p.last, table.docutils th p.last {
+table td {
+ border: 1px solid #ddd;
+ background-color: #eef;
+}
+
+table td p.last, table th p.last {
margin-bottom: 0;
}
@@ -269,8 +272,8 @@ table.footnote td, table.footnote th {
border: 0 !important;
}
-table.docutils th {
- border-top: 1px solid #cac;
+table th {
+ border: 1px solid #cac;
background-color: #ede;
}
@@ -280,7 +283,7 @@ th {
}
th.head {
- text-align: center;
+ text-align: center;
}
/* -- other body styles ----------------------------------------------------- */
@@ -371,6 +374,10 @@ pre {
overflow-y: hidden;
}
+code {
+ font-size: 1.1em;
+}
+
td.linenos pre {
padding: 5px 0px;
border: 0;
diff --git a/docs/extensions/attr_list.txt b/docs/extensions/attr_list.txt
index 11c6a28..4134a82 100644
--- a/docs/extensions/attr_list.txt
+++ b/docs/extensions/attr_list.txt
@@ -73,7 +73,7 @@ The above results in the following output:
To define attributes on inline elements, the attribute list should be defined
immediately after the inline element with no whitespace.
- [link](http://example.com){: class="foo bar" title="Some title! }
+ [link](http://example.com){: class="foo bar" title="Some title!" }
The above results in the following output:
diff --git a/docs/extensions/index.txt b/docs/extensions/index.txt
index 82b0eda..a51f797 100644
--- a/docs/extensions/index.txt
+++ b/docs/extensions/index.txt
@@ -15,12 +15,12 @@ actual source files.
To use an extension, pass it's name to markdown with the `extensions` keyword.
See the [Library Reference](../reference.html#extensions) for more details.
- markdown.markdown(some_text, extensions=['extra', 'nl2br'])
+ markdown.markdown(some_text, extensions=['footnotes', 'nl2br'])
From the command line, specify an extension with the `-x` option. See the
[Command Line docs](../cli.html) or use the `--help` option for more details.
- python -m markdown -x extra input.txt > output.html
+ python -m markdown -x footnotes -x tables input.txt > output.html
Officially Supported Extensions
-------------------------------
@@ -31,23 +31,57 @@ maintained here and all bug reports should be made to the project. If you
have a typical install of Python-Markdown, these extensions are already
available to you.
-* [Extra](extra.html)
- * [Abbreviations](abbreviations.html)
- * [Attribute Lists](attr_list.html)
- * [Definition Lists](definition_lists.html)
- * [Fenced Code Blocks](fenced_code_blocks.html)
- * [Footnotes](footnotes.html)
- * [Tables](tables.html)
- * [Smart Strong](smart_strong.html)
-* [CodeHilite](code_hilite.html)
-* [HTML Tidy](html_tidy.html)
-* [HeaderId](header_id.html)
-* [Meta-Data](meta_data.html)
-* [New Line to Break](nl2br.html)
-* [RSS](rss.html)
-* [Sane Lists](sane_lists.html)
-* [Table of Contents](toc.html)
-* [WikiLinks](wikilinks.html)
+### Markdown Extra
+
+You can enable **all** these extensions just as if it was a single
+`extra` extension. Example:
+
+ markdown.markdown(some_text, extensions=['extra', 'codehilite'])
+
+Extension | Name in Python-Markdown
+--------- | -----------------------
+[Abbreviations][] | `abbr`
+[Attribute Lists][] | `attr_list`
+[Definition Lists][] | `def_list`
+[Fenced Code Blocks][] | `fenced_code`
+[Footnotes][] | `footnotes`
+[Tables][] | `tables`
+[Smart Strong][] | `smart_strong`
+
+[Abbreviations]: abbreviations.html
+[Attribute Lists]: attr_list.html
+[Definition Lists]: definition_lists.html
+[Fenced Code Blocks]: fenced_code_blocks.html
+[Footnotes]: footnotes.html
+[Tables]: tables.html
+[Smart Strong]: smart_strong.html
+
+### Other extensions
+
+There are also some extensions that are not included in Markdown Extra
+but come in the standard Python-Markdown library.
+
+Extension | Name in Python-Markdown
+--------- | -----------------------
+[CodeHilite][] | `codehilite`
+[HTML Tidy][] | `html_tidy`
+[HeaderId] | `headerid`
+[Meta-Data] | `meta`
+[New Line to Break] | `nl2br`
+[RSS] | `rss`
+[Sane Lists] | `sane_lists`
+[Table of Contents] | `toc`
+[WikiLinks] | `wikilinks`
+
+[CodeHilite]: code_hilite.html
+[HTML Tidy]: html_tidy.html
+[HeaderId]: header_id.html
+[Meta-Data]: meta_data.html
+[New Line to Break]: nl2br.html
+[RSS]: rss.html
+[Sane Lists]: sane_lists.html
+[Table of Contents]: toc.html
+[WikiLinks]: wikilinks.html
Third Party Extensions
----------------------
diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py
index 9a1284f..9a1284f 100755..100644
--- a/markdown/extensions/fenced_code.py
+++ b/markdown/extensions/fenced_code.py
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 6ec58c4..ab7b4c6 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -189,10 +189,27 @@ class Pattern:
stash = self.markdown.treeprocessors['inline'].stashed_nodes
except KeyError:
return text
+ def itertext(el):
+ ' Reimplement Element.itertext for older python versions '
+ tag = el.tag
+ if not isinstance(tag, basestring) and tag is not None:
+ return
+ if el.text:
+ yield el.text
+ for e in el:
+ for s in itertext(e):
+ yield s
+ if e.tail:
+ yield e.tail
def get_stash(m):
id = m.group(1)
if id in stash:
- return stash.get(id)
+ value = stash.get(id)
+ if isinstance(value, basestring):
+ return value
+ else:
+ # An etree Element - return text content only
+ return ''.join(itertext(value))
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
@@ -371,7 +388,7 @@ class ImagePattern(LinkPattern):
else:
truealt = m.group(2)
- el.set('alt', truealt)
+ el.set('alt', self.unescape(truealt))
return el
class ReferencePattern(LinkPattern):
@@ -416,7 +433,7 @@ class ImageReferencePattern(ReferencePattern):
el.set("src", self.sanitize_url(href))
if title:
el.set("title", title)
- el.set("alt", text)
+ el.set("alt", self.unescape(text))
return el