Skip to content

Commit 29eaa82

Browse files
anchor link issue
1 parent 05f43d1 commit 29eaa82

File tree

6 files changed

+5676
-298
lines changed

6 files changed

+5676
-298
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.contentstack.sdk</groupId>
66
<artifactId>utils</artifactId>
7-
<version>1.2.5</version>
7+
<version>1.2.6-SNAPSHOT</version>
88
<packaging>jar</packaging>
99
<name>Contentstack-utils</name>
1010
<description>Java Utils SDK for Contentstack Content Delivery API, Contentstack is a headless CMS</description>
@@ -230,7 +230,7 @@
230230
<configuration>
231231
<source>1.8</source>
232232
<target>1.8</target>
233-
<!-- <executable>${JAVA_HOME}/bin/javac</executable>-->
233+
<!-- <executable>${JAVA_HOME}/bin/javac</executable>-->
234234
</configuration>
235235
</plugin>
236236
<plugin>

src/main/java/com/contentstack/utils/node/NodeToHTML.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private NodeToHTML() {
2929
*/
3030
public static String textNodeToHTML(JSONObject nodeText, Option renderOption) {
3131
String text = nodeText.optString("text");
32-
text = text.replace("\n", "");
32+
text = text.replace("\n", "<br />");
3333
if (nodeText.has("superscript")) {
3434
text = renderOption.renderMark(MarkType.SUPERSCRIPT, text);
3535
}
@@ -52,7 +52,10 @@ public static String textNodeToHTML(JSONObject nodeText, Option renderOption) {
5252
text = renderOption.renderMark(MarkType.BOLD, text);
5353
}
5454
if (nodeText.has("break")) {
55-
text = renderOption.renderMark(MarkType.BREAK, text);
55+
if (!text.contains("<br />")) {
56+
text = renderOption.renderMark(MarkType.BREAK, text);
57+
}
58+
// text = renderOption.renderMark(MarkType.BREAK, text);
5659
}
5760
return text;
5861
}

src/main/java/com/contentstack/utils/render/DefaultOption.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public String renderMark(MarkType markType, String text) {
7070
case BOLD:
7171
return "<strong>" + text + "</strong>";
7272
case BREAK:
73-
return "<br />" + text; // v1.2.5
73+
//text = text.replace("\n", "");
74+
return "<br />" + text.replace("\n", ""); // v1.2.5
7475
default:
7576
return text;
7677
}

src/test/java/com/contentstack/utils/TestRte.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testAvailableEntryItemTypes() {
9999

100100
@Test
101101
public void testHERFID() throws IOException {
102-
final String rte = "src/test/resources/reports/jsonviewer.json";
102+
final String rte = "src/test/resources/reports/wfs_fees.json";
103103
JSONObject theRTE = new ReadResource().readJson(rte);
104104
String result = Utils.jsonToHTML(theRTE, new DefaultOption(), null);
105105
System.out.println(result);

0 commit comments

Comments
 (0)