Skip to content

Commit a314aae

Browse files
committed
🐛 🎨 no table roll string when dice disabled. Resolves #761
1 parent fe3b4b8 commit a314aae

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,9 @@ default void appendTable(List<String> text, JsonNode tableNode) {
799799
if (!blockid.isBlank()) {
800800
table.add(blockid);
801801
}
802-
if (header.matches(JsonTextConverter.DICE_TABLE_HEADER) && !blockid.isBlank()) {
802+
if (cfg().useDiceRoller().enabled()
803+
&& header.matches(JsonTextConverter.DICE_TABLE_HEADER)
804+
&& !blockid.isBlank()) {
803805
// prepend a dice roller
804806
String targetFile = getFileName();
805807
// use dice roller string as name (for use if nested table)

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,10 @@ public void testRules(Path outputPath) {
523523

524524
MarkdownWriter writer = new MarkdownWriter(outputPath, templates, tui);
525525
index.markdownConverter(writer).writeFiles(Stream.of(Tools5eIndexType.values())
526-
.filter(x -> x.isOutputType() && !x.useCompendiumBase())
526+
.filter(x -> (x.isOutputType() && !x.useCompendiumBase())
527+
|| x == Tools5eIndexType.table
528+
|| x == Tools5eIndexType.bookData
529+
|| x == Tools5eIndexType.adventureData)
527530
.toList());
528531

529532
TestUtils.assertDirectoryContents(outputPath.resolve(index.rulesFilePath()), tui);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public static void setupDir() throws Exception {
6161
},
6262
"images": {
6363
"copyInternal": false
64-
}
64+
},
65+
"useDiceRoller" : true
6566
}
6667
""".stripIndent();
6768
commonTests = new CommonDataTests(testInput, config, TestUtils.PATH_5E_TOOLS_DATA);

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public static void setupDir() throws Exception {
5353
],
5454
"images": {
5555
"copyInternal": false
56-
}
56+
},
57+
"useDiceRoller" : false
5758
}
5859
""".stripIndent();
5960
commonTests = new CommonDataTests(testInput, config, TestUtils.PATH_5E_TOOLS_DATA);
@@ -387,6 +388,11 @@ public void testClassList() throws IOException {
387388
assertThat(content).contains("Mixed edition content");
388389
}
389390

391+
@Test
392+
public void testRules() {
393+
commonTests.testRules(outputPath);
394+
}
395+
390396
private static Tools5eLinkifier linkifier() {
391397
return Tools5eLinkifier.instance();
392398
}

0 commit comments

Comments
 (0)