League-of-Foundry-Developers / fvtt-module-furnace

34 stars 12 forks source link

Split Journal doesn't like multiple levels of hierarchy #73

Open tcflanag opened 4 years ago

tcflanag commented 4 years ago

The journal split feature doesn't seem to handle multi-level hierarchy very well. With this example: (real

<h1> 1 Market<h1>
 Blah
<h2> 1f. Yek’s Treasure </h2>
This room contains the following treasure:
<h1> 2. Kalabash’s Chambers</h1>
Lorem ipsum
<h2> 2a. Water Pump</h2>
Lorem ipsum
<h2> 2b. Abandoned Laboratory</h2>
Lorem

If I split on \<h2> I end up with the following journals. Note that the 2. header is hidden under the 1f entry. I already have a initial fix implemented, so I wanted to check if you'd be interested in a PR before I spend the time to clean up my code.

<h1> 1 Market<h1>
 Blah
<h2> 1f. Yek’s Treasure </h2>
This room contains the following treasure:
<h1> 2. Kalabash’s Chambers</h1>
Lorem ipsum
<h1> 1 Market<h1>
 Blah
<h2> 2a. Water Pump</h2>
Lorem ipsum
<h1> 1 Market<h1>
 Blah
<h2> 2b. Abandoned Laboratory</h2>
Lorem
kakaroto commented 4 years ago

Yeah, in those cases, I've usually split on h1, then if needed, I'd split on h2 those individual journals that need it. It's splitting on h2, so I'm not sure how it's supposed to not capture everything between the two h2 tags (the h1 included) unless you added additional logic for all parent headings... Regardless, yes, I'd be interested and very appreciative of a PR!

Thank you!