pombreda / txt2tags

Automatically exported from code.google.com/p/txt2tags
GNU General Public License v2.0
0 stars 0 forks source link

[PERMANENT] HTML Validator #121

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
We have multiple HTML targets, they should all pass errorless the HTML 
Validator test :
http://validator.w3.org/

Original issue reported on code.google.com by fgalla...@gmail.com on 25 Jun 2011 at 3:07

GoogleCodeExporter commented 9 years ago
With the sample file : currently html, xhtml, html5 and aaw targets are fine, 
but xhtmls has 5 errors.
http://validator.w3.org/check?uri=http%3A%2F%2Fdl.flext.net%2Fxhtmls.html&charse
t=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1
.2

Original comment by fgalla...@gmail.com on 25 Jun 2011 at 3:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
about the xhtmls, I checked what I could do (since I initiated this target). 
The problem is it's not easy to do, because of the goal of txt2tags and because 
of the restrictions of the xhtml strict target.

1/
For the first problem, about blockquotes, xhtml strict doesn't allow to use 
blockquote without a block-level element inside it (see 
http://www.w3schools.com/tags/tag_blockquote.asp). It was possible to do this:

    'xhtmls': {
/.../
        'blockQuoteOpen'       : '<blockquote><p>'   ,
        'blockQuoteClose'      : '</p></blockquote>'  ,
/.../

but it's both ugly, and it doesn't work for the sample file because there are 
two blockquotes in a row. So I'm hopeless on this part.

2/ for the "document type does not allow element "div" here;" error, here is 
what I changed in the code:

I quoted the original part, which was not validating:
# tag = '<div style="text-align: center;">%s</div>' % tag

It was possible to emulate the previous behavior (centering image), but it was 
rather a dirty fix like the previous one, and might not validate in some case:
# tag = '</p><div style="text-align: center;">%s</div><p>' % tag

So I decided to remove the center div, so it will always validate, though img 
won't be centered:
                   tag = '%s' % tag
I think it's more in the spirit of the modern web design to put such behavior 
into a CSS.

3/ for the last problem, about the border=0, it isn't supported into xhtml 
strict, and must, I think, be included into CSS. So I just removed it.

I'll commit the code now.

Original comment by eforg...@gmail.com on 26 Jun 2011 at 9:30

GoogleCodeExporter commented 9 years ago
About the image centering on xhtmls target, I've found two solutions:

        'img'                  : '<div style="~a~"><img src="\a" alt=""/></div>',
        '_imgAlignLeft'        : 'text-align:left;'  ,
        '_imgAlignCenter'      : 'text-align:center;',
        '_imgAlignRight'       : 'text-align:right;' ,

Or

        'img'                  : '<img style="display: block;~a~" src="\a" alt=""/>',
        '_imgAlignLeft'        : 'margin: 0 auto 0 0;'   ,
        '_imgAlignCenter'      : 'margin: 0 auto 0 auto;',
        '_imgAlignRight'       : 'margin: 0 0 0 auto;'   ,

Both work, not sure which is prettier though :S

Kind regards 

Original comment by HastCibe...@gmail.com on 16 Dec 2011 at 4:34

GoogleCodeExporter commented 9 years ago
About the P inside BLOCKQUOTE see issue 1 (wow!)

Original comment by aureliojargas@gmail.com on 21 Dec 2011 at 10:56

GoogleCodeExporter commented 9 years ago
The HastCiberneo fix to align the image works if the image is solo in the 
paragraph. Like this:

[image.png]

Other than that, the image can't be a display:block because it needs to flow 
with the text, inline, so a float:right/left must be used.

But I didn't analise if it's the best solution for the mentioned problem.

Original comment by aureliojargas@gmail.com on 21 Dec 2011 at 10:58