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 (</p>\n or </div>\n\n)? maybe tabs before <li> 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> 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 > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards > >
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 </p> 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: 1. the parsing does not need fancy coding techniques. 2. the code will be sufficiently readable. 3. 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 Reese <work at whatcould.com>:> 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 (</p>\n or </div>\n\n)? maybe tabs > before <li> 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 > > > > 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 > > _______________________________________________ > > Redcloth-upwards mailing list > > Redcloth-upwards at rubyforge.org > > http://rubyforge.org/mailman/listinfo/redcloth-upwards > > > > > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards >
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! On Mar 14, 2008, at 12:32 AM, David Reese wrote:> 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 (</p>\n or </div>\n\n)? maybe tabs > before <li> 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 > >> 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 >> _______________________________________________ >> Redcloth-upwards mailing list >> Redcloth-upwards at rubyforge.org >> http://rubyforge.org/mailman/listinfo/redcloth-upwards >> >> > > _______________________________________________ > Redcloth-upwards mailing list > Redcloth-upwards at rubyforge.org > http://rubyforge.org/mailman/listinfo/redcloth-upwards