Page 1 of 1

Hazard Statement Styling

Posted: Tue Jul 10, 2018 10:01 am
by dpksaini89
Hi, The preset Hazard statement styling layout is not very good, it does not differentiate between a warning and a caution, A lot of space is left blank after the hazard statement, If howtoavoid field has multiple statements it doesnot allow to insert ordered or un-ordered list.
Image
Image

Kindly help us in getting a proper hazard statement: Something like shown below
Image

Re: Hazard Statement Styling

Posted: Tue Jul 10, 2018 3:45 pm
by Radu
Hi,

I will add an issue on our side to try and better style the hazard notes in a future version.
In the meantime the CSS rules for hazardstatement can be found here:

OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css

and you can try to override them in your own custom CSS to provide your own styling for it.
About this remark:
If howtoavoid field has multiple statements it doesnot allow to insert ordered or un-ordered list.
The list of allowed child elements for the howtoavoid according to the DITA 1.3 specification is this one:

https://www.oxygenxml.com/dita/1.3/spec ... howtoavoid

you can probably use a DITA <sl> (simple list) inside it.

Regards,
Radu

Re: Hazard Statement Styling

Posted: Fri Aug 10, 2018 3:50 pm
by DennyKim
Hi
I would like to know how to change the background color of each specific hazardstatement type .
The current
OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-domain-hazard-d.css as of line 55 is written:

Code: Select all



*[class~"hazard-d/statement"] {
display:block;
background-color:#f57222
border-bottom: 2pt solid;
padding:0.2em;
font-weight:bold
font-size:1.8em
}
In DITA-Framework, I would to have the background color for a
- <hazardstatement type="danger"> with background-color in red;
- <hazardstatement type="warning"> with background-color in orange;
- <hazardstatement type="caution"> with background-color in yellow;
- <hazardstatement type="notice"> with background-color in blue without the icon;

So my question: How do I write/modify the css, so that each hazardstatement type changes color? Could you present me the code?

Thanks in advance.. best regards
Mr. Kim

Re: Hazard Statement Styling

Posted: Mon Aug 13, 2018 8:09 am
by Radu
Hi,

Maybe you could add in your custom CSS extra selectors looking like this one:

Code: Select all

*[class~="hazard-d/hazardstatement"][type='danger'] {
background-color:red;
}
This topic describes how you can debug your CSS selectors to see that you match the proper constructs:

https://www.oxygenxml.com/doc/versions/ ... e_css.html

Regards,
Radu

Re: Hazard Statement Styling

Posted: Thu Aug 16, 2018 11:35 am
by DennyKim
Hello,
first, I would like to thank you for your previous assistance. I have experimented the "-domain-hazard-d.css"-file and changed it so that much of it now complies with DIN EN82079 and ISO7010 Standards.
But currently, the hazard symbol appears in every type of <hazardstatement>-Element (danger, warning, caution, notice/note) which is not tolerable.

So my question: how do I prevent thte hazard symbol from appearing in a <hazardstatement type="notice">-Element, while the other <hazardstatement type="notice">-Elements must have the hazard symbol? What method must I apply?

In line 55 - line 90, the css-coding currently looks like this:

Code: Select all



*[class~="[color=#0040FF]hazard-d/statement"/hazardstatement[/color]"][type:"[color=#0040FF]notice[/color]"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}

/*
* Try to put all caps on the known types.
*/
*[class~="hazard-d/statement"/hazardstatement][type]:before {
content: url("../img/warning-black30.png") " " attr(type);
}

Best regards,
Mr. Kim

Re: Hazard Statement Styling

Posted: Thu Aug 16, 2018 1:42 pm
by Radu
Hi,

I'm sorry but I do not understand what you mean. Could you also post some small DITA XML code snippets showing those two situations?

Regards,
Radu

Re: Hazard Statement Styling

Posted: Thu Aug 16, 2018 3:08 pm
by DennyKim
How do i prevent the yellow triangle with the expression mark from appearing in the top left corner, when I want to create a NOTICE-hazardstatement??

Image

This is the code written in the oxygen xml css file for DITA-topic hazard statement:

*[class~="hazard-d/statement"/hazardstatement"][type:"notice"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}

/*
* Try to put all caps on the known types.
*/
*[class~="hazard-d/statement"/hazardstatement][type]:before {
content: url("../img/warning-black30.png") " " attr(type);

Re: Hazard Statement Styling

Posted: Thu Aug 16, 2018 3:56 pm
by Dan
Hello Mr. Kim,

I think you should write your CSS customization rules as:

Code: Select all


*[class~="hazard-d/hazardstatement"][type="notice"]:before {
content: oxy_uppercase(attr(type));
}


*[class~="hazard-d/hazardstatement"][type="notice"] {
display:block;
background-color:blue;
border-bottom: 2pt solid;
padding:0.4em 0.2em 0.2em 0.8em;
font-weight:bold;
font-size:1.2em
}
1. I have corrected the class expressions.
2. I have removed the icon from the "content" expression leaving just an uppercase value extracted from the type attribute. You can use instead the string "NOTICE", since we matched the notice type.

Let us know if you have more questions.
Many regards,
Dan

Re: Hazard Statement Styling

Posted: Mon Sep 10, 2018 4:31 pm
by DennyKim
Currently, the "NOTICE"-hazardstatement also produces the General Hazard Symbol.

How do I remove the image and replace it with different image? Note that the other hazard-statement-types DANGER, WARNING and CAUTION must remain how they are and inclede the General Hazard Symbol ISO-W001.

In the -topic-body.css:262, I found the following css-code:

Code: Select all



*[class~='topic/image' ]{
content:attr(href , url);
}
The css-file @domain-hazard-d.css looks like this:

Code: Select all


 +[class~="hazard-d/hazardstatement"][type="notice"] {
display:block;
color:rgb (255,255,255);
background-color: rgb(21, 72, 137);
padding:0.4em;
padding:0.1em;
padding:0.1em;
padding:0.1em;
}
So what is the next step??

Re: Hazard Statement Styling

Posted: Thu Sep 13, 2018 10:26 am
by Dan
You should save the image for notice next to the customization CSS file.
After this, add in you CSS:

Code: Select all


*[class ~= "hazard-d/hazardstatement"][type = "notice"]:before {
content: url("other_notice_icon.png") " NOTICE";
}
In this way you are changing the icon and label of the notice hazardstatements with the ones of your choice. Or you can simply remove the url() expression to remove the icon from the notices.

Many regards,
Dan

Re: Hazard Statement Styling

Posted: Mon Apr 29, 2019 2:50 pm
by dpksaini89
Hi i was able to customize the hazard statement based on the above information, but I am facing one issue:

The hazard statement image is not properly aligned to the WARNING.
Also please suggest how to set parameters for image to get a similar output as shown below:
Current:
Image

Expected:
Image

Re: Hazard Statement Styling

Posted: Wed May 01, 2019 1:30 pm
by dpksaini89
waiting for a response.

Re: Hazard Statement Styling

Posted: Mon May 06, 2019 2:28 pm
by Dan
There is no simple way to achieve this by CSS layout, but is an workaround.

You should create a series of simple background images for the hazard statement headers. These background images should replace the normal header coloring, and have the left part empty - on this part the danger symbol is placed by the layout engine.

For example:

Code: Select all

*[class~="hazard-d/hazardstatement"]:before{
    background-color:inherit;
    background-position:0 0;

/* This should be an image with a white left part the same size with the danger symbol and the rest filled with the needed color. It can be a svg.*/
    background-image: url("bg-image.png"); /* SIGNAL ORANGE, RAL 2010, No ISO, but appears in the american guidelines */
}

*[class~="hazard-d/hazardstatement"][type="danger"]:before{
    background-image: url("bg-image-danger.png");  /* SIGNAL RED  RAL 3001, https://en.wikipedia.org/wiki/ISO_3864 */
}

*[class~="hazard-d/hazardstatement"][type="caution"]:before{
    background-image: url("bg-image-caution.png"); /* SIGNAL YELLOW  RAL 1003, https://en.wikipedia.org/wiki/ISO_3864 */
}

*[class~="hazard-d/hazardstatement"][type="note"]:before{
    background-image: url("bg-image-note.png");  /* SIGNAL BLUE RAL 5005, https://en.wikipedia.org/wiki/ISO_3864 */
}
Many regards,
Dan

Re: Hazard Statement Styling

Posted: Fri Nov 20, 2020 5:49 pm
by julien_lacour
Hello,

The new Oxygen version 23.0 is now available on our website. It includes some improvements on hazard statements rendering.

Regards,
Julien

Re: Hazard Statement Styling

Posted: Mon Dec 21, 2020 10:36 am
by Tygopit
Hi,
I'm not sure if it's connected with 23.0 update, but I'm unable to clear the image in the header of the hazardstatement table by using tips presented above.

I'm able to clear the text in the header, using the following code in customization CSS:

Code: Select all

*[class~="hazardstatement--danger"] {
        content: " " !important;
    }
And that's it. The image is still visible. :(

I'd like to clear the whole header, or at least convert it to an empty row in the table.
Any idea?

Re: Hazard Statement Styling

Posted: Mon Dec 21, 2020 10:57 am
by julien_lacour
Hello Piotr,

If you want to remove the whole row from the hazardstatement, I suggest the following CSS:

Code: Select all

*[class~="hazardstatement--danger"] {
    display: none;
}
Regards,
Julien

Re: Hazard Statement Styling

Posted: Mon Dec 21, 2020 11:21 am
by Tygopit
Hi Julien,

I've tried this before, but it resulted in a Transformation fail!

Code: Select all

BUILD FAILED
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\org.dita.base\build.xml:29: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\build.xml:524: The following error occurred while executing this line:
C:\Program Files\Oxygen XML Editor\frameworks\dita\DITA-OT3.x\plugins\com.oxygenxml.pdf.css\build.xml:614: Java returned: 1
The above may be connected with the following:

Code: Select all

[java] Caused by: org.apache.fop.fo.ValidationException: file:/C:/Users/PC/OneDrive/DOX/LEARN/vb/temp/pdf-css-html5/oxygen_dita_temp/stage1.xml.pp:700:86: "fo:table-row" is missing child elements. Required content model: (table-cell+) (See position 700:86)
That is why I have doubt about the update and changes it may impose. :D

Re: Hazard Statement Styling

Posted: Mon Dec 21, 2020 12:12 pm
by julien_lacour
Hello Piotr,

I'm sorry, I totally forgot the table checker, you may use the following CSS instead:

Code: Select all

*[class ~= "hazard-d/hazardstatement"][type = "danger"] tr:first-of-type {
  display: none;
}

*[class ~= "hazard-d/hazardstatement"][type = "danger"] {
  border: unset;
}
Regards,
Julien

Re: Hazard Statement Styling

Posted: Mon Dec 21, 2020 12:20 pm
by Tygopit
Hi Julian,

That's it.
Thanks a lot!