I now fixed some issues I was aware of and some my test-cases found:
- correct base style when $z-resetting styles within $< $> blocks
- merging spans with the same style
- $w, $n and $t was only half-way implemented
I originally wanted to try this whole js module flow, thus made my script a node module, got myself a testing suite, and a whole bunch of additional files.
My script is 7kb big, 6kb tests and now I have more than 180 node_modules. JS pls
/rant
Anyway - here it is:
https://www.npmjs.com/package/zocka-man ... -formatter
Another thing with MP formatting: $w and $n override each other, which is fine, but they can't be turned off by reactivation - like any other tag?
@magnetik: I tested the applicable testcases from my project with your approach and the main "faults" were these:
Code: Select all
it 'reset with $z', ->
assert.equal(Parser.toHTML('some $iitalic$z text'), 'some <span style="font-style:italic;">italic</span> text')
// 'some <span style="font-style:italic;">italic</span><span style=""> text</span>'
it 'formatting stacks (modified base style)', ->
assert.equal(Parser.toHTML('$o$f00base $<$z$iother style$> back again'), '<span style="color: #ff0000; font-weight:bold;">base </span><span style="color: #ff0000; font-weight:bold;font-style:italic;">other style</span><span style="color: #ff0000; font-weight:bold;"> back again</span>')
// '<span style="color: #ff0000; font-weight:bold;">base </span><span style="font-style:italic;">other style</span><span style="color: #ff0000; font-weight:bold;"> back again</span>'