aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2014-01-11 18:18:40 -0800
committerWaylan Limberg <waylan@gmail.com>2014-01-11 18:18:40 -0800
commit73fdecaf2cf00d85b7c933f5b8d186d74a80ff2a (patch)
tree1a7d7861ceb5767f36db01f7715bd723d8fdd12a
parentd0e088d535a478b9435ff49fd27583f5cb9c2641 (diff)
parent3e63253c8b95f01b803a8c945a8666d4df4cb27a (diff)
downloadmarkdown-73fdecaf2cf00d85b7c933f5b8d186d74a80ff2a.tar.gz
markdown-73fdecaf2cf00d85b7c933f5b8d186d74a80ff2a.tar.bz2
markdown-73fdecaf2cf00d85b7c933f5b8d186d74a80ff2a.zip
Merge pull request #267 from ryneeverett/attr_list-tables
tables and attr_list compatibility
-rw-r--r--markdown/extensions/attr_list.py2
-rw-r--r--tests/extensions/extra/tables_and_attr_list.html18
-rw-r--r--tests/extensions/extra/tables_and_attr_list.txt4
-rw-r--r--tests/extensions/extra/test.cfg3
4 files changed, 27 insertions, 0 deletions
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index fabc925..8b65f56 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -121,6 +121,8 @@ class AttrListTreeprocessor(Treeprocessor):
elif elem.text:
# no children. Get from text.
m = RE.search(elem.text)
+ if not m and elem.tag == 'td':
+ m = re.search(self.BASE_RE, elem.text)
if m:
self.assign_attrs(elem, m.group(1))
elem.text = elem.text[:m.start()]
diff --git a/tests/extensions/extra/tables_and_attr_list.html b/tests/extensions/extra/tables_and_attr_list.html
new file mode 100644
index 0000000..7d2451b
--- /dev/null
+++ b/tests/extensions/extra/tables_and_attr_list.html
@@ -0,0 +1,18 @@
+<table>
+<thead>
+<tr>
+<th>First Header</th>
+<th>Second Header</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="foo bar" title="Some title!">Content Cell</td>
+<td>Content Cell</td>
+</tr>
+<tr>
+<td>Content Cell</td>
+<td class="foo bar" title="Some title!">Content Cell</td>
+</tr>
+</tbody>
+</table>
diff --git a/tests/extensions/extra/tables_and_attr_list.txt b/tests/extensions/extra/tables_and_attr_list.txt
new file mode 100644
index 0000000..517eeeb
--- /dev/null
+++ b/tests/extensions/extra/tables_and_attr_list.txt
@@ -0,0 +1,4 @@
+First Header | Second Header
+------------------------------------------------------ | -------------
+Content Cell{: class="foo bar" title="Some title!" } | Content Cell
+Content Cell | Content Cell{: class="foo bar" title="Some title!" }
diff --git a/tests/extensions/extra/test.cfg b/tests/extensions/extra/test.cfg
index 74893f0..52d48f0 100644
--- a/tests/extensions/extra/test.cfg
+++ b/tests/extensions/extra/test.cfg
@@ -15,3 +15,6 @@ extensions=footnotes
[tables]
extensions=tables
+
+[tables_and_attr_list]
+extensions=tables,attr_list