How to rotate the whole chapter?

Post here questions and problems related to editing and publishing DITA content.
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

How to rotate the whole chapter?

Post by DmitryS »

Hi!
(I've read all topics and articles here related to "landscape")
One of my topics contains wide content, so I want to place it on the landscape page.
I've got definitions in my CSS:

Code: Select all

	@page landscape-page:right {
	    size: landscape;
	    margin-top: 2.5cm;
        margin-bottom: 1.5cm;
        margin-left: 2cm;
        margin-right: 3cm;        
        
	    background-image: url(images/background_image_right_page_landscape.svg);
        background-position:center;
        background-repeat:no-repeat;
	
	    @top-left {
	        content: none
	    }
	    @top-center {
	        content: none
	    }
	    @top-right {
	        content: none
	    }
	
	    @right-bottom {
            content: string(maptitle) "\A" string(chaptertitle1) "\A" string(chaptertitle2);
            font-family: 'PT Sans', PTSans, sans-serif !important;
            font-size:8pt;
            color:white;
            transform: rotate(90);
	        vertical-align: middle;
	        text-align: left;
        }
        
        @bottom-left-corner {
            content: counter(page);
            font-size:12pt;
            font-family: 'PT Sans', PTSans, sans-serif;
            color: #00657f;
            transform: rotate(90);
            padding-bottom: 0.5in;
        }
        @bottom-right-corner {
            content: none;
        }        
	}
	
	@page landscape-page:left {
	    size: landscape;
	    margin-top: 1.5cm;
        margin-bottom: 2.5cm;
        margin-left: 2cm;
        margin-right: 3cm; 
	    
	    background-image: url(images/background_image_left_page_landscape.svg);
        background-position:center;
        background-repeat:no-repeat;
	
	    @top-left {
	        content: none
	    }
	    @top-center {
	        content: none
	    }
	    @top-right {
	        content: none
	    }
	
	    @right-top {
            content: string(maptitle) "\A" string(chaptertitle1) "\A" string(chaptertitle2);
            font-family: 'PT Sans', PTSans, sans-serif !important;
            font-size:8pt;
            color:white;
            transform: rotate(90);
	        vertical-align: middle;
	        text-align: right;
        }
        
        @bottom-left-corner {
            content: none;
        }        
        
         @top-left-corner {
            content: counter(page);
            font-size:12pt;
            font-family: 'PT Sans', PTSans, sans-serif;
            color: #00657f;
            transform: rotate(90);
        }
	}
and it works for tables with orient="land".
I've added the following:

Code: Select all

*[outputclass="wide"] {
    page: landscape-page;
}
and placed it into ditamap:

Code: Select all

    <chapter outputclass="wide" href="modules/sigacfg/reference/r_security_ug_tables.dita"/>
As a result chapter is not rotated.
Is there any mistake?

Sincerely,
Dmitry

UPDATE: It appears now that row form TOC related with this chapter is placed on separated rotated page...
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to rotate the whole chapter?

Post by julien_lacour »

Hello Dmitry,

Your customization is correct, you just need to move the outputclass attribute from <topicref> element to the topic "r_security_ug_tables.dita" itself. You will obtain something like:

Code: Select all

<topic id="r_security_ug_tables" outputclass="wide">
It does not work on the ditamap <topicref> elements as they are references to the topics and not the actual topics.

Regards,
Julien
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

Re: How to rotate the whole chapter?

Post by DmitryS »

Hello Julien!

Unfortunately, no effect.
Does it should work?

Code: Select all

<reference id="r_security_ug_tables" outputclass="wide">
Regards,
Dmitry
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to rotate the whole chapter?

Post by julien_lacour »

Dmitry,

On my side it works correctly, make sure your args.css parameter is correctly set, and contains:

Code: Select all

*[outputclass = "wide"] {
    page: landscape-page;
}
For testing purpose I used the following Reference

Code: Select all

<reference id="test" outputclass="wide">
    <title>Test</title>
    <shortdesc/>
    <refbody/>
</reference>
You can also check in your favorite brower that if you select the node containing the reference, in my case:

Code: Select all

<article class="- topic/topic reference/reference topic reference nested2 wide" aria-labelledby="ariaid-title10" id="unique_18" topicrefclass="- map/topicref " nd:nd-id="test" oid="test" outputclass="wide">
    <h3 class="- topic/title title topictitle3" id="ariaid-title10"><span class="- topic/ph topic/title-wrapper ph title-wrapper">Test</span></h3>
    
    <div class="- topic/body reference/refbody body refbody"><p class="- topic/shortdesc shortdesc"></p></div>
</article>
The CSS Inspector show the "outputclass" selector (when inspecting the <article> element).

I did the test on <oXygen/> XML Editor 22.0, build 2020030607

Regards,
Julien
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

Re: How to rotate the whole chapter?

Post by DmitryS »

Julien,
My inspector shows this:

Code: Select all

<article xmlns:nd="http://www.oxygenxml.com/css2fo/named-destinations" class="- topic/topic reference/reference topic reference nested0 wide" aria-labelledby="ariaid-title2" break-before="true" is-chapter="true" id="unique_2" outputclass="wide wide" topicrefclass="- map/topicref bookmap/chapter " nd:nd-id="r_security_ug_tables" oid="r_security_ug_tables">
'wide' is doubled.

I use 21.1 + framework you sent me before.

Regards,
Dmitry
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to rotate the whole chapter?

Post by julien_lacour »

Dmitry,

Could you try to set back the "DITA / DITA Open Toolkit" to built-in value as well as "XML / PDF Output / CSS-based Processors" to Auto-detect and this what is happening. I tried on <oXygen/> XML Editor 21.1, build 2019120214 and my reference topic was displayed as landscape.

The snapshots are not released version and they can contain errors still on going.

Regards,
Julien
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

Re: How to rotate the whole chapter?

Post by DmitryS »

Done. 'wide' is doubled again.

Regards,
Dmitry
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to rotate the whole chapter?

Post by julien_lacour »

Hello,

The issue is related to the usage of bookmap and chapters: the default rule for chapters is

Code: Select all

*[class ~= "topic/topic"][is-chapter] {
	/* Each chapter starts a new page sequence, so the :first selector applies to each of them. */
     -oxy-page-group:start; 
     page: chapter; 
}
Which has a bigger priority than the following rule (more specific):

Code: Select all

*[outputclass = 'wide'] {
    page: landscape-page;
}
In this case we have 2 solutions
  • Use the !important rule

    Code: Select all

    *
    [outputclass = 'wide'] {
        page: landscape-page !important;
    }
    
  • Use a more specific selector

    Code: Select all

    *[class ~= "topic/topic"][is-chapter][outputclass="wide"] {
        page: landscape-page;
    }
    
Regards,
Julien
DmitryS
Posts: 26
Joined: Wed Nov 27, 2019 11:03 am

Re: How to rotate the whole chapter?

Post by DmitryS »

Hi Julien!
Thanks a lot. It works.

Sincerely,
Dmitry
Post Reply