{"id":6909,"date":"2014-03-05T07:22:01","date_gmt":"2014-03-05T07:22:01","guid":{"rendered":"http:\/\/mcslp.wordpress.com\/?p=10018"},"modified":"2014-03-05T07:22:01","modified_gmt":"2014-03-05T07:22:01","slug":"customizing-chunking-in-docbook","status":"publish","type":"post","link":"https:\/\/planet.mcb.guru\/?p=6909","title":{"rendered":"Customizing Chunking in DocBook"},"content":{"rendered":"<p>I love DocBook XML. No, really. But one thing I hate is the way you have to set a global chunking level for your HTML and then live with it. For most documentation, you want to be able to choose whether a conveniently addressable section within a chapter, and then you want to combine it into one page to make it easier to read.<\/p>\n<p>For example, consider <a href=\"http:\/\/docs.continuent.com\/tungsten-replicator-3.0\/deployment-hadoop-preparation.html#deployment-hadoop-preparation-schema\">this page<\/a> in the Continuent docs. Technically it&#8217;s high enough (I use a default chunking depth of 4) to be chunked, but I want the subsections on one page to make it easier to read.<\/p>\n<p>Custom chunking in DocBook is clunky, so here&#8217;s an alternative.<\/p>\n<p>Create a custom copy of your html.online.chunk-common.xsl.<\/p>\n<p>Find the main chunk template definition (around line 996).<\/p>\n<p>Add these two lines to the &lt;xsl:choose&gt; block:<\/p>\n<pre>&lt;xsl:when test=\"$node[@condition='nochunk']\"&gt;0&lt;\/xsl:when&gt;\r\n&lt;xsl:when test=\"$node[@condition='forcechunk']\"&gt;1&lt;\/xsl:when&gt;<\/pre>\n<p><span style=\"line-height:1.5;\">These two overwrite the implied chunking decision based on object type or depth.\u00a0<\/span><\/p>\n<p>Now in your Docbook XML you can choose whether an item should be chunked or not by adding a condition attribute to your section. To chunk it:<\/p>\n<pre>&lt;section id=\"chunkme\" condition=\"forcechunk\"&gt;...&lt;\/section&gt;<\/pre>\n<p>To prevent a section from being chunked:<\/p>\n<pre>&lt;section id=\"dontchunkme\" condition=\"nochunk\"&gt;...&lt;\/section&gt;<\/pre><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/mcslp.wordpress.com\/10018\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/mcslp.wordpress.com\/10018\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=mcslp.wordpress.com&#038;blog=164882&%23038;post=10018&%23038;subd=mcslp&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>I love DocBook XML. No, really. But one thing I hate is the way you have to set a global chunking level for your HTML and then live with it. For most documentation, you want to be able to choose &hellip; <a href=\"https:\/\/mcslp.wordpress.com\/2014\/03\/05\/customizing-chunking-in-docbook\/\">Continue reading <span>&rarr;<\/span><\/a><img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=mcslp.wordpress.com&amp;blog=164882&amp;post=10018&amp;subd=mcslp&amp;ref=&amp;feed=1\" width=\"1\" height=\"1\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92,70,93,94,95],"tags":[],"_links":{"self":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/6909"}],"collection":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6909"}],"version-history":[{"count":5,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/6909\/revisions"}],"predecessor-version":[{"id":6979,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=\/wp\/v2\/posts\/6909\/revisions\/6979"}],"wp:attachment":[{"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planet.mcb.guru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}