Skip to content

Self-closing tags are not correctly recognized #813

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

Closed
axbender opened this issue Apr 18, 2019 · 2 comments
Closed

Self-closing tags are not correctly recognized #813

axbender opened this issue Apr 18, 2019 · 2 comments

Comments

@axbender
Copy link

Version: 5.7.16 (and before)
Given the input

<some_tag/>

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
alt-text:
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
error-file:
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
mute: STRING_MUTING_TYPE
ncr: yes
new-blocklevel-tags:
new-empty-tags:
new-inline-tags:
new-pre-tags:
newline: CRLF
numeric-entities: no
omit-optional-tags: no
output-bom: no
output-encoding: utf8
output-file:
output-html: yes
output-xhtml: no
output-xml: no
preserve-entities: no
priority-attributes:
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

@geoffmcl
Copy link
Contributor

@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/tidy1.xsl.in 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...

@balthisar
Copy link
Member

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
Projects
None yet
Development

No branches or pull requests

3 participants