changeset 14:c8442e0eff84

Remove <caption> tags. Generlized {table} around {code} blocks.
author smith@nwoca.org
date Tue, 01 Feb 2011 12:34:45 -0500
parents cf58f4b9902b
children 494ca5643e1a
files src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java test/org/nwoca/ssdt/tools/html2wiki/Html2WikiTest.java
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java	Fri Jan 28 16:32:04 2011 -0500
+++ b/src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java	Tue Feb 01 12:34:45 2011 -0500
@@ -38,6 +38,7 @@
         transformers.add(new DeleteTransformer("<a .*?>|</a>"));
         transformers.add(new DeleteTransformer("(?m)^\\*"));
         transformers.add(new DeleteTransformer("(?m)<br>$"));
+        transformers.add(new DeleteTransformer("<caption>.*</caption>"));  // remove SDML captions (used for TOC)
         transformers.add(new DeleteTransformer("<font .*?>|</font>"));
         transformers.add(new CloseTagTransformer("<li>","(\n|\r)*(<li>|</ul>|</ol>|<ul>|<ol>)","</li>"));
         transformers.add(new BadTableDataTransformer());
@@ -87,8 +88,8 @@
         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{0,1}\\{code\\}","{code}"));
-        transformers.add(new ReplaceTransformer("\\{code\\}\\n\\{td\\}\\{tr\\}\\{table\\}","{code}"));
+        transformers.add(new ReplaceTransformer("\\{table:.*\\}(\\n|\\s|\\{t.\\}|\\*\\S*\\*)*\\{code\\}","{code}"));
+        transformers.add(new ReplaceTransformer("\\{code\\}(\\n|\\{t.\\}|\\s)*\\{table\\}","{code}"));
 
         //Change borderStyle of code window for "screenshots" to none.
         transformers.add(new TagTransformer("\\{code\\}([\\s\\n]*?_______________)", true, "{code:borderStyle=none}", ""));
--- a/test/org/nwoca/ssdt/tools/html2wiki/Html2WikiTest.java	Fri Jan 28 16:32:04 2011 -0500
+++ b/test/org/nwoca/ssdt/tools/html2wiki/Html2WikiTest.java	Tue Feb 01 12:34:45 2011 -0500
@@ -58,7 +58,7 @@
 //
 //        File path = new File(Html2WikiTest.class.getResource("/resources").toURI());
 //        System.out.println(path);
-         Html2Wiki.main( new String[] {path.toString(), "OECN System Managers Handbook"});
+         Html2Wiki.main( new String[] {path.toString(), ""});
 //
     }
 }