Lightweight DITA SC

 View Only
Expand all | Collapse all

Notes on lists, tight and loose, and @compact attribute

  • 1.  Notes on lists, tight and loose, and @compact attribute

    Posted 10-02-2023 01:12
    Executive Summary We discussed adding tight/loose lists to MDITA to match CommonMark spec. Related to this, we talked about adding @compact attribute (from DITA 1.3) to XDITA and HDITA. However, @compact was removed from HTML5 (replaced with CSS as it should be). This question arose: Should @compact be removed from DITA 2.0? Isn't it an archaic styling attribute? Still to be decided: How to handle tight/loose lists in MDITA How will that affect XDITA and HDITA, if at all Background Info This subcommittee discussion came up because of the following DITA OT bug, which applies only to MDITA and Markdown, not XML DITA: https://github.com/jelovirt/org.lwdita/issues/175 Summary of Bug 175 In the original Markdown, to make HTML output list spacing tight, you would put carriage return between list items. To give the HTML output looser spacing, you'd put a carriage return between list items. This idea was carried over into the CommonMark Markdown standard, which MDITA is based on. Here is the CommonMark spec on this subject: https://spec.commonmark.org/0.30/#loose Even though MDITA is based on CommonMark, MDITA was not designed to support tight and loose lists like this, so it violates CommonMark on this point. This pretty much applies only to HTML output. For other output like PDF, it probably does not really apply. Or should not apply. This caused us to look at the @compact attribute for DITA 1.3 XML. The @compact Attribute Was Removed in HTML5 In HTML5, the @compact attribute has been removed. It was deprecated in HTML 4, 20 years ago. Modern popular browsers do not support @compact, they ignore it. It can be replaced with CSS. Mozilla Developer Network docs on @compact in <ul>: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul compact - Deprecated Non-standard Warning: Do not use this attribute, as it has been deprecated: use CSS instead. To give a similar effect as the compact attribute, the CSS property line-height can be used with a value of 80%. DITA 1.3 Still Supports @compact DITA 1.3 @compact attribute in the spec: https://www.oxygenxml.com/dita/1.3/specs/langRef/attributes/commonAttributes.html#common-atts__compact Indicates close vertical spacing between list items. Expanded spacing is the processing default. The output result of compact spacing depends on the processor or browser. Allowable values are: yes - Indicates compact spacing. no - Indicates expanded spacing. DITA Open Toolkit Support for @compact DITA 1.3 XML content using @compact: Running XHTML output through the latest DITA OT version (4.1.1) with DITA 1.3 XML content using @compact on <ul>, produces results in XHTML like this: <ul class= ul compact= compact > ÂÂÂÂÂÂÂ <li class= li >one</li> But since @compact is archaic HTML syntax, it is unsupported by modern browsers. You could probably make a CSS class that operated on @compact, but why bother. Use HTML @class. XDITA does not support @compact HDITA - Does not support @compact. And since @compact is gone in HTML5, use CSS instead. MDITA - DITA OT does not recognize tight/loose lists in MDITA. That's it. Mark Giffin


  • 2.  RE: [dita-lightweight-dita] Notes on lists, tight and loose, and @compact attribute

    Posted 10-02-2023 15:45
    Thanks a lot, Mark!   I brought forward this topic to the TC. Regarding the use of @compact in DITA, it’s still defined in DITA 2.0 and will stay there. The most prominent reasons are its function for controlling formatting as well as the fact that it is established and widely used. See the TC minutes for an excerpt of the discussion: https://lists.oasis-open.org/archives/dita/202309/msg00016.html   f.       From: dita-lightweight-dita@lists.oasis-open.org <dita-lightweight-dita@lists.oasis-open.org> On Behalf Of Mark Giffin Sent: Monday, October 2, 2023 3:12 AM To: dita-lightweight-dita@lists.oasis-open.org Subject: [dita-lightweight-dita] Notes on lists, tight and loose, and @compact attribute   Executive Summary We discussed adding tight/loose lists to MDITA to match CommonMark spec. Related to this, we talked about adding @compact attribute (from DITA 1.3) to XDITA and HDITA. However, @compact was removed from HTML5 (replaced with CSS as it should be). This question arose: Should @compact be removed from DITA 2.0? Isn't it an archaic styling attribute? Still to be decided: How to handle tight/loose lists in MDITA How will that affect XDITA and HDITA, if at all Background Info This subcommittee discussion came up because of the following DITA OT bug, which applies only to MDITA and Markdown, not XML DITA: https://github.com/jelovirt/org.lwdita/issues/175 Summary of Bug 175 In the original Markdown, to make HTML output list spacing tight, you would put carriage return between list items. To give the HTML output looser spacing, you'd put a carriage return between list items. This idea was carried over into the CommonMark Markdown standard, which MDITA is based on. Here is the CommonMark spec on this subject: https://spec.commonmark.org/0.30/#loose Even though MDITA is based on CommonMark, MDITA was not designed to support tight and loose lists like this, so it violates CommonMark on this point. This pretty much applies only to HTML output. For other output like PDF, it probably does not really apply. Or should not apply. This caused us to look at the @compact attribute for DITA 1.3 XML. The @compact Attribute Was Removed in HTML5 In HTML5, the @compact attribute has been removed. It was deprecated in HTML 4, 20 years ago. Modern popular browsers do not support @compact, they ignore it. It can be replaced with CSS. Mozilla Developer Network docs on @compact in <ul>: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul compact - Deprecated Non-standard Warning: Do not use this attribute, as it has been deprecated: use CSS instead. To give a similar effect as the compact attribute, the CSS property line-height can be used with a value of 80%. DITA 1.3 Still Supports @compact DITA 1.3 @compact attribute in the spec: https://www.oxygenxml.com/dita/1.3/specs/langRef/attributes/commonAttributes.html#common-atts__compact Indicates close vertical spacing between list items. Expanded spacing is the processing default. The output result of compact spacing depends on the processor or browser. Allowable values are: yes - Indicates compact spacing. no - Indicates expanded spacing. DITA Open Toolkit Support for @compact DITA 1.3 XML content using @compact: Running XHTML output through the latest DITA OT version (4.1.1) with DITA 1.3 XML content using @compact on <ul>, produces results in XHTML like this:     <ul class="ul" compact="compact">         <li class="li">one</li> But since @compact is archaic HTML syntax, it is unsupported by modern browsers. You could probably make a CSS class that operated on @compact, but why bother. Use HTML @class. XDITA does not support @compact HDITA - Does not support @compact. And since @compact is gone in HTML5, use CSS instead. MDITA - DITA OT does not recognize tight/loose lists in MDITA. That's it. Mark Giffin Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Sanjay Brahmawar (Vorsitzender/Chairman), Daniela Bünger, Joshua Husk, Dr. Benno Quade, Dr. Stefan Sigg - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Christian Lucas - https://www.softwareag.com