Add a new tunable knob 'MIN_SECT_LABELS' and the necessary stylesheet

support.

This option prevents section labels from being numbered after the third
level.

make FORMATS=ps :

  "N.N.N Section Title"
  "N.N.N.N really specific topic"
  "N.N.N.N.N really-really specific topic"

make MIN_SECT_LABELS=1 FORMATS=ps :

  "N.N.N Section Title"
  "really specific topic"
  "really-really specific topic"

The section titles are still bold, spaced away from the text, and
sized according to their nesting level.
This commit is contained in:
Murray Stokely 2001-07-28 03:00:03 +00:00
parent 2de880b5f1
commit f9ccc49092
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=10079
2 changed files with 88 additions and 10 deletions
en_US.ISO8859-1/share/sgml
share/mk

View file

@ -1,4 +1,4 @@
<!-- $FreeBSD: doc/en_US.ISO8859-1/share/sgml/freebsd.dsl,v 1.10 2001/07/16 05:00:21 murray Exp $ -->
<!-- $FreeBSD: doc/en_US.ISO8859-1/share/sgml/freebsd.dsl,v 1.11 2001/07/20 02:53:08 murray Exp $ -->
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY freebsd.dsl PUBLIC "-//FreeBSD//DOCUMENT DocBook Language Neutral Stylesheet//EN" CDATA DSSSL>
@ -162,10 +162,76 @@
(element authorgroup
(empty-sosofo))
]]>
<!-- Print only ................................................... -->
<![ %output.print; [
(define minimal-section-labels #f)
(define max-section-level-labels
(if minimal-section-labels 3 10))
(define ($section-title$)
(let* ((sect (current-node))
(info (info-element))
(exp-children (if (node-list-empty? info)
(empty-node-list)
(expand-children (children info)
(list (normalize "bookbiblio")
(normalize "bibliomisc")
(normalize "biblioset")))))
(parent-titles (select-elements (children sect) (normalize "title")))
(info-titles (select-elements exp-children (normalize "title")))
(titles (if (node-list-empty? parent-titles)
info-titles
parent-titles))
(subtitles (select-elements exp-children (normalize "subtitle")))
(renderas (inherited-attribute-string (normalize "renderas") sect))
(hlevel ;; the apparent section level;
(if renderas ;; if not real section level,
(string->number ;; then get the apparent level
(substring renderas 4 5)) ;; from "renderas",
(SECTLEVEL))) ;; else use the real level
(hs (HSIZE (- 4 hlevel))))
(make sequence
(make paragraph
font-family-name: %title-font-family%
font-weight: (if (< hlevel 5) 'bold 'medium)
font-posture: (if (< hlevel 5) 'upright 'italic)
font-size: hs
line-spacing: (* hs %line-spacing-factor%)
space-before: (* hs %head-before-factor%)
space-after: (if (node-list-empty? subtitles)
(* hs %head-after-factor%)
0pt)
start-indent: (if (or (>= hlevel 3)
(member (gi) (list (normalize "refsynopsisdiv")
(normalize "refsect1")
(normalize "refsect2")
(normalize "refsect3"))))
%body-start-indent%
0pt)
first-line-start-indent: 0pt
quadding: %section-title-quadding%
keep-with-next?: #t
heading-level: (if %generate-heading-level% (+ hlevel 1) 0)
;; SimpleSects are never AUTO numbered...they aren't hierarchical
(if (> hlevel (- max-section-level-labels 1))
(empty-sosofo)
(if (string=? (element-label (current-node)) "")
(empty-sosofo)
(literal (element-label (current-node))
(gentext-label-title-sep (gi sect)))))
(element-title-sosofo (current-node)))
(with-mode section-title-mode
(process-node-list subtitles))
($section-info$ info))))
]]>
<!-- Both sets of stylesheets ..................................... -->
(define (local-en-label-title-sep)

View file

@ -1,5 +1,5 @@
#
# $FreeBSD: doc/share/mk/doc.docbook.mk,v 1.40 2001/07/16 15:11:54 nik Exp $
# $FreeBSD: doc/share/mk/doc.docbook.mk,v 1.41 2001/07/21 03:44:27 murray Exp $
#
# This include file <doc.docbook.mk> handles building and installing of
# DocBook documentation in the FreeBSD Documentation Project.
@ -49,11 +49,18 @@
# CSS_SHEET Full path to a CSS stylesheet suitable for DocBook.
# Default is ${DOC_PREFIX}/share/misc/docbook.css
#
# Print-output options :
#
# NICE_HEADERS If defined, customized chapter headers will be created
# that you may find more aesthetically pleasing. Note
# that this option only effects print output formats for
# Enlish language books.
#
# MIN_SECT_LABELS If defined, do not display the section number for 4th
# and 5th level section titles. This would change
# "N.N.N.N Section title" into "Section Title" while
# higher level sections are still printed with numbers.
#
# Documents should use the += format to access these.
#
@ -92,6 +99,15 @@ KNOWN_FORMATS= html html.tar html-split html-split.tar txt rtf ps pdf tex dvi ta
CSS_SHEET?= ${DOC_PREFIX}/share/misc/docbook.css
PRINTOPTS?= -ioutput.print
.if defined(NICE_HEADERS)
PRINTOPTS+= -ioutput.print.niceheaders
.endif
.if defined(MIN_SECT_LABELS)
PRINTOPTS+= -V minimal-section-labels
.endif
# ------------------------------------------------------------------------
#
# Look at ${FORMATS} and work out which documents need to be generated.
@ -271,7 +287,7 @@ ${.CURDIR:T}.pdb: ${DOC}.pdb
ln -f ${DOC}.pdb ${.CURDIR}.pdb
${DOC}.rtf: ${SRCS}
${JADE} -Vrtf-backend -ioutput.print ${JADEOPTS} -d ${DSLPRINT} -t rtf -o ${.TARGET} ${MASTERDOC}
${JADE} -Vrtf-backend ${PRINTOPTS} ${JADEOPTS} -d ${DSLPRINT} -t rtf -o ${.TARGET} ${MASTERDOC}
#
# This sucks, but there's no way round it. The PS and PDF formats need
@ -279,17 +295,13 @@ ${DOC}.rtf: ${SRCS}
# we need to create a different .tex file depending on our eventual output
# format, which will then lead on to a different .dvi file as well.
#
.if defined(NICE_HEADERS)
${DOC}.tex-ps: ${SRCS} ${IMAGES_EPS} ${INDEX_SGML} ${PRINT_INDEX}
${JADE} -Vtex-backend -ioutput.print -ioutput.print.niceheaders ${JADEOPTS} -d ${DSLPRINT} -t tex -o ${.TARGET} ${MASTERDOC}
.else
${DOC}.tex-ps: ${SRCS} ${IMAGES_EPS} ${INDEX_SGML} ${PRINT_INDEX}
${JADE} -Vtex-backend -ioutput.print ${JADEOPTS} -d ${DSLPRINT} -t tex -o ${.TARGET} ${MASTERDOC}
.endif
${JADE} -Vtex-backend ${PRINTOPTS} ${JADEOPTS} -d ${DSLPRINT} -t tex -o ${.TARGET} ${MASTERDOC}
${DOC}.tex-pdf: ${SRCS} ${IMAGES_PDF} ${INDEX_SGML} ${PRINT_INDEX}
cp ${DOC_PREFIX}/share/web2c/pdftex.def ${.TARGET}
${JADE} -Vtex-backend -ioutput.print -ioutput.print.pdf ${JADEOPTS} -d ${DSLPRINT} -t tex -o /dev/stdout ${MASTERDOC} >> ${.TARGET}
${JADE} -Vtex-backend ${PRINTOPTS} -ioutput.print.pdf ${JADEOPTS} -d ${DSLPRINT} -t tex -o /dev/stdout ${MASTERDOC} >> ${.TARGET}
${DOC}.dvi: ${DOC}.tex-ps
@echo "==> TeX pass 1/3"