Mercurial > public > html2wiki
comparison src/org/nwoca/ssdt/tools/html2wiki/Html2Wiki.java @ 2:5da2e67620f9
Upgrade to Ivy configuration and begin clean up of tests. Added FreeBSD license.
author | smith@nwoca.org |
---|---|
date | Tue, 25 Jan 2011 17:06:57 -0500 |
parents | f8b1ea49d065 |
children | 22ed6d93442c |
comparison
equal
deleted
inserted
replaced
1:b6e94d49a9a9 | 2:5da2e67620f9 |
---|---|
98 protected static void process(File input) throws IOException { | 98 protected static void process(File input) throws IOException { |
99 | 99 |
100 System.out.println(input.getAbsoluteFile()); | 100 System.out.println(input.getAbsoluteFile()); |
101 | 101 |
102 Html2Wiki converter = new Html2Wiki(FileUtils.readFileToString(input,null)); | 102 Html2Wiki converter = new Html2Wiki(FileUtils.readFileToString(input,null)); |
103 | 103 |
104 | |
105 WikiChapter[] chapters = converter.getWikiChapters(); | 104 WikiChapter[] chapters = converter.getWikiChapters(); |
106 | 105 |
107 System.out.format("Writing %d wiki files...\n",chapters.length); | 106 System.out.format("Writing %d wiki files...\n",chapters.length); |
108 | 107 |
109 StringBuffer wikiIndex = new StringBuffer(); | 108 StringBuffer wikiIndex = new StringBuffer(); |
179 public boolean accept(File pathname) { | 178 public boolean accept(File pathname) { |
180 return pathname.getName().toLowerCase().matches("^.*\\.html$"); | 179 return pathname.getName().toLowerCase().matches("^.*\\.html$"); |
181 } | 180 } |
182 | 181 |
183 } | 182 } |
184 private static class WikiChapter { | 183 protected static class WikiChapter { |
185 private String chapterName; | 184 private String chapterName; |
186 private CharSequence contents; | 185 private CharSequence contents; |
187 | 186 |
188 public WikiChapter(String chapterName, CharSequence contents) { | 187 public WikiChapter(String chapterName, CharSequence contents) { |
189 this.chapterName = chapterName.replaceAll("\\\\|/|:|\\(|\\)","-").replaceAll("\\s+"," ").replaceAll("&","and"); | 188 this.chapterName = chapterName.replaceAll("\\\\|/|:|\\(|\\)","-").replaceAll("\\s+"," ").replaceAll("&","and"); |
198 public CharSequence getContents() { | 197 public CharSequence getContents() { |
199 return contents; | 198 return contents; |
200 } | 199 } |
201 | 200 |
202 public String toString() { | 201 public String toString() { |
203 return "Chapter: " + chapterName + "\nContents: " + contents; | 202 return "Chapter: " + chapterName + " Content length: " + contents.length(); |
204 } | 203 } |
205 } | 204 } |
206 | 205 |
207 } | 206 } |