klaas1979 / tablesmith-like

Use Tablesmith-like tables in FoundryVTT and create complex nested tables.
MIT License
3 stars 5 forks source link

Pasting in externally written tables causes errors #2

Closed Lyinggod closed 2 years ago

Lyinggod commented 2 years ago

I am fairly proficient with tablesmith and I write tables in Notepad++ to help with structure, formatting, and debugging. When I paste the files into my Foundry (Forge) journal entry, the HTML modification causes errors with the parser. After the automatic reformatting of my text by the HTML editor, I have to add a
before the table so it looks something like:


:Start

This may also be caused because I leave a blank line between tables to help with clarity as my tables can get very large and the tables would be impossible to read without those blank lines.

Example: :Start 1, [thing1] 2, [thing2]

:thing1 1, stuff

:thing2 1, more stuff

klaas1979 commented 2 years ago

Blank lines are absolutely no problem. Could you provide more details about the part

I have to add a before the table so it looks something like:

what is the thing you add? A newline or a heading?

I tested it and the example works for me, but I am pasting from the issue and using a Mac. The issue must be about whitespaces like newlines. So I need some more information what you paste. The best way, would be if you could provide a sample file with real newlines and whitespaces added to get the issue recreated.

Notepad++ is a windows programm, so I guess you have windows newline in your files => '\r\n'?

Lyinggod commented 2 years ago

The thing I added was a <BR> however this "fix" wasn't working reliably after I identified it to you, or at least attempted to, as a potential solution. I am using windows. Yes they have \r\n. I am not familiar with Mac's so I may have gone down the wrong path in troubleshooting this. I have used grep in Notepad++ to replace all the \r with \n and vice versa in attempts to see if that eliminated the error when pasting the changes into the journal, it did not.

The error I am receiving is: image

The code as as it appears in Notepad image

The code as it appears after unmodified paste in the journal and the journal converts it to HTML:

<p>12-13, Investigator</p>
<p>_|arch=investigator|</p>
<p>14-17, Occultist</p>
<p>_|arch=occultist|</p>
<p>18-20, Soldier</p>
<p>_|arch=soldier|</p>
<p>&nbsp;</p>
<p>:arch_benefits</p>
<p>1,[%arch%_skill]</p>
<p>_{Bold~Gain the Focuses:}{CR~}</p>
<p>_[focus]</p>
<p>_{CR~}{CR~}</p>
<p>_{Bold~Gain the Following belongings:}{CR~}</p>
<p>_[%arch%_stuff]</p>
klaas1979 commented 2 years ago

The new version 1.4.0 should fix the problem. The HTML editor inserts some   non-breaking-space characters that need to be included in the parser. An error I could reproduce is fixed with a small change in the parser.