diff --git a/src/guide/xml/ch03.xml b/src/guide/xml/ch03.xml index c4a5ba854..4d713807b 100644 --- a/src/guide/xml/ch03.xml +++ b/src/guide/xml/ch03.xml @@ -738,12 +738,9 @@ check whether a corresponding glossentry exists for a glossterm or firstterm while you are still writing. Corresponding Schematron schemas are not yet part of the xslTNG framework. - - - Caveats - The use of glossdiv is not supported for automatic glossaries, all - of the entries will appear in a flat list. - + +Generating glossary divisions automatically is controlled by the +glossary-automatic-divisions parameter.
diff --git a/src/guide/xml/ref-params.xml b/src/guide/xml/ref-params.xml index f7efd6df7..846173224 100644 --- a/src/guide/xml/ref-params.xml +++ b/src/guide/xml/ref-params.xml @@ -2022,7 +2022,7 @@ the first term is used. glossary-sort-entries - true() + 'true' @@ -2030,7 +2030,7 @@ the first term is used. Description -If glossary-sort-entries is true, the entries in a +If glossary-sort-entries is true, the entries in a glossary or glosslist will be sorted before transformation. This saves the author from the burden of maintaining the list in a strictly alphabetic order. @@ -2038,6 +2038,41 @@ alphabetic order. + + + + glossary-automatic-divisions + 'false' + + + + Divide glossaries into sections? + + +Description +If glossary-automatic-divisions is true, +the entries in an automatically constructed glossary will be grouped. The actual grouping +is performed by the template. This parameter is +false by default for backwards compatibility. + + +Automatic divisions can be specified on a per-glossary basis with a +db processing instruction + +db processing instruction + using the glossary-divisions +db processing instruction +glossary-divisions pseudo-attribute + +pseudo-attribute with a value of true or false. + +This parameter only applies if +glossary-sort-entries is true and the glossary +is not already grouped with glossdiv elements by hand. + + + + diff --git a/src/guide/xml/ref-templates.xml b/src/guide/xml/ref-templates.xml index 7fadbb182..da040b117 100644 --- a/src/guide/xml/ref-templates.xml +++ b/src/guide/xml/ref-templates.xml @@ -665,4 +665,25 @@ element with an xlink:href attribute) and extended links. + + + +t:glossary-divisions +{http://docbook.org/ns/docbook/templates}glossary-divisions + + +t:glossary-divisions +Groups entries in a glossary +template + + +Description +If glossary-automatic-divisions is true, +this template is used to construct the divisions. By default, it makes groups based on the +(upper-case) first letter of the terms. It does not add a grouping wrapper if there’s only +one group. + + + + diff --git a/src/main/scss/media-all.scss b/src/main/scss/media-all.scss index af4f497d5..873e14e51 100644 --- a/src/main/scss/media-all.scss +++ b/src/main/scss/media-all.scss @@ -1506,11 +1506,14 @@ li[db-mark='box'] { /* ============================================================ */ - .glossdiv { margin-top: 1em; } +.glossdiv dl dt { + padding-left: 1em; +} + /* ============================================================ */ .sidebar { diff --git a/src/main/xslt/modules/glossary.xsl b/src/main/xslt/modules/glossary.xsl index 80fee8137..c59da9f32 100644 --- a/src/main/xslt/modules/glossary.xsl +++ b/src/main/xslt/modules/glossary.xsl @@ -19,27 +19,76 @@ + + + -
- - + + + + + + + + + + + + +
- - - - - -
+
+ + + + +
+ + + + + + + + + +
+
+
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+
+
+
diff --git a/src/main/xslt/transforms/50-normalize.xsl b/src/main/xslt/transforms/50-normalize.xsl index 000853e6a..c72f0efbe 100644 --- a/src/main/xslt/transforms/50-normalize.xsl +++ b/src/main/xslt/transforms/50-normalize.xsl @@ -159,14 +159,14 @@ - + - + @@ -175,7 +175,7 @@ - + diff --git a/src/test/resources/expected/glossary.001.html b/src/test/resources/expected/glossary.001.html index 2214ec751..5d4d77bae 100644 --- a/src/test/resources/expected/glossary.001.html +++ b/src/test/resources/expected/glossary.001.html @@ -42,4 +42,4 @@ flowering vine in the family Piperaceae, cultivated for its fruit, which is usually dried and used as a spice and seasoning. Long pepper has a taste similar to, but sweeter and less pungent than, that of its close relative Piper nigrum – from which black, green - and white pepper are obtained.

\ No newline at end of file + and white pepper are obtained.

\ No newline at end of file diff --git a/src/test/resources/expected/glossary.008.html b/src/test/resources/expected/glossary.008.html index 718051a46..77494cbe0 100644 --- a/src/test/resources/expected/glossary.008.html +++ b/src/test/resources/expected/glossary.008.html @@ -14,12 +14,12 @@ Quince or Bloodroot in the results document glossary, although there is an entry in the internal glossary of the input document, because there is no glossterm or firstterm that references - it.

Glossary

Apple

In early autumn the apple orchards come alive with people and sounds. The + it.

Glossary

A
Apple

In early autumn the apple orchards come alive with people and sounds. The farmers are picking, peeling, and processing apples into everything from apple pies to apple sauce. Families swarm the apple trees with their baskets looking for the best Honeycrisp and Macintosh. The sound of children playing is blended with the occasional barking dog, or the low rumble of the old Ferguson Orchard - tractor pulling a wagon up and down the rows.

Cucumber

The cucumber (Cucumis sativus) is a widely-cultivated creeping vine plant in the family + tractor pulling a wagon up and down the rows.

C
Cucumber

The cucumber (Cucumis sativus) is a widely-cultivated creeping vine plant in the family Cucurbitaceae that bears cylindrical to spherical fruits, which are used as culinary vegetables. Considered an annual plant, there are three main types of cucumber—slicing, pickling, and seedless—within which several cultivars have been created. The cucumber @@ -27,8 +27,8 @@ Guangxi), and Northern Thailand, but now grows on most continents, and many different types of cucumber are grown commercially and traded on the global market. In North America, the term wild cucumber refers to plants in the genera Echinocystis and Marah, though the two are - not closely related.

Pear

The pear tree and shrub are a species of genus + not closely related.

P
Pear

The pear tree and shrub are a species of genus Pyrus, in the family Rosaceae, bearing the pomaceous fruit of the same name. Several species of pear are valued for their edible fruit and juices while others are cultivated as - trees.

\ No newline at end of file + trees.

\ No newline at end of file diff --git a/src/test/resources/expected/titles.001.html b/src/test/resources/expected/titles.001.html index 1ed462850..faba5e9e5 100644 --- a/src/test/resources/expected/titles.001.html +++ b/src/test/resources/expected/titles.001.html @@ -35,7 +35,7 @@

Appendix AAppendix

Appendix BAppendix Two

bibliolist

[bibliomixed] a bibliomixed

-
Gloss list
Thing

Bibliography

Bibliography division

[bibliomixed2] a bibliomixed

Glossary

Glossary division
Thing

Index

O

Acknowledgements

+
Gloss list
Thing

Bibliography

Bibliography division

[bibliomixed2] a bibliomixed

Glossary

Glossary division
Thing

Index

O

Acknowledgements

Colophon

\ No newline at end of file diff --git a/src/test/resources/xml/glossary.008.xml b/src/test/resources/xml/glossary.008.xml index c4774ea92..474deda08 100644 --- a/src/test/resources/xml/glossary.008.xml +++ b/src/test/resources/xml/glossary.008.xml @@ -48,6 +48,7 @@ setting the glossary-collection parameter. it. + Quince diff --git a/src/test/resources/xml/glossary.010.xml b/src/test/resources/xml/glossary.010.xml new file mode 100644 index 000000000..ee1297cb2 --- /dev/null +++ b/src/test/resources/xml/glossary.010.xml @@ -0,0 +1,67 @@ + + + + + Unit Test: glossary.010 + + + Someone + Random + + + Wikipedia fruits with pepper + Just some test data + Wikimedia Commons + + + +Fruits and Peppers + + +The test harness is configured to run this test with the +glossary-collection parameter pointing to +src/test/resources/glosscollection.xml. + + +Peaches, +Pears, and +Peppers. + + + + + + Pepper + + Black pepper (Piper nigrum) is a flowering vine in the family Piperaceae, cultivated for + its fruit (the peppercorn), which is usually dried and used as a spice and seasoning. + Peppercorns and the ground pepper derived from them may be described simply as pepper, + or more precisely as black pepper (cooked and dried unripe fruit), + green pepper (dried unripe fruit), or white pepper + (ripe fruit seeds). + + + + + Peach + + The peach (Prunus persica) is a deciduous tree native to the + region of Northwest China between the Tarim Basin and the north + slopes of the Kunlun Mountains, where it was first domesticated + and cultivated. It bears an edible juicy fruit called a peach + or a nectarine. + + + + + Pear + + The pear tree and shrub are a species of genus + Pyrus, in the family Rosaceae, bearing the pomaceous + fruit of the same name. Several species of pear are valued for + their edible fruit and juices while others are cultivated as + trees. + + + +