superlou / fountain-atom

Grammar and tools for the Fountain screenwriting syntax
MIT License
48 stars 15 forks source link

Incorrect parsing of non-ASCII character names and the dialogue thereafter #3

Closed janwil123 closed 7 years ago

janwil123 commented 8 years ago

If a character name contains some non-ascii characters (like German Ä or Ü for instance), the dialogue text after the character name and the text thereafter are not properly highlighted. Also, when compiled for the preview, the character name and its dialogue are out of justification. Please see the attached file for the character I named GÜNTHER.

screen shot 2016-03-27 at 09 41 50
superlou commented 8 years ago

I think this can be fixed by a 1-line fix in fountain-parser.js line 16:

dialogue: /^([A-Z\p{L}*_]+[0-9A-Z\p{L} (._\-')]*)(\^?)?(?:\n(?!\n+))([\s\S]+)/,

The \p{L} unicode character class should allow support for unicode characters in names. Unfortunately, there is a phantom install of fountain-atom somewhere in my development environment that is preventing my apm develop fountain install from responding to changes. Will try and push the update as soon as I get my environment straightened out.

superlou commented 8 years ago

It's going to be trickier than I thought. It looks like javascript regex doesn't support unicode by default. I can bring in a library to handle it better in fountain-parser.js, but the fountain.cson file controlling syntax highlighting can't do that. Can you provide a list of capitalized German characters (or other unicode capitalized characters appearing in names) and I'll hard-code them in for now?

paulomorais1981 commented 7 years ago

Hi,

I'm having this problem too. print-atom-fountain

superlou commented 7 years ago

@paulomorais1981 and @janwil123: I'm looking into the Javascript/Electron unicode regex class support again to see if anything's changed. As a back-up, can you post a list of the specific characters, upper and lower case, that you're having issues with. Worst comes to worst, I'll hard-code them in so they can stop messing with your scripts.

superlou commented 7 years ago

@janwil123 and @paulomorais1981: I pushed an update (0.5.3) that I'm hoping will fix the character names in both syntax highlighting and the preview pane. Let me know if this is successful.

paulomorais1981 commented 7 years ago

Yeah, man. It seems to work fine now. Thank you!