Up to now, the tests have been running with whitespace stripped out.
Newlines and tabs are insignificant in HTML, so I figured why bother
with them?
Now I realize why: they’re significant in pre tags and they also make
your code look pretty!
I’ve been working to get SRC output to roughly match Tetxile2’s as
far as tabs and newlines go. It’s tough and is adding a lot of
messiness to the code! I’m close to done, but I’m not satisfied with
the result.
How about if we just ran the output through Tidy? Could we bundle
the tidylib c files in so the user doesn’t have to have tidylib
installed separately? Will the license allow it?
What do you all think?
Jason
Running everything through tidy seems superfluous to me – if i had to
vote, i’d say formatting the html all prettylike isn’t that important,
and isn’t worth the added parsing time (and trying to get the right libs
for the platform in the gem, etc). developers can call tidy in their
own projects if they really want tidy html, right?
is there a way you could:
retain whitespace between pre/code tags – you’d want to do that even
with tidy, since it won’t always know how you want to format your code
and then do something simple with the HTML, like adding newlines after
the end of closed block elments (
\n or \n\n)? maybe tabs
before
elements or something, but not getting too fancy.
I’m not sure they spent too much time in Textile2 trying to get the tabs
the way they are – trying to replicate them sounds like a headache you
don’t need to bring on yourself (& future SRC maintainers).
my 2c
david
I agree. Whitespace is not crucial. As a rule of thumb I would say
“never add or remove anything”. This means that if the user inserted a
return, leave it in the source (either before the
or after for
example). If there is a tab, leave it. If there is no tab, no return,
then do not add anything. Let a whitespace be like any other
character. This rule means:
- the parsing does not need fancy coding techniques.
- the code will be sufficiently readable.
- there is no messing up in “pre” tags.
This would imply removing the added whitespaces in the ruby HTML rules
and keep ‘\n’ and ’ ’ in the ragel regex. (space => cat, ensure CRLF
is captured in blocks).
Gaspard
2008/3/14, David R. [email protected]:
Yes, you’re very right. I’ve been just making it decent but not
overly precise and it’s going very well. I’ll be able to commit my
changes soon. Thanks for the feedback, David and Gaspard!