Mercurial > public > html2wiki
changeset 12:c1d94c623854
(none)
author | ferrall@nwoca.org |
---|---|
date | Fri, 28 Jan 2011 14:12:34 -0500 |
parents | 8f23347884c0 |
children | cf58f4b9902b |
files | src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java src/org/nwoca/ssdt/tools/html2wiki/ReflowTransformer.java |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java Fri Jan 28 13:57:25 2011 -0500 +++ b/src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java Fri Jan 28 14:12:34 2011 -0500 @@ -69,7 +69,7 @@ transformers.add(new TagTransformer("<pre>(.*?)</pre>", true, "{code}","{code}")); transformers.add(new TagTransformer("<center>(.*?)</center>", true, "{center}","{center}")); transformers.add(new TagTransformer("<em>(.*?)</em>", "*","*")); - transformers.add(new TagTransformer("<strong>(.*?)</strong>", "*","*")); + transformers.add(new TagTransformer("<strong>(.*?)</strong>", true, "*","*")); transformers.add(new TagTransformer("<u>(.*?)</u>" , "+","+")); transformers.add(new TagTransformer("(?s)<kbd>(.*?)</kbd>", "{{", "}}")); transformers.add(new TagTransformer("<h1>(.*)</h1>", "h1. ", "")); @@ -86,7 +86,7 @@ transformers.add(new ReplaceTransformer("\\{td\\}\\n\\s{2}\\{tr\\}\\n\\{table\\}\\n\\{center\\}","{info}")); //Remove unnecessary table surrounding code blocks. - transformers.add(new ReplaceTransformer("\\{table:.*\\}\\n\\s{2}\\{tr\\}\\n\\s{4}\\{td\\}\\n\\s{6}\\n\\{code\\}","{code}")); + transformers.add(new ReplaceTransformer("\\{table:.*\\}\\n\\s{2}\\{tr\\}\\n\\s{4}\\{td\\}\\n\\s{6}\\n{0,1}\\{code\\}","{code}")); transformers.add(new ReplaceTransformer("\\{code\\}\\n\\{td\\}\\{tr\\}\\{table\\}","{code}")); //Change borderStyle of code window for "screenshots" to none. @@ -97,10 +97,14 @@ transformers.add(new TagTransformer("<blockquote>(.*?)</blockquote>", true, "{quote}", "{quote}")); transformers.add(new DeleteTransformer("(?s)<hr.*?>")); transformers.add(new ReflowTransformer("(\\{info\\})([^\\{]*)(\\{info\\})")); + transformers.add(new ReflowTransformer("(\\{note\\})([^\\{]*)(\\{note\\})")); + transformers.add(new ReflowTransformer("(\\{td\\})([^\\{]*)(\\{td\\})")); + transformers.add(new ReflowTransformer("(\\{li\\})([^\\{]*)(\\{li\\})")); transformers.add(new TagTransformer("<sup>(.*?)</sup>", true, "^\\[","\\]^ ")); transformers.add(new ReplaceTransformer("<","<")); transformers.add(new ReplaceTransformer(">",">")); transformers.add(new ReplaceTransformer(""","\"")); + transformers.add(new ReplaceTransformer("&","&")); transformers.add(new ReplaceTransformer(":\\)",": )")); // No smilies... transformers.add(new ReplaceTransformer("(\\w)(--)(\\w)"," -- ",2));
--- a/src/org/nwoca/ssdt/tools/html2wiki/ReflowTransformer.java Fri Jan 28 13:57:25 2011 -0500 +++ b/src/org/nwoca/ssdt/tools/html2wiki/ReflowTransformer.java Fri Jan 28 14:12:34 2011 -0500 @@ -5,10 +5,7 @@ class ReflowTransformer implements Transformer { private Pattern[] patterns = { - Pattern.compile("(\\n<p>)(.*?)(\\n\\n|\\n<)", Pattern.MULTILINE + Pattern.DOTALL), - Pattern.compile("(<li>)(.*?)(</li>)", Pattern.MULTILINE + Pattern.DOTALL), - Pattern.compile("(<td>)([^<]*)(</td>)", Pattern.MULTILINE + Pattern.DOTALL) - }; + Pattern.compile("(\\n<p>)(.*?)(\\n\\n|\\n<)", Pattern.MULTILINE + Pattern.DOTALL)}; /** * Default transformer refolows paragraphs, li's and td's.