Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding kindle.properties to modify quote style
  • Loading branch information
leocwolter committed May 8, 2012
1 parent 9a40b62 commit 774e029
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/br/com/caelum/tubaina/ParseType.java
Expand Up @@ -56,7 +56,7 @@ protected Generator getGenerator(Parser parser, TubainaBuilderData data) {

@Override
public Parser getParser(RegexConfigurator conf, boolean noAnswer, boolean showNotes) throws IOException {
return new KindleParser(conf.read("/regex.properties", "/html.properties"), noAnswer);
return new KindleParser(conf.read("/regex.properties", "/kindle.properties"), noAnswer);
}

@Override
Expand Down
36 changes: 36 additions & 0 deletions src/main/resources/kindle.properties
@@ -0,0 +1,36 @@
### definition

#Bold
definition=<strong>$1</strong>

#Italic
italic=<em>$1</em>

#Underline
underlined=<u>$1</u>

#Code Chunk
codechunk=<code>$1</code>

#Quotation
quote=<q cite\=\"$2\">$1 <br/> --$2</q>

#Label
footnote=<label title\=\"$1\">$2<span>?</span></label>

#Link
link=<a\ href\=\"$1\">$1</a>$2

#Https Link
httpslink=<a\ href\=\"$1\">$1</a>$2

#E-mail
email=$1@$2

#Unimportant section
title=<h3>$1</h3>

rubyhack=&#58;&#58;

label=<a\ name\=\"$1\" />
ref\-label=<a href=\"#$1\">*</a>
Expand Up @@ -19,7 +19,7 @@ public class KindleParserTest {
@Before
public void setUp() throws IOException {
RegexConfigurator configurator = new RegexConfigurator();
List<Tag> tags = configurator.read("/regex.properties", "/html.properties");
List<Tag> tags = configurator.read("/regex.properties", "/kindle.properties");
this.parser = new KindleParser(tags, false);
}

Expand Down Expand Up @@ -87,13 +87,13 @@ public void testParagraphTagWithInnerTagsInline() {
@Test
public void testQuotationTagInline() {
String result = parser.parse("[quote ola mundo --Anonimo]");
Assert.assertEquals("<q cite=\"Anonimo\">ola mundo</q>", result);
Assert.assertEquals("<q cite=\"Anonimo\">ola mundo <br/> --Anonimo</q>", result);
}

@Test
public void testQuotationTagMultiline() {
String result = parser.parse("[quote ola mu\nndo-- Anonimo]");
Assert.assertEquals("<q cite=\"Anonimo\">ola mu\nndo</q>", result);
Assert.assertEquals("<q cite=\"Anonimo\">ola mu\nndo <br/> --Anonimo</q>", result);
}

@Test
Expand Down

0 comments on commit 774e029

Please sign in to comment.