dita-ot / dita-ot

DITA Open Toolkit — the open-source publishing engine for content authored in the Darwin Information Typing Architecture.
https://www.dita-ot.org
Apache License 2.0
384 stars 192 forks source link

XHTML output for <draft-comment> should use class attribute #543

Closed jelovirt closed 12 years ago

jelovirt commented 12 years ago

Converted from SourceForge issue 3004895, submitted by infotexture

The XHML output for currently wraps the element content in a

with a style attribute that sets the background color and border.

It would be preferable to use a class attribute instead

, and move styling into the CSS file to allow user style sheets to override the default presentation.

jelovirt commented 12 years ago

Submitted by robander

I think the original reasoning for that was to ensure that draft content (and output from required cleanup) was clearly visible even for those that do not use the CSS files. We do wish to avoid people accidentally including draft material in the output without realizing it (which has happened when people forget to turn off the draft parameter for a final build).

Note that there is a new parameter which does also add the draft-content class to the

element; this parameter was added in DITA-OT 1.5. For the Java command line, set /xhtmlclass:yes For an Ant build file, set ${args.xhtml.classattr} to yes. With either approach, you get

I haven't tried using CSS together with @style, so I'm not sure if this allows you to override the default style or not.

jelovirt commented 12 years ago

Submitted by infotexture

Thanks for clarifying (and for the recent follow-up on the dita-users list).

I was unaware of the ${args.xhtml.classattr} parameter. I think it would be very useful to set the default for this to "yes" per discussion on the list.

I suggest moving the current hard-coded style attributes into the 'commonltr.css' file, so they are applied whenever draft content is published (even by accident) and are more easily overridden with user-specified CSS files. (The CSS cascade means any local formatting takes precedence over declarations in external CSS files, so it's very difficult to customize formatting if OT writes style attributes to the HTML output).

jelovirt commented 12 years ago

Submitted by robander

Returning to this after too long away...

Based on discussion on dita-users, there was consensus that the default for the class attribute parameter should be to include them. So, the default was changed in the first 1.5.2 test build.

There were also several comments urging that we keep the hard coded style values, in order to ensure that even those without our default CSS always notice the draft content. So, I'm going to keep those values in the output file. However, I do want to make it easier to change the values, so I've moved the style setting into its own template. The style is now set with these templates:

xsl:textbackground-color: #FFFF99; color:#CC3333; border: 1pt black solid;/xsl:text /xsl:attribute /xsl:template xsl:textbackground-color: #99FF99; border: 1pt black solid;/xsl:text /xsl:attribute /xsl:template This means that - in order to keep the style out of the file, and to rely exclusively on your own CSS setting - you can create an XSL override that only changes those two templates: I'd also be willing to consider a new Ant parameter that allows you to remove these from your build file. But, that needs a bit more design, so for now I'm doing this simple approach to at least make this easier in the 1.5.2 package.
jelovirt commented 12 years ago

Submitted by gladmustang

We will included the enhancement from Robert into DITA OT 1.5.2 M6 build