Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-closing tags are not correctly recognized #813

axbender opened this issue Apr 18, 2019 · 2 comments

Self-closing tags are not correctly recognized #813

axbender opened this issue Apr 18, 2019 · 2 comments


Copy link

Version: 5.7.16 (and before)
Given the input


tidy outputs

<some_tag /></some_tag>

i.e. it adds a closing tag to an already closed one...

This happens with the attached config file (and only, if output-html is given).

accessibility-check: 0
add-meta-charset: no
add-xml-decl: no
add-xml-space: no
anchor-as-name: yes
ascii-chars: no
assume-xml-procins: no
bare: no
break-before-br: no
char-encoding: utf8
clean: yes
coerce-endtags: yes
css-prefix: c
custom-tags: no
decorate-inferred-ul: no
doctype: html5
drop-empty-elements: yes
drop-empty-paras: yes
drop-proprietary-attributes: yes
enclose-block-text: no
enclose-text: no
escape-cdata: no
escape-scripts: no
fix-backslash: yes
fix-bad-comments: auto
fix-style-tags: yes
fix-uri: yes
force-output: no
gdoc: no
gnu-emacs: yes
hide-comments: no
indent-attributes: no
indent-cdata: no
indent-spaces: 3
indent-with-tabs: no
indent: yes
input-encoding: utf8
input-xml: yes
join-classes: no
join-styles: yes
keep-tabs: no
keep-time: no
literal-attributes: no
logical-emphasis: no
lower-literals: yes
markup: yes
merge-divs: auto
merge-emphasis: yes
merge-spans: auto
mute-id: no
ncr: yes
newline: CRLF
numeric-entities: no
omit-optional-tags: no
output-bom: no
output-encoding: utf8
output-html: yes
output-xhtml: no
output-xml: no
preserve-entities: no
punctuation-wrap: no
quiet: yes
quote-ampersand: yes
quote-marks: no
quote-nbsp: yes
repeated-attributes: keep-last
replace-color: no
show-body-only: no
show-errors: 999
show-filename: no
show-info: no
show-meta-change: no
show-warnings: yes
skip-nested: yes
sort-attributes: none
strict-tags-attributes: no
tab-size: 8
tidy-mark: yes
uppercase-attributes: no
uppercase-tags: no
vertical-space: no
warn-proprietary-attributes: yes
word-2000: no
wrap-asp: yes
wrap-attributes: no
wrap-jste: yes
wrap-php: yes
wrap-script-literals: no
wrap-sections: yes
wrap: 68
write-back: no

Copy link

@axbender thanks for the issue... this seems a question between XML and HTML... a conversion...

I can repeat the output with -xml, that is your input-xml: yes, and -ashtml, your output-html: yes, options, on your input... so do not need all the config... but what does this indicate?

You are exactly correct! tidy has no understanding of self-closing tags... maybe the HTML 5.2 REC might help in that...

I think tidy can not really be used to convert xml to html... that is not in its purpose, aims... although it does its best... but probably fails in many instances... is that what we are seeing here?

If yes, then I am not sure tidy should, or could, be improved in this regard. What do others think?

Also need to search for other related issues... any pointers appreciated...

One tool I know, to convert XML to HTML, is xsltproc... you supply a style.xsl for your xml, include <xsl:output method="html"/> in this, and process the xml you have... get html... there may be others...

We use this to generate the tidy.1 man file, and the QuickRef HTML, from a tidy XML output... see man/ in the source for part of this... and the CMakeLists.txt for the generation steps...

Again, I do not think tidy is a good tool for such conversions... but maybe it should...

Look forward to further feedback, comments, patches, PR, ... to test... thanks...

Copy link

Lacking further feedback from the bug filer, I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants