From 0d5b7b6578b1c46e27777ceca350d234376f3b53 Mon Sep 17 00:00:00 2001 From: Frank Steimke Date: Tue, 6 Feb 2024 07:00:15 +0100 Subject: [PATCH 1/5] Support for landscape orientation in print output for some elements --- src/guide/xml/ch02.xml | 6 +++ src/main/scss/page-setup.scss | 11 +++++ src/main/xslt/modules/attributes.xsl | 50 +++++++++++++++++--- src/test/resources/expected/article.016.html | 1 + src/test/resources/expected/book.014.html | 6 +++ src/test/resources/expected/book.015.html | 6 +++ src/test/resources/expected/book.016.html | 6 +++ src/test/resources/expected/book.017.html | 6 +++ src/test/resources/expected/book.018.html | 2 + src/test/resources/xml/article.016.xml | 6 +++ src/test/resources/xml/book.014.xml | 47 ++++++++++++++++++ src/test/resources/xml/book.015.xml | 47 ++++++++++++++++++ src/test/resources/xml/book.016.xml | 48 +++++++++++++++++++ src/test/resources/xml/book.017.xml | 47 ++++++++++++++++++ src/test/resources/xml/book.018.xml | 36 ++++++++++++++ 15 files changed, 318 insertions(+), 7 deletions(-) create mode 100644 src/test/resources/expected/article.016.html create mode 100644 src/test/resources/expected/book.014.html create mode 100644 src/test/resources/expected/book.015.html create mode 100644 src/test/resources/expected/book.016.html create mode 100644 src/test/resources/expected/book.017.html create mode 100644 src/test/resources/expected/book.018.html create mode 100644 src/test/resources/xml/article.016.xml create mode 100644 src/test/resources/xml/book.014.xml create mode 100644 src/test/resources/xml/book.015.xml create mode 100644 src/test/resources/xml/book.016.xml create mode 100644 src/test/resources/xml/book.017.xml create mode 100644 src/test/resources/xml/book.018.xml diff --git a/src/guide/xml/ch02.xml b/src/guide/xml/ch02.xml index b5a6631822..cf1de8d916 100755 --- a/src/guide/xml/ch02.xml +++ b/src/guide/xml/ch02.xml @@ -1484,6 +1484,12 @@ presentation, in the printed version. The resulting HTML document can be formatted directly with a CSS paged-media formatter. + Landscape orientation in print output + The default orientation for pages in print output is portrait. You can switch it to + landscape orientation with the <?landscape> processing instruction. This may + apply to the whole book or article, or to individual chapter, + section or appendix elements. You can also print individual tables or + figures in landscape, if they are to wide for portrait pages. diff --git a/src/main/scss/page-setup.scss b/src/main/scss/page-setup.scss index b227fe0414..2d47c55bd0 100644 --- a/src/main/scss/page-setup.scss +++ b/src/main/scss/page-setup.scss @@ -801,6 +801,17 @@ html.book-style .book .list-of-titles { counter-reset: page; } +/* ============================================================ */ +/* Support for landscape orientation */ + +@page landscape { + size: landscape; +} + +.landscape { + page: landscape; +} + /* ============================================================ */ html.article-style > header { diff --git a/src/main/xslt/modules/attributes.xsl b/src/main/xslt/modules/attributes.xsl index b53d13f85a..cae4b17386 100644 --- a/src/main/xslt/modules/attributes.xsl +++ b/src/main/xslt/modules/attributes.xsl @@ -28,13 +28,20 @@ + + + + + + + @@ -44,8 +51,15 @@ + + + + + + + + select="f:attributes(., $attr, (local-name(.), 'division', @status, $landscape), ())"/> @@ -56,8 +70,15 @@ |db:preface|db:chapter|db:appendix" mode="m:attributes" as="attribute()*"> + + + + + + + + select="f:attributes(., $attr, (local-name(.), 'component', @status, $landscape), ())"/> @@ -70,8 +91,15 @@ + + + + + + + + select="f:attributes(., $attr, (local-name(.), @status, $landscape), ())"/> @@ -174,7 +202,7 @@ - + @@ -208,7 +236,7 @@ - + @@ -332,13 +360,21 @@ + + + + + + + - + Unit Test: article.016

Unit Test: article.016

Content in landscape orientation (for PDF)

\ No newline at end of file diff --git a/src/test/resources/expected/book.014.html b/src/test/resources/expected/book.014.html new file mode 100644 index 0000000000..c655aa2276 --- /dev/null +++ b/src/test/resources/expected/book.014.html @@ -0,0 +1,6 @@ +Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal.

The whole book should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/expected/book.015.html b/src/test/resources/expected/book.015.html new file mode 100644 index 0000000000..41f67c4dfb --- /dev/null +++ b/src/test/resources/expected/book.015.html @@ -0,0 +1,6 @@ +Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal.

Only this chapter should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/expected/book.016.html b/src/test/resources/expected/book.016.html new file mode 100644 index 0000000000..6550aaffa5 --- /dev/null +++ b/src/test/resources/expected/book.016.html @@ -0,0 +1,6 @@ +Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal.

Only this table with it's caption should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/expected/book.017.html b/src/test/resources/expected/book.017.html new file mode 100644 index 0000000000..073f2dc8d8 --- /dev/null +++ b/src/test/resources/expected/book.017.html @@ -0,0 +1,6 @@ +Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Purpose of this Book

This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal.

This article should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book

Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/expected/book.018.html b/src/test/resources/expected/book.018.html new file mode 100644 index 0000000000..04a72b9e14 --- /dev/null +++ b/src/test/resources/expected/book.018.html @@ -0,0 +1,2 @@ +Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

The folowing figure should be printed in landscape orientation

A duck in its full beauty

This is a regular paragraph below the figure, it shoud be in portrait orientation.

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/xml/article.016.xml b/src/test/resources/xml/article.016.xml new file mode 100644 index 0000000000..e584a9c009 --- /dev/null +++ b/src/test/resources/xml/article.016.xml @@ -0,0 +1,6 @@ + +
+ + Unit Test: article.016 + Content in landscape orientation (for PDF) +
diff --git a/src/test/resources/xml/book.014.xml b/src/test/resources/xml/book.014.xml new file mode 100644 index 0000000000..6f3774d999 --- /dev/null +++ b/src/test/resources/xml/book.014.xml @@ -0,0 +1,47 @@ + + + + + Fun with landscape orientation + + A series of book unit test that checks landscape orientation. + + + + + Purpose of this Book + This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal. + The whole book should be printed in landscape orientation + + + + + + + This is a very wide column (120mm) + The second column is also wide (80mm) + + + + + The caption for ths table should be printed in the same orientation as the table itself. + + + This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book + + + + Second Chapter + The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation. + + + + + diff --git a/src/test/resources/xml/book.015.xml b/src/test/resources/xml/book.015.xml new file mode 100644 index 0000000000..36054795c0 --- /dev/null +++ b/src/test/resources/xml/book.015.xml @@ -0,0 +1,47 @@ + + + + Fun with landscape orientation + + A series of book unit test that checks landscape orientation. + + + + + + Purpose of this Book + This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal. + Only this chapter should be printed in landscape orientation + + + + + + + This is a very wide column (120mm) + The second column is also wide (80mm) + + + + + The caption for ths table should be printed in the same orientation as the table itself. + + + This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book + + + + Second Chapter + The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation. + + + + + diff --git a/src/test/resources/xml/book.016.xml b/src/test/resources/xml/book.016.xml new file mode 100644 index 0000000000..78adb321fd --- /dev/null +++ b/src/test/resources/xml/book.016.xml @@ -0,0 +1,48 @@ + + + + Fun with landscape orientation + + A series of book unit test that checks landscape orientation. + + + + + + Purpose of this Book + This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal. + Only this table with it's caption should be printed in landscape orientation + + + + + + + + This is a very wide column (120mm) + The second column is also wide (80mm) + + + + + The caption for ths table should be printed in the same orientation as the table itself. + + + This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book + + + + Second Chapter + The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation. + + + + + diff --git a/src/test/resources/xml/book.017.xml b/src/test/resources/xml/book.017.xml new file mode 100644 index 0000000000..a3016aa867 --- /dev/null +++ b/src/test/resources/xml/book.017.xml @@ -0,0 +1,47 @@ + + + + Fun with landscape orientation + + A series of book unit test that checks landscape orientation. + + + +
+ + Purpose of this Book + This book contains a table with two wide columns. + The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). + This is why it is printed in landscape orientation in PDF output. + But as always, there are different ways to achieve this goal. + This article should be printed in landscape orientation + + + + + + + This is a very wide column (120mm) + The second column is also wide (80mm) + + + + + The caption for ths table should be printed in the same orientation as the table itself. + + + This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book +
+ +
+ Second Chapter + The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation. +
+ + + +
diff --git a/src/test/resources/xml/book.018.xml b/src/test/resources/xml/book.018.xml new file mode 100644 index 0000000000..80880e8219 --- /dev/null +++ b/src/test/resources/xml/book.018.xml @@ -0,0 +1,36 @@ + + + + Fun with landscape orientation + + A series of book unit test that checks landscape orientation. + + + + + Purpose of this Book + + The folowing figure should be printed in landscape orientation + + + + + + + A duck in its full beauty + + + This is a regular paragraph below the figure, it shoud be in portrait orientation. + + + + Second Chapter + The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + it's only purpuse is to show the effect of PDF pages in landscape orientation. + + + + + From 4e3a02d78365fc21fde503f2fd7c32105bdd13fa Mon Sep 17 00:00:00 2001 From: Frank Steimke Date: Fri, 23 Feb 2024 10:51:38 +0100 Subject: [PATCH 2/5] Change landscape support mechanism from PI to role attribute --- src/guide/xml/ch02.xml | 42 ++++++++++++++++------- src/main/xslt/modules/attributes.xsl | 14 ++++---- src/test/resources/expected/book.015.html | 2 +- src/test/resources/expected/book.016.html | 10 ++++-- src/test/resources/expected/book.017.html | 2 +- src/test/resources/expected/book.018.html | 2 +- src/test/resources/xml/article.016.xml | 3 +- src/test/resources/xml/book.014.xml | 3 +- src/test/resources/xml/book.015.xml | 5 ++- src/test/resources/xml/book.016.xml | 37 ++++++++++++++++---- src/test/resources/xml/book.017.xml | 5 ++- src/test/resources/xml/book.018.xml | 5 ++- 12 files changed, 86 insertions(+), 44 deletions(-) diff --git a/src/guide/xml/ch02.xml b/src/guide/xml/ch02.xml index cf1de8d916..8563e5957f 100755 --- a/src/guide/xml/ch02.xml +++ b/src/guide/xml/ch02.xml @@ -896,10 +896,6 @@ purpose: -In addition, the stylesheets support profiling on several common attributes -that are not explicitly for effectivity: xml:lang, revisionflag, -and role. - DocBook places no constraints on the values used for effectivity and the stylesheets don’t either. You’re free to use “cat” and “dog” @@ -949,6 +945,22 @@ some common text. Options are introduced with the That is unlikely to work well. + +
+Other common Attributes +In addition, the stylesheets support profiling on several common attributes +that are not explicitly for effectivity: xml:lang, revisionflag, +and role. + + + The role Attribute is multivalued +Please note that the stylesheets treat the role attribute as +multivalued, similar to the class attribute in HTML. It +may contain a sequence of tokens, seperated by whitespace. This allows you, for example, +to classify a section as informal which should be printed in +landscape orientation with the following value for it's role +attribute: role='informal landscape'. +
@@ -1484,13 +1496,20 @@ presentation, in the printed version. The resulting HTML document can be formatted directly with a CSS paged-media formatter. - Landscape orientation in print output - The default orientation for pages in print output is portrait. You can switch it to - landscape orientation with the <?landscape> processing instruction. This may - apply to the whole book or article, or to individual chapter, - section or appendix elements. You can also print individual tables or - figures in landscape, if they are to wide for portrait pages. - + +Landscape orientation in print output +The default orientation for pages in print output is portrait. You can switch it to +landscape orientation with landscape as a token within the +role attribute + +See the note about the multivalued role Attribute in . +. +This may apply to the whole book or +article, or to individual chapter, section or +appendix elements. You can also print individual tables or figures in landscape, +if they are to wide for portrait pages. For tables, you should use the orient attribute with the value land, +because it is provided precisely for this purpose. +However, in the interests of a uniform solution, the role attribute with the value landscape can also be used
@@ -1641,4 +1660,3 @@ has a background color.
- diff --git a/src/main/xslt/modules/attributes.xsl b/src/main/xslt/modules/attributes.xsl index cae4b17386..9d7c1b46f5 100644 --- a/src/main/xslt/modules/attributes.xsl +++ b/src/main/xslt/modules/attributes.xsl @@ -30,7 +30,7 @@ - + @@ -53,7 +53,7 @@ - + @@ -72,7 +72,7 @@ - + @@ -93,7 +93,7 @@ (I'm not sure that matters, but ...) --> - + @@ -202,7 +202,7 @@ - + @@ -236,7 +236,7 @@ - + @@ -364,7 +364,7 @@ - + diff --git a/src/test/resources/expected/book.015.html b/src/test/resources/expected/book.015.html index 41f67c4dfb..f44bce0605 100644 --- a/src/test/resources/expected/book.015.html +++ b/src/test/resources/expected/book.015.html @@ -1,4 +1,4 @@ -Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. +More fun with landscape orientation

More fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). This is why it is printed in landscape orientation in PDF output. But as always, there are different ways to achieve this goal.

Only this chapter should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. diff --git a/src/test/resources/expected/book.016.html b/src/test/resources/expected/book.016.html index 6550aaffa5..2b33c02696 100644 --- a/src/test/resources/expected/book.016.html +++ b/src/test/resources/expected/book.016.html @@ -1,6 +1,10 @@ -Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. +Still more fun with landscape orientation

Still more fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

This book contains a table with two wide columns. The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). This is why it is printed in landscape orientation in PDF output. - But as always, there are different ways to achieve this goal.

Only this table with it's caption should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. - It has nothing to say, but will show the orientation within the firts chapter of this book

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, + But as always, there are different ways to achieve this goal.

This table with it's caption should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

+

We use the table's orient Attribute

+

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. + It has nothing to say, but will show the orientation within the firts chapter of this book

This is a very wide column (120mm)

The second column is also wide (80mm)

+

We use the table's role Attribute

+

The caption for ths table should be printed in the same orientation as the table itself.

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/expected/book.017.html b/src/test/resources/expected/book.017.html index 073f2dc8d8..5a51283b05 100644 --- a/src/test/resources/expected/book.017.html +++ b/src/test/resources/expected/book.017.html @@ -1,4 +1,4 @@ -Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Purpose of this Book

This book contains a table with two wide columns. +Landscape orientation, revisited

Landscape orientation, revisited

A series of book unit test that checks landscape orientation.

Purpose of this Book

This book contains a table with two wide columns. The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). This is why it is printed in landscape orientation in PDF output. But as always, there are different ways to achieve this goal.

This article should be printed in landscape orientation

This is a very wide column (120mm)

The second column is also wide (80mm)

The caption for ths table should be printed in the same orientation as the table itself.

This is a regular para below the very wide table. diff --git a/src/test/resources/expected/book.018.html b/src/test/resources/expected/book.018.html index 04a72b9e14..384a0c8f3a 100644 --- a/src/test/resources/expected/book.018.html +++ b/src/test/resources/expected/book.018.html @@ -1,2 +1,2 @@ -Fun with landscape orientation

Fun with landscape orientation

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

The folowing figure should be printed in landscape orientation

A duck in its full beauty

This is a regular paragraph below the figure, it shoud be in portrait orientation.

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, +Fun with landscape orientend graphics

Fun with landscape orientend graphics

A series of book unit test that checks landscape orientation.

Chapter 1Purpose of this Book

The folowing figure should be printed in landscape orientation

A duck in its full beauty

This is a regular paragraph below the figure, it shoud be in portrait orientation.

Chapter 2Second Chapter

The second chapter will end this book, which is very short indeed. It does not tell us anything about the outside world, it's only purpuse is to show the effect of PDF pages in landscape orientation.

\ No newline at end of file diff --git a/src/test/resources/xml/article.016.xml b/src/test/resources/xml/article.016.xml index e584a9c009..4de3f18018 100644 --- a/src/test/resources/xml/article.016.xml +++ b/src/test/resources/xml/article.016.xml @@ -1,6 +1,5 @@ -
- +
Unit Test: article.016 Content in landscape orientation (for PDF)
diff --git a/src/test/resources/xml/book.014.xml b/src/test/resources/xml/book.014.xml index 6f3774d999..f93cc81e0f 100644 --- a/src/test/resources/xml/book.014.xml +++ b/src/test/resources/xml/book.014.xml @@ -1,8 +1,7 @@ - + version="5.0" xml:id="book" role="landscape"> Fun with landscape orientation diff --git a/src/test/resources/xml/book.015.xml b/src/test/resources/xml/book.015.xml index 36054795c0..8f463b8171 100644 --- a/src/test/resources/xml/book.015.xml +++ b/src/test/resources/xml/book.015.xml @@ -3,14 +3,13 @@ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="book"> - Fun with landscape orientation + More fun with landscape orientation A series of book unit test that checks landscape orientation. - - + Purpose of this Book This book contains a table with two wide columns. The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). diff --git a/src/test/resources/xml/book.016.xml b/src/test/resources/xml/book.016.xml index 78adb321fd..d3e19b0ac5 100644 --- a/src/test/resources/xml/book.016.xml +++ b/src/test/resources/xml/book.016.xml @@ -3,7 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="book"> - Fun with landscape orientation + Still more fun with landscape orientation A series of book unit test that checks landscape orientation. @@ -16,17 +16,21 @@ The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). This is why it is printed in landscape orientation in PDF output. But as always, there are different ways to achieve this goal. - Only this table with it's caption should be printed in landscape orientation - - + This table with it's caption should be printed in landscape orientation + - - + + This is a very wide column (120mm) The second column is also wide (80mm) + + + We use the table's orient Attribute + + @@ -35,6 +39,27 @@ This is a regular para below the very wide table. It has nothing to say, but will show the orientation within the firts chapter of this book + + + + + + + + This is a very wide column (120mm) + The second column is also wide (80mm) + + + + We use the table's role Attribute + + + + + + The caption for ths table should be printed in the same orientation as the table itself. + + diff --git a/src/test/resources/xml/book.017.xml b/src/test/resources/xml/book.017.xml index a3016aa867..dc1febe48a 100644 --- a/src/test/resources/xml/book.017.xml +++ b/src/test/resources/xml/book.017.xml @@ -3,14 +3,13 @@ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="book"> - Fun with landscape orientation + Landscape orientation, revisited A series of book unit test that checks landscape orientation. -
- +
Purpose of this Book This book contains a table with two wide columns. The table won't fit on a regular, portrait-oriented page which is about 160 or 170mm wide (assuming A$ paper size). diff --git a/src/test/resources/xml/book.018.xml b/src/test/resources/xml/book.018.xml index 80880e8219..be5f8e904f 100644 --- a/src/test/resources/xml/book.018.xml +++ b/src/test/resources/xml/book.018.xml @@ -3,7 +3,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="book"> - Fun with landscape orientation + Fun with landscape orientend graphics A series of book unit test that checks landscape orientation. @@ -13,8 +13,7 @@ Purpose of this Book The folowing figure should be printed in landscape orientation - - + From c8b8fa6b98d92b1c4166525873567464aeeca017 Mon Sep 17 00:00:00 2001 From: Frank Steimke Date: Fri, 23 Feb 2024 12:33:38 +0100 Subject: [PATCH 3/5] Minor changes in Reference Guide Chapter 2 --- src/guide/xml/ch02.xml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/guide/xml/ch02.xml b/src/guide/xml/ch02.xml index 8563e5957f..6c228439e3 100755 --- a/src/guide/xml/ch02.xml +++ b/src/guide/xml/ch02.xml @@ -1496,9 +1496,11 @@ presentation, in the printed version. The resulting HTML document can be formatted directly with a CSS paged-media formatter. - -Landscape orientation in print output -The default orientation for pages in print output is portrait. You can switch it to +
+ +
+Landscape orientation in print output +The default orientation for pages in print output is portrait. You can switch to landscape orientation with landscape as a token within the role attribute @@ -1507,9 +1509,14 @@ landscape orientation with landscape as a token within the This may apply to the whole book or article, or to individual chapter, section or appendix elements. You can also print individual tables or figures in landscape, -if they are to wide for portrait pages. For tables, you should use the orient attribute with the value land, -because it is provided precisely for this purpose. -However, in the interests of a uniform solution, the role attribute with the value landscape can also be used +if they are to wide for portrait pages. For wide tables, you should use the orient attribute with the value land, +because it is provided precisely for this purpose. +However, in the interests of a uniform solution, the role attribute with the value landscape can also be used for tables. + +For legacy reasons, the landscapeFigure processing instruction from the XSLT 1.0 stylesheets is also supported for figure and +informalfigure elements, as described +in Chapter 18 of Bob Staytons Complete Guide. +
From 6e4e0c05f9a26a11a85822dbaa35728f42b177c2 Mon Sep 17 00:00:00 2001 From: Norman Walsh Date: Wed, 7 Feb 2024 08:28:02 +0000 Subject: [PATCH 4/5] Support panelset presentation; tinker with CSS in various places --- src/guide/resources/css/guide.css | 10 +-- src/guide/xml/ref-params.xml | 51 +++++++++++++ src/main/scss/media-all.scss | 3 +- src/main/scss/media-paged.scss | 10 +++ src/main/scss/media-screen.scss | 52 +++++++++++++ src/main/xslt/docbook-paged.xsl | 1 + src/main/xslt/modules/lists.xsl | 28 +++++++ src/test/resources/expected/panelset.001.html | 39 ++++++++++ src/test/resources/xml/panelset.001.xml | 73 +++++++++++++++++++ 9 files changed, 257 insertions(+), 10 deletions(-) create mode 100644 src/test/resources/expected/panelset.001.html create mode 100644 src/test/resources/xml/panelset.001.xml diff --git a/src/guide/resources/css/guide.css b/src/guide/resources/css/guide.css index f2c0046718..16f468fb8b 100644 --- a/src/guide/resources/css/guide.css +++ b/src/guide/resources/css/guide.css @@ -40,7 +40,7 @@ h2 { .a-detail { width: 100%; - font-size: 11pt; + font-size: 0.85rem; display: table; border: 1px solid #afafaf; } @@ -176,14 +176,6 @@ span.obsolete { text-decoration: line-through; } -@page landscape { - size: landscape; -} - -.landscape { - page: landscape; -} - .admonition { break-inside: avoid; } diff --git a/src/guide/xml/ref-params.xml b/src/guide/xml/ref-params.xml index 36f59cd0ae..ecf67aa068 100644 --- a/src/guide/xml/ref-params.xml +++ b/src/guide/xml/ref-params.xml @@ -5699,4 +5699,55 @@ be disabled by setting the parameter to “false”. + + + + xs:string + variablelist-panelset + 'true' + + 2.2.1 + + + Enable the “panelset” rendering for variable lists? + + +Description + +If this parameter is true, a “panel set” rendering +may be selected for variablelist elements by placing panelset +in its role attribute. In interactive presentations, these +render as selectable, alternative “panels”. In other presentations, they render as a +normal list. + + + +Why + +Panels are often used to show equivalent code samples in different +languages (Groovy or Kotlin, JavaScript or TypeScript) or different +versions of a language (Python 2.x or Python 3.x). + + + + +What + +The actual content of the individual panels is constrainted only by +the content model of listitem in variablelist. + + + + +How + +With the panelset role attribute value. But note that in print +output, this option is false by default. + + + + + + + diff --git a/src/main/scss/media-all.scss b/src/main/scss/media-all.scss index 873e14e51e..bd67bf7341 100644 --- a/src/main/scss/media-all.scss +++ b/src/main/scss/media-all.scss @@ -17,6 +17,7 @@ --hovered-color: rgb(235,235,235); --focused-color: rgb(221,221,221); --modal-overlay-color: rgba(255,255,255,0.85); + --panelset-color: #fafaf0; --border-color: var(--primary-color); @@ -316,7 +317,7 @@ pre code, border: none; background-color: inherit; padding: 0; - font-size: inherit; + font-size: 0.85rem; /* code = 85% */ margin: 0; } diff --git a/src/main/scss/media-paged.scss b/src/main/scss/media-paged.scss index d44ad252c1..b39dd74631 100644 --- a/src/main/scss/media-paged.scss +++ b/src/main/scss/media-paged.scss @@ -194,3 +194,13 @@ span.footnote p { padding-top: 0; margin-top: 0; } + +/* ============================================================ */ + +@page landscape { + size: landscape; +} + +.landscape { + page: landscape; +} diff --git a/src/main/scss/media-screen.scss b/src/main/scss/media-screen.scss index 6e6cbaafd6..03ade7952e 100644 --- a/src/main/scss/media-screen.scss +++ b/src/main/scss/media-screen.scss @@ -389,6 +389,58 @@ nav.top div { border-radius: 4px; } +/* ============================================================ */ +/* Panel sets */ +/* Based on https://codepen.io/alvarotrigo/pen/RwLzvQz by Álvaro */ + +.panelset { + display: flex; + flex-wrap: wrap; +} + +.panelset label { + order: 1; + display: block; + padding: 1rem 2rem; + margin-right: 0.2rem; + cursor: pointer; + transition: background ease 0.2s; + border-top-left-radius: 0.5em; + border-top-right-radius: 0.5em; + color: var(--primary-color); +} + +.panelset .paneltab { + order: 99; /* Put the tabs last */ + flex-grow: 1; + width: 100%; + display: none; + padding: 1rem; + border-top: 1px solid var(--focused-color); + background-color: var(--panelset-color); +} + +.panelset input[type="radio"] { + display: none; +} + +.panelset input[type="radio"]:checked + label { + border-bottom: 2px solid var(--focused-color); + background-color: var(--panelset-color); + color: var(--on-background-color); +} + +.panelset label:hover { + border-top: 2px solid var(--focused-color); + border-bottom: 2px solid var(--focused-color); + color: var(--on-background-color); + border-radius: 0; +} + +.panelset input[type="radio"]:checked + label + .paneltab { + display: block; +} + /* ============================================================ */ @media screen and (max-width: 1199px) { diff --git a/src/main/xslt/docbook-paged.xsl b/src/main/xslt/docbook-paged.xsl index d1a6ed0a7b..7342d0c73f 100644 --- a/src/main/xslt/docbook-paged.xsl +++ b/src/main/xslt/docbook-paged.xsl @@ -19,6 +19,7 @@ + diff --git a/src/main/xslt/modules/lists.xsl b/src/main/xslt/modules/lists.xsl index 7b60861f52..ef402716ea 100644 --- a/src/main/xslt/modules/lists.xsl +++ b/src/main/xslt/modules/lists.xsl @@ -355,6 +355,34 @@ + +
+ + + +
+ + + + + + + + + +
+ +
+
+
+
+
+ + + diff --git a/src/test/resources/expected/panelset.001.html b/src/test/resources/expected/panelset.001.html new file mode 100644 index 0000000000..491803f61c --- /dev/null +++ b/src/test/resources/expected/panelset.001.html @@ -0,0 +1,39 @@ +Unit Test: panelset.001

Unit Test: panelset.001

This unit test is an experiment in providing a “panel set” presentation +for a variable list.

 1 |#!/usr/bin/env python3
+   | 
+   |"""This is a wrapper script around the Saxon command line interface.
+   |It attempts to make sure that the classpath is correct and that third
+ 5 |party and other libraries are available."""
+   | 
+   |import os
+   |import sys
+   |import json
+10 |import shutil
+   |import subprocess
+   |from pathlib import Path
+   |from xml.dom.minidom import parse, Node
+   | 
+15 | 
+   |class JavaClassRunnerException(Exception):
+   |    """Subclass of Exception for errors raised by the runner."""
+

And so on, for another 600 lines or so.

 1 |#!/usr/bin/env python3
+   | 
+   |"""This is yet another link checker. Was it better to write my own
+   |than find an existing cross-platform version? Maybe not, but it
+ 5 |appeared to be easier."""
+   | 
+   |import re
+   |import os
+   |import sys
+10 |import json
+   |import glob
+   |import click
+   |try:
+   |    import html5_parser
+15 |    import lxml.etree
+   |    from saxonche import PySaxonProcessor
+   |    importOk = True
+   |except ImportError:
+   |    importOk = False
+

And so on for another 150 lines or so.

More things.

Note

The content of an individual panel is just ordinary + DocBook listitem content.

\ No newline at end of file diff --git a/src/test/resources/xml/panelset.001.xml b/src/test/resources/xml/panelset.001.xml new file mode 100644 index 0000000000..7574ea09bd --- /dev/null +++ b/src/test/resources/xml/panelset.001.xml @@ -0,0 +1,73 @@ + +
+ +Unit Test: panelset.001 + + +This unit test is an experiment in providing a “panel set” presentation +for a variable list. + + + + docbook.py + + #!/usr/bin/env python3 + +"""This is a wrapper script around the Saxon command line interface. +It attempts to make sure that the classpath is correct and that third +party and other libraries are available.""" + +import os +import sys +import json +import shutil +import subprocess +from pathlib import Path +from xml.dom.minidom import parse, Node + + +class JavaClassRunnerException(Exception): + """Subclass of Exception for errors raised by the runner.""" + +And so on, for another 600 lines or so. + + + + linkcheck.py + + #!/usr/bin/env python3 + +"""This is yet another link checker. Was it better to write my own +than find an existing cross-platform version? Maybe not, but it +appeared to be easier.""" + +import re +import os +import sys +import json +import glob +import click +try: + import html5_parser + import lxml.etree + from saxonche import PySaxonProcessor + importOk = True +except ImportError: + importOk = False + + +And so on for another 150 lines or so. + + + + Something else + + More things. + The content of an individual panel is just ordinary + DocBook listitem content. + + + + +
From ce8a3b77376d71092a21be6f2e29e174b3f2d69a Mon Sep 17 00:00:00 2001 From: Frank Steimke Date: Sun, 17 Mar 2024 07:53:45 +0100 Subject: [PATCH 5/5] A new hint about preprocessing pipeline for modular DocBook --- src/guide/xml/ch04.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/guide/xml/ch04.xml b/src/guide/xml/ch04.xml index 3dcb7bc161..8de93a3af6 100644 --- a/src/guide/xml/ch04.xml +++ b/src/guide/xml/ch04.xml @@ -610,6 +610,13 @@ attribute to the root element (if it doesn’t already have one). If it isn’t preserved, relative references to other documents will be resolved against the static base URI of the stylesheet and not the URI of the original document. That’s unlikely to be correct. +You must also take into account that no XInclude processing has taken place at this time. +If you are using modular DocBook, the transform-original pipeline is usually a bad choice, +because it only operates on the root document, but not on the fragments referenced by XInclude. +If it is absolutely necessary to use a transform-original pipeline together with modular DocBook, +you can use Saxons -x switch to enable XInclude when parsing the document (see ). +Otherwise, however, the transform-before pipeline is usually the better choice +for modular DocBook documentsModular DocBookprocessing pipelines.