Skip to content

Commit 45ef135

Browse files
committed
Translater -> Translator
1 parent 12e4ebf commit 45ef135

File tree

7 files changed

+30
-30
lines changed

7 files changed

+30
-30
lines changed

src/main/java/com/google/gwt/site/markdown/MDHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public MDHelper create() throws MDHelperException {
105105

106106
// read template TOC if parameter is provided
107107
if (templateTocFile != null) {
108-
templateToc = MDTranslater.markDownToHtml(readFile(templateTocFile));
108+
templateToc = MDTranslator.markDownToHtml(readFile(templateTocFile));
109109
}
110110

111111
created = true;
@@ -121,7 +121,7 @@ private String readFile(String filePath) throws MDHelperException {
121121
}
122122
}
123123

124-
public void translate() throws TranslaterException {
124+
public void translate() throws TranslatorException {
125125

126126
if (!created) {
127127
throw new IllegalStateException();
@@ -132,7 +132,7 @@ public void translate() throws TranslaterException {
132132

133133
TocCreator tocCreator = templateToc != null ? new TocFromTemplateCreator(templateToc) : new TocFromMdCreator();
134134

135-
new MDTranslater(tocCreator, new MarkupWriter(outputDirectoryFile), template)
135+
new MDTranslator(tocCreator, new MarkupWriter(outputDirectoryFile), template)
136136
.render(mdRoot);
137137
}
138138

src/main/java/com/google/gwt/site/markdown/MDTranslater.java renamed to src/main/java/com/google/gwt/site/markdown/MDTranslator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import java.util.List;
3030
import java.util.Set;
3131

32-
public class MDTranslater {
32+
public class MDTranslator {
3333
private static final String SEPARATOR = File.separator;
3434

3535

@@ -39,17 +39,17 @@ public class MDTranslater {
3939

4040
private final String template;
4141

42-
public MDTranslater(TocCreator tocCreator, MarkupWriter writer, String template) {
42+
public MDTranslator(TocCreator tocCreator, MarkupWriter writer, String template) {
4343
this.tocCreator = tocCreator;
4444
this.writer = writer;
4545
this.template = template;
4646
}
4747

48-
public void render(MDParent root) throws TranslaterException {
48+
public void render(MDParent root) throws TranslatorException {
4949
renderTree(root, root);
5050
}
5151

52-
private void renderTree(MDNode node, MDParent root) throws TranslaterException {
52+
private void renderTree(MDNode node, MDParent root) throws TranslatorException {
5353

5454
if (node.isFolder()) {
5555
MDParent mdParent = node.asFolder();
@@ -125,11 +125,11 @@ protected String adjustRelativePath(String html, String relativePath) {
125125
"$1='" + relativePath + "$3'");
126126
}
127127

128-
private String getNodeContent(String path) throws TranslaterException {
128+
private String getNodeContent(String path) throws TranslatorException {
129129
try {
130130
return Util.getStringFromFile(new File(path));
131131
} catch (IOException e1) {
132-
throw new TranslaterException("can not load content from file: '" + path + "'", e1);
132+
throw new TranslatorException("can not load content from file: '" + path + "'", e1);
133133
}
134134

135135
}

src/main/java/com/google/gwt/site/markdown/MarkDown.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class MarkDown {
1717

18-
public static void main(String[] args) throws MDHelperException, TranslaterException {
18+
public static void main(String[] args) throws MDHelperException, TranslatorException {
1919

2020
if (args.length < 3) {
2121
System.out.println("Usage MarkDown <sourceDir> <outputDir> <templateFile> [templateTOC]");
@@ -45,7 +45,7 @@ public static void main(String[] args) throws MDHelperException, TranslaterExcep
4545
} catch (MDHelperException e) {
4646
e.printStackTrace();
4747
throw e;
48-
} catch (TranslaterException e) {
48+
} catch (TranslatorException e) {
4949
e.printStackTrace();
5050
throw e;
5151
}

src/main/java/com/google/gwt/site/markdown/MarkupWriter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public MarkupWriter(File rootFile) {
2828
this.rootFile = rootFile;
2929
}
3030

31-
public void writeHTML(MDNode node, String html) throws TranslaterException {
31+
public void writeHTML(MDNode node, String html) throws TranslatorException {
3232

3333
if (node.isFolder()) {
3434
throw new IllegalArgumentException();
@@ -62,16 +62,16 @@ public void writeHTML(MDNode node, String html) throws TranslaterException {
6262
try {
6363
Util.writeStringToFile(fileToWrite, html);
6464
} catch (IOException e) {
65-
throw new TranslaterException("can not write markup to file: '" + fileToWrite + "'", e);
65+
throw new TranslatorException("can not write markup to file: '" + fileToWrite + "'", e);
6666

6767
}
6868
}
6969

70-
private void ensureDirectory(File dir) throws TranslaterException {
70+
private void ensureDirectory(File dir) throws TranslatorException {
7171
if (!dir.exists()) {
7272
boolean created = dir.mkdir();
7373
if (!created) {
74-
throw new TranslaterException("can not create directory: '" + dir + "'");
74+
throw new TranslatorException("can not create directory: '" + dir + "'");
7575
}
7676
}
7777
}

src/main/java/com/google/gwt/site/markdown/TranslaterException.java renamed to src/main/java/com/google/gwt/site/markdown/TranslatorException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
*/
1414
package com.google.gwt.site.markdown;
1515

16-
public class TranslaterException extends Exception {
16+
public class TranslatorException extends Exception {
1717

1818
/**
1919
*
2020
*/
2121
private static final long serialVersionUID = 1732290113260995362L;
2222

23-
public TranslaterException(String message, Throwable e1) {
23+
public TranslatorException(String message, Throwable e1) {
2424
super(message, e1);
2525
}
2626

27-
public TranslaterException(String string) {
27+
public TranslatorException(String string) {
2828
super(string);
2929
}
3030

src/main/java/com/google/gwt/site/markdown/fs/FileSystemTraverser.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
package com.google.gwt.site.markdown.fs;
1515

16-
import com.google.gwt.site.markdown.TranslaterException;
16+
import com.google.gwt.site.markdown.TranslatorException;
1717

1818
import org.w3c.dom.Document;
1919
import org.w3c.dom.Element;
@@ -89,7 +89,7 @@ public String getName() {
8989
}
9090
}
9191

92-
public MDParent traverse(File file) throws TranslaterException {
92+
public MDParent traverse(File file) throws TranslatorException {
9393
MDParent mdParent = traverse(null, file, 0, "");
9494
removeEmptyDirs(mdParent);
9595

@@ -98,7 +98,7 @@ public MDParent traverse(File file) throws TranslaterException {
9898
return mdParent;
9999
}
100100

101-
private void readConfig(MDParent current) throws TranslaterException {
101+
private void readConfig(MDParent current) throws TranslatorException {
102102

103103
if (current.getConfigFile() != null) {
104104
FolderConfig config = parseConfig(current.getConfigFile());
@@ -178,7 +178,7 @@ private void removeEmptyDirs(MDParent current) {
178178
}
179179

180180
private MDParent traverse(MDParent parent, File file, int depth, String path)
181-
throws TranslaterException {
181+
throws TranslatorException {
182182

183183
if (ignoreFile(file)) {
184184
return null;
@@ -221,7 +221,7 @@ private MDParent traverse(MDParent parent, File file, int depth, String path)
221221

222222
}
223223

224-
private FolderConfig parseConfig(File file) throws TranslaterException {
224+
private FolderConfig parseConfig(File file) throws TranslatorException {
225225
DocumentBuilder builder;
226226
List<String> excludeList = new LinkedList<String>();
227227

@@ -236,7 +236,7 @@ private FolderConfig parseConfig(File file) throws TranslaterException {
236236
Element documentElement = document.getDocumentElement();
237237

238238
if (!"folder".equalsIgnoreCase(documentElement.getTagName())) {
239-
throw new TranslaterException(
239+
throw new TranslatorException(
240240
"the file '" + file.getAbsolutePath() + "' does not contain a folder tag");
241241
}
242242

@@ -277,11 +277,11 @@ private FolderConfig parseConfig(File file) throws TranslaterException {
277277
}
278278

279279
} catch (ParserConfigurationException e) {
280-
throw new TranslaterException("can not construct xml parser", e);
280+
throw new TranslatorException("can not construct xml parser", e);
281281
} catch (SAXException e) {
282-
throw new TranslaterException("error while parsing xml", e);
282+
throw new TranslatorException("error while parsing xml", e);
283283
} catch (IOException e) {
284-
throw new TranslaterException("can not read file", e);
284+
throw new TranslatorException("can not read file", e);
285285
}
286286

287287
return new FolderConfig(href, excludeList, folderEntries);

src/test/java/com/google/gwt/site/markdown/MDTranslaterTest.java renamed to src/test/java/com/google/gwt/site/markdown/MDTranslatorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
/**
66
* Test class for MDTranslate
77
*/
8-
public class MDTranslaterTest extends TestCase {
8+
public class MDTranslatorTest extends TestCase {
99

10-
private void assertAdjustUrl(MDTranslater md, String relativePath, String tag, String attr,
10+
private void assertAdjustUrl(MDTranslator md, String relativePath, String tag, String attr,
1111
String url, String match) {
1212
String ini = "<foo>\n </foo>";
1313
String end = "<bar>\n </bar>";
@@ -19,7 +19,7 @@ private void assertAdjustUrl(MDTranslater md, String relativePath, String tag, S
1919
}
2020

2121
public void testAdjustRelativePath() throws Exception {
22-
MDTranslater mdt = new MDTranslater(null, null, null);
22+
MDTranslator mdt = new MDTranslator(null, null, null);
2323

2424
// empty url
2525
assertAdjustUrl(mdt, "../", "a", "href", "", "../");

0 commit comments

Comments
 (0)