Skip to content

Commit

Permalink
Merge pull request #76 from markdown-asciidoc/html-entities
Browse files Browse the repository at this point in the history
< and > no longer get replaced by HTML entities
  • Loading branch information
bodiam committed Apr 11, 2024
2 parents 50cc32f + 3190257 commit dd9e44f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void visit(BulletListNode node) {

public void visit(CodeNode node) {
printer.print('`');
printer.printEncoded(node.getText());
printer.print(node.getText());
printer.print('`');
}

Expand Down
15 changes: 5 additions & 10 deletions src/test/java/nl/jworks/markdown_to_asciidoc/Stepdefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,21 @@ public class Stepdefs {
private String asciiDoc;

@Given("^the Markdown source$")
public void the_markdown_source(String markdown) throws Throwable {
public void the_markdown_source(String markdown) {
if (markdown.contains("{sp}")) {
this.markdown = markdown.replaceAll("\\{sp\\}", " ");
}
else {
this.markdown = markdown.replaceAll("\\{sp}", " ");
} else {
this.markdown = markdown;
}
}

@When("^it is converted to AsciiDoc")
public void it_is_converted_to_asciidoc() throws Throwable {
// Express the Regexp above with the code you wish you had
public void it_is_converted_to_asciidoc() {
this.asciiDoc = Converter.convertMarkdownToAsciiDoc(markdown.replaceAll("\r\n", "\n"));
}

@Then("^the result should match the AsciiDoc source$")
public void the_result_should_match_the_asciidoc_source(String result) throws Throwable {
// Express the Regexp above with the code you wish you had

public void the_result_should_match_the_asciidoc_source(String result) {
assertEquals(result.replaceAll("\r\n", "\n"), asciiDoc.replaceAll("\r\n", "\n"));

}
}
12 changes: 12 additions & 0 deletions src/test/resources/nl/jworks/markdown_to_asciidoc/headings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,15 @@ Feature: Headings
"""
= Title
"""

# Doesn't work. See https://github.com/markdown-asciidoc/markdown-to-asciidoc/issues/60
# Scenario: Render a heading with backticks
# Given the Markdown source
# """
## `what.ever.Foo`
# """
# When it is converted to AsciiDoc
# Then the result should match the AsciiDoc source
# """
# === `what.ever.Foo`
# """
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ Feature: Paragraphs
Second paragraph.
"""

Scenario: Render special characters as is
Given the Markdown source
"""
This is an example: `Provider<List<File>>`
"""
When it is converted to AsciiDoc
Then the result should match the AsciiDoc source
"""
This is an example: `Provider<List<File>>`
"""

0 comments on commit dd9e44f

Please sign in to comment.