Skip to content

Commit

Permalink
"visual-html" format renamed to "html/visual" to separate format from…
Browse files Browse the repository at this point in the history
… representation.
  • Loading branch information
smelamud committed Dec 14, 2024
1 parent 6d3c948 commit 4dfa78c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/moera/node/data/SourceFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ public enum SourceFormat {
HTML,
MARKDOWN,
APPLICATION,
VISUAL_HTML;
HTML__VISUAL;

@JsonValue
public String getValue() {
return name().toLowerCase().replace('_', '-');
return name().toLowerCase().replace("__", "/").replace('_', '-');
}

public static String toValue(SourceFormat type) {
Expand All @@ -30,7 +30,7 @@ public static SourceFormat forValue(String value) {

@JsonCreator
public static SourceFormat parse(String value) {
return valueOf(value.toUpperCase().replace('-', '_'));
return valueOf(value.toUpperCase().replace('-', '_').replace("/", "__"));
}

}
2 changes: 1 addition & 1 deletion src/main/java/org/moera/node/text/TextConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TextConverter {
public String toHtml(SourceFormat format, String source) {
return switch (format) {
case PLAIN_TEXT -> PlainTextConverter.toHtml(source);
case HTML, VISUAL_HTML -> source;
case HTML, HTML__VISUAL -> source;
case MARKDOWN -> markdownConverter.toHtml(source);
default -> throw new IllegalArgumentException("Unknown source format: " + format.name());
};
Expand Down

0 comments on commit 4dfa78c

Please sign in to comment.