-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/correct handling of wovn ignore java7 (#166)
* Fixed incorrect handling of wovn-ignore comments. * Bumped patch verison. * Fixed incompatible use of String.join()
- Loading branch information
Showing
4 changed files
with
77 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/github/wovnio/wovnjava/HtmlReplceMarker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.github.wovnio.wovnjava; | ||
|
||
import java.util.HashMap; | ||
|
||
class HtmlReplaceMarker { | ||
private final String WOVN_MARKER_PREFIX = "wovn-marker-"; | ||
private final HashMap<String, String> mappedValues; | ||
private int keyCount; | ||
|
||
HtmlReplaceMarker() { | ||
this.mappedValues = new HashMap<String, String>(); | ||
this.keyCount = 0; | ||
} | ||
|
||
public String addCommentValue(String original) { | ||
String key = generateKey(); | ||
String commentHtml = String.format("<!--%s-->", key); | ||
mappedValues.put(commentHtml, original); | ||
return key; | ||
} | ||
|
||
public void addValue(String key, String original) { | ||
mappedValues.put(key, original); | ||
} | ||
|
||
public String revert(String markedHTML) { | ||
for (String key: mappedValues.keySet()) { | ||
String original = mappedValues.get(key); | ||
markedHTML = markedHTML.replace(key, original); | ||
} | ||
return markedHTML; | ||
} | ||
|
||
public String generateKey() { | ||
String key = WOVN_MARKER_PREFIX + String.valueOf(keyCount); | ||
keyCount++; | ||
return key; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters