richardwilkes / gcs_master_library

GCS Master Library
Mozilla Public License 2.0
60 stars 80 forks source link

Wrong white space, small export bug to Fantasy Ground PC xml (dis/advantages) #154

Open KSA001 opened 3 years ago

KSA001 commented 3 years ago

Hi, just tried out the function in V.4.32 to export a character sheet for Fantasy Ground PC (xml format).

Basically it worked fine, but I found a little issue regarding the export of advantages: The export file contains an additional (wrong) space character (blank, white space) at the end of the name string, as can be seen below in the example! I don't think it was intentional...

`

Absolute Direction 5` For the test I used GCS on Linux Mint 18.3 x64.
richardwilkes commented 3 years ago

Hmm... did you verify that the advantage in question didn't actually have a trailing space? At any rate, I'll look at it when I get a spare moment.

KSA001 commented 3 years ago

Yes, I verified it with other advantages, too. Update: Sorry, regarding disadvantages there is something unclear, maybe it's not the case there, I'll recheck. Here another example issue from advantages: `

Invisibility
      <points type="number">40</points>`
KSA001 commented 3 years ago

Ok, rechecked it, for some reason it did not see it in one test case with disadvantages, but here is another example where I encountered the issue with the extra space at the ending and disads:

`

Disadvantages -56

Page Ref:

    <id-57017d2c-8776-4780-80e8-3349b6dd4fc1>
      <name type="string">Allergy (Nuts) </name>
      <points type="number">-1</points>
      <text type="formattedtext"><p> </p><p>Page Ref: PU6:22</p></text>
    </id-57017d2c-8776-4780-80e8-3349b6dd4fc1>
    <id-fdf8bf44-26a0-4f11-8078-d6d59dd82fb0>
      <name type="string">Atheist </name>
      <points type="number">-1</points>`
KSA001 commented 3 years ago

And by the way: Thank you for the great 4.32 update! :) thumbs up

richardwilkes commented 3 years ago

Can you attach the file you used to export with... and give me the name of the export template you used? Looking at the code, I'm not seeing anywhere that would add a trailing space like that, so would like to walk the code through the export sequence with a known failing case.

KSA001 commented 3 years ago

In case my mail reply did not work (?), here is a sample gcs file along with the resulting Fantasy Grounds PC xml export.

KSA001 commented 3 years ago

samplechar-adv-export.zip

richardwilkes commented 3 years ago

OK, so as I suspected, its not a code issue, but an output template issue. Specifically, things like this (from line 218 of the Fantasy Grounds PC.xml file):

@DESCRIPTION_PRIMARY @DESCRIPTION_MODIFIER_NOTES_BRACKET

Note the space between @DESCRIPTION_PRIMARY and @DESCRIPTION_MODIFIER_NOTES_BRACKET. In the case where there aren't any notes, the space is still emitted. You could fix that by removing the space, but then the resulting output when notes are present would be jammed up against the description. Not having Fantasy Grounds, I have no idea if that will work or not.

Anyway, I'm happy to take a PR that fixes this -- but since I don't have Fantasy Grounds, I will just have to accept the submission on good faith and assume it works as needed for that tool.