aboutsummaryrefslogtreecommitdiffstats
path: root/tests2/formater.py
diff options
context:
space:
mode:
authorArtem <artem@artem.(none)>2008-06-24 20:39:50 +0500
committerArtem <artem@artem.(none)>2008-06-24 20:39:50 +0500
commit2dbfcc0c510b46c9bfa288cb370b2d4f7fe7555d (patch)
tree3c4bc7c0532b98b42f6abfb53d92dd9ef57b0a7a /tests2/formater.py
parenteede42cb87a74b1a91b360a218d05f9a5c703e55 (diff)
downloadmarkdown-2dbfcc0c510b46c9bfa288cb370b2d4f7fe7555d.tar.gz
markdown-2dbfcc0c510b46c9bfa288cb370b2d4f7fe7555d.tar.bz2
markdown-2dbfcc0c510b46c9bfa288cb370b2d4f7fe7555d.zip
second commit
Diffstat (limited to 'tests2/formater.py')
-rw-r--r--tests2/formater.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests2/formater.py b/tests2/formater.py
new file mode 100644
index 0000000..26d850f
--- /dev/null
+++ b/tests2/formater.py
@@ -0,0 +1,55 @@
+from __future__ import with_statement
+import os
+
+excl_tm_cases = """basic_safe_mode
+basic_safe_mode_escape
+auto_link_safe_mode
+code_safe_emphasis
+emacs_head_vars
+emacs_tail_vars
+footnotes
+footnotes_letters
+footnotes_markup
+footnotes_safe_mode_escape
+nested_list_safe_mode
+issue2_safe_mode_borks_markup
+issue3_bad_code_color_hack
+link_defn_spaces_in_url
+link_patterns
+link_patterns_double_hit
+link_patterns_edge_cases
+mismatched_footnotes
+nested_lists_safe_mode
+pyshell
+syntax_color"""
+
+
+def reformat(path, dest, ex=""):
+ excl = ex.split("\n")
+ for fname in os.listdir(path):
+ if fname.endswith(".html"):
+ if fname[:-5] in excl:
+ continue
+ res = processFile(path + fname)
+ with open(dest + fname, "w") as rfile:
+ rfile.write(res)
+
+def processFile(filePath):
+ with open(filePath) as f:
+ result = f.read()
+ result = result.replace("</pre>\n\n<p>", "</pre><p>")
+ result = result.replace("</pre>\n<", "</pre><")
+ result = result.replace("</li>", "\n</li>")
+ result = result.replace("<li>", "<li>\n")
+ result = result.replace(">\n<p>", "><p>")
+ result = result.replace("\" />", "\"/>")
+ result = result.replace("</p>\n", "\n</p>\n")
+
+ return result
+
+if __name__ == "__main__":
+ reformat("php-markdown-cases/", "php-markdown-cases-new/")
+ reformat("tm-cases/", "tm-cases-new/", excl_tm_cases)
+
+
+ \ No newline at end of file