Skip to content

Commit dda3641

Browse files
committed
👽️ 5e: creatureFluff, {@b } tag in title
1 parent fe93b5a commit dda3641

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

src/main/java/dev/ebullient/convert/tools/dnd5e/JsonSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ default void appendInset(AppendTypeValue type, List<String> text, JsonNode entry
490490
String title = null;
491491
String id = null;
492492
if (entry.has("name")) {
493-
title = SourceField.name.getTextOrEmpty(entry);
493+
title = replaceText(SourceField.name.getTextOrEmpty(entry));
494494
id = title;
495495
} else if (getSources().getType() == Tools5eIndexType.race) {
496496
title = insetText.remove(0);

src/main/java/dev/ebullient/convert/tools/dnd5e/JsonTextReplacement.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public interface JsonTextReplacement extends JsonTextConverter<Tools5eIndexType> {
3939
static final Pattern FRACTIONAL = Pattern.compile("^(\\d+)?([⅛¼⅜½⅝¾⅞⅓⅔⅙⅚])?$");
4040
static final Pattern linkifyPattern = Pattern.compile("\\{@("
41-
+ "|action|background|card|class|condition|creature|deck|deity|disease|facility"
41+
+ "|action|background|card|class|condition|creature|creatureFluff|deck|deity|disease|facility"
4242
+ "|feat|hazard|item|itemMastery|itemProperty|itemType|legroup|object|psionic|race|reward"
4343
+ "|sense|skill|spell|status|subclass|table|variantrule|vehicle"
4444
+ "|optfeature|classFeature|subclassFeature|trap) ([^}]+)}");
@@ -427,12 +427,12 @@ default String _replaceTokenText(String input, boolean nested) {
427427
case "note" -> {
428428
// {@note This is a note}
429429
if (nested) {
430-
yield "<span class='note'>**Note:** " + match.group(2).trim() + "</span>";
430+
yield "<span class='note'>**Note:** " + replaceText(match.group(2).trim()) + "</span>";
431431
} else {
432432
List<String> text = new ArrayList<>();
433433
text.add("> [!note]");
434434
for (String line : match.group(2).split("\n")) {
435-
text.add("> " + line);
435+
text.add("> " + replaceText(line.trim()));
436436
}
437437
yield String.join("\n", text);
438438
}

src/main/java/dev/ebullient/convert/tools/dnd5e/Tools5eIndex.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ private void indexTypes(String filename, JsonNode node) {
141141
Tools5eIndexType.featFluff.withArrayFrom(node, this::addToIndex);
142142
Tools5eIndexType.hazardFluff.withArrayFrom(node, this::addToIndex);
143143
Tools5eIndexType.itemFluff.withArrayFrom(node, this::addToIndex);
144-
Tools5eIndexType.monsterFluff.withArrayFrom(node, this::addToIndex);
145144
Tools5eIndexType.objectFluff.withArrayFrom(node, this::addToIndex);
146145
Tools5eIndexType.optionalfeatureFluff.withArrayFrom(node, this::addToIndex);
147146
Tools5eIndexType.raceFluff.withArrayFrom(node, this::addToIndex);
@@ -151,6 +150,9 @@ private void indexTypes(String filename, JsonNode node) {
151150
Tools5eIndexType.trapFluff.withArrayFrom(node, this::addToIndex);
152151
Tools5eIndexType.vehicleFluff.withArrayFrom(node, this::addToIndex);
153152

153+
Tools5eIndexType.monsterFluff.withArrayFrom(node, this::addToIndex);
154+
Tools5eIndexType.monsterFluff.withArrayFrom(node, "creatureFluff", this::addToIndex);
155+
154156
Tools5eIndexType.language.withArrayFrom(node, this::addToIndex);
155157
Tools5eIndexType.citation.withArrayFrom(node, this::addToIndex);
156158

src/main/java/dev/ebullient/convert/tools/dnd5e/Tools5eIndexType.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ public static Tools5eIndexType fromText(String name) {
114114
if ("creature".equalsIgnoreCase(name)) {
115115
return monster;
116116
}
117+
if ("creatureFluff".equalsIgnoreCase(name)) {
118+
return monsterFluff;
119+
}
117120
if ("optionalfeature".equalsIgnoreCase(name)) {
118121
return optfeature;
119122
}

src/test/java/dev/ebullient/convert/tools/dnd5e/FilterAllTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public static void setupDir() throws Exception {
3434
"sources": {
3535
"book": [
3636
"XGE",
37-
"XMM"
37+
"XMM",
38+
"FRAiF"
3839
],
3940
"adventure": [
4041
"OotA",

0 commit comments

Comments
 (0)