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

HTML output uses removed HTML5 attribute: @compact #4298

Closed
markgif opened this issue Oct 9, 2023 · 6 comments · Fixed by #4303
Closed

HTML output uses removed HTML5 attribute: @compact #4298

markgif opened this issue Oct 9, 2023 · 6 comments · Fixed by #4303
Labels
bug good first issue More straightforward issue; good candidate to get started as contributor plugin/html5 Issue related to HTML5 plug-in priority/medium Medium (or unknown) priority issue
Milestone

Comments

@markgif
Copy link

markgif commented Oct 9, 2023

Expected Behavior

HTML output should use standard HTML markup supported by major browsers. @compact is no longer supported by Chrome, Firefox, Safari, Edge, Opera.

Actual Behavior

HTML output for html5 and xhtml uses @compact attribute, which was removed from HTML5. It was deprecated in HTML 4 about 20 years ago.

HTML5 spec, section 16.2 Non-conforming features:
https://html.spec.whatwg.org/#non-conforming-features
Paraphrase of the spec:

The following attributes are obsolete (though the elements are still part of the language), and must not be used by authors:
compact on dl elements
compact on menu elements
compact on ol elements
compact on ul elements

Possible Solution

Add a compact value in @class, and make the CSS match that?

Steps to Reproduce

  1. In DITA 1.3 XML topic, add @compact to the root element of a list like <ul>:
    <ul compact="yes">
        <li>text</li>
  2. Run the html5 or xhtml transtype on it.
  3. The HTML output uses @compact.
    html5:
    <ul class="ul" compact>
    xhtml:
    <ul class="ul" compact="compact">
    CSS:
    *[compact=yes] > li {
    margin-top: 0; }
    *[compact=no] > li {
    margin-top: 0.53em; }

The Oxygen XML editor gives an error if you open the HTML file:

The “compact” attribute on the “ul” element is obsolete. Use CSS instead.

Environment

  • DITA-OT version: 4.1.1
  • Operating system and version:
    Windows 10
  • How did you run DITA-OT?
    Oxygen GUI
  • Transformation type:
    html5, xhtml
@markgif markgif added the bug label Oct 9, 2023
@jelovirt jelovirt added priority/medium Medium (or unknown) priority issue plugin/html5 Issue related to HTML5 plug-in labels Oct 9, 2023
@jelovirt
Copy link
Member

jelovirt commented Oct 9, 2023

The @compact is one of those features of DITA that I think is very rarely used. We should replace this with outputting class="compact" in HTML5 and XHTML.

@jelovirt jelovirt added the good first issue More straightforward issue; good candidate to get started as contributor label Oct 9, 2023
@markgif
Copy link
Author

markgif commented Oct 9, 2023

@compact in DITA XML is still used quite a bit, according to the OASIS DITA TC. @fwegmann asked them. The TC plans to keep @compact in DITA 2.0. But it's long gone in HTML. We've been discussing compact lists in the Lightweight DITA Subcommittee and I discovered this.

@chrispy-snps
Copy link
Contributor

Testcase that applies @compact="yes" to <ul>, <ol>, <sl>, and <dl>: 4298.zip

@markgif
Copy link
Author

markgif commented Nov 6, 2023

I have a request on this. Recently in the Lightweight DITA Subcommittee we decided to add the attribute @data-compact to the HTML5 flavor of Lightweight DITA (aka HDITA), instead of adding a fixed @class value of "compact". Can we get you to use @data-compact="yes" or @data-compact="no" instead of the @class syntax above?

Example:

HTML5 and HTML5 XML syntax ("XHTML")
<ul class="ul" data-compact="yes">

CSS

*[data-compact=yes] > li {
margin-top: 0; }
*[data-compact=no] > li {
margin-top: 0.53em; }

@chrispy-snps
Copy link
Contributor

@jelovirt, @robander - this represents a departure from precedent for capturing element characteristics in the HTML. I think we should discuss it in the next monthly call.

@markgif
Copy link
Author

markgif commented Nov 7, 2023

I would not mind attending this meeting, can I?

@jelovirt jelovirt added this to the Next milestone Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue More straightforward issue; good candidate to get started as contributor plugin/html5 Issue related to HTML5 plug-in priority/medium Medium (or unknown) priority issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants