changeset 81:5fb821ed6f3c

style: Refactoring and more comments
author markus schnalke <meillo@marmaro.de>
date Wed, 06 Jun 2012 14:53:16 +0200
parents be3e09c2181e
children ff4537327162
files style
diffstat 1 files changed, 70 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/style	Wed Jun 06 11:27:25 2012 +0200
+++ b/style	Wed Jun 06 14:53:16 2012 +0200
@@ -51,13 +51,15 @@
 .nr LT \n(LL
 .if t .nr PO 3.3c
 
-.de _M  \" change margins for text block on next page
+.	\" _M - change margins for text block on next page
+.de _M
 .if t .if o .nr PO +(21c-\n(.lu-(2u*3.3c))c
 .if t .if e .nr PO -(21c-\n(.lu-(2u*3.3c))c
 .ds CF "
 ..
 .wh -1u _M
 
+.	\" CW - Set text in CW font (similar to .B and .I)
 .de CW
 .nr PQ \\n(.f
 .if t \{\
@@ -73,6 +75,7 @@
 .\}
 ..
 
+.	\" refer(1) stuff
 .ds [. " [
 .ds .] ]
 .rm ]<
@@ -84,16 +87,31 @@
 .	rm FS FE
 ..
 
+.	\" PT - page top macro of ms
 .am PT
 .	rs
 ..
 
-.de T_  \" add entry to TOC: .T_ pre-space indent-level text
+
+.	\" RN - Reset PN and continue on an odd page ($1=number-format)
+.de RN
+.ie e .pn 1
+.el \{
+.       pn 0
+.       bp
+.\}
+.ie \\n(.$=1 .af PN \\$1
+.el .af PN 1
+..
+
+
+.	\" T_ - Add TOC entry ($1=pre-space $2=indent-level $3=text)
+.de T_
 .tm TOC____.sp \\$1
 .tm TOC____\&\\h'\\$2u*2u*\\n(PIu'\\$3\0\0\a\t\\n(PN\fR
 ..
 
-.rm NH
+.	\" NH - redefine numbered heading
 .de NH
 .SH
 .nr NS \\$1
@@ -107,11 +125,12 @@
 .if \\n(NS>2 .as SN \&.\\n(H3
 ..
 
+.	\" H- - Chapter unnumbered and not in TOC ($2=="no" -> no page hdrs)
 .de H-
 .EH "
 .OH "
 .bp
-.rs
+.if e .rs  \" move to an odd page
 .if e .bp
 .lg 0
 .nr PS +6
@@ -125,113 +144,103 @@
 .nr PS -6
 .nr VS -6
 .lg
-.RT
 .if !,\\$2,no, \{
 .	EH "\\\\*(_E
 .	ie \\n(H1 .OH "\\\\*(_O
 .	el .OH "\\\\*(_o
 .	ds CF \\n(PN
 .\}
+.RT
 .sp 4
 .nr PP 0
 ..
 
+.	\" H0 - Chapter ($2=="no" -> not numbered)
 .de H0
 .EH "
 .OH "
 .bp
-.rs
+.if e .rs  \" begin chapter on an odd page
 .if e .bp
-.	lg 0
-.	nr PS +6
-.	nr VS +6
-.ie \\n(.$=1 \{\
+.lg 0
+.nr PS +6
+.nr VS +6
+.ie ,\\$2,no, .SH
+.el \{\
 .	NH 1
 .	ce 1
 Chapter \\*(SN
 .	sp .5
 .\}
-.el .if ,\\$2,no, .SH
-.	ce 1
-.	tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+.ce 1
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
 \&\\$1
-.	br
-.	tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
-.	nr PS -6
-.	nr VS -6
-.	lg
-.ds _C "\\$1
-.	RT
+.br
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+.nr PS -6
+.nr VS -6
+.lg
+.\" add to TOC
 .rm t_
 .if !,\\$2,no, .ds t_ \\*(SN\0\0
 .T_ .5v 0 "\fB\\*(t_\\$1
+.\" set page headers and footers
 .EH "\\\\*(_E
+.ds _C "\\$1
 .ie \\n(H1 .OH "\\\\*(_O
 .el .OH "\\\\*(_o
 .ds CF \\n(PN
+.RT
 .sp 4
 .nr PP 0
 ..
 
 
-.\" Reset page Numbers, set page number format ($1) and move to a right page.
-.de RN
-.ie e .pn 1
-.el \{
-.       pn 0
-.       bp
-.\}
-.ie \\n(.$=1 .af PN \\$1
-.el .af PN 1
-..
-
-
+.	\" H1 - Section ($2=="no" -> not numbered)
 .de H1
 .br
 .ne 7
 .sp
-.	nr PS +2
-.	nr VS +2
-.if '\\$2'no' .SH
-.if \\n(.$=1 .NH 2
-.	lg 0
-.	tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+.lg 0
+.nr PS +2
+.nr VS +2
+.ie '\\$2'no' .SH
+.el .NH 2
 .if !'\\$2'no' \&\\*(SN
-\\$1
-.	br
-.	tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
-.	nr PS -2
-.	nr VS -2
-.	lg
-.	RT
-.if !'\\$2'no' \{\
-.	ds _S "\\$1
-.	T_ .3v 1 "\\*(SN\0\0\\$1
-.\}
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\&\\$1
+.br
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+.nr PS -2
+.nr VS -2
+.lg
+.if !'\\$2'no' .T_ .3v 1 "\\*(SN\0\0\\$1  \" add to TOC
+.RT
 .nr PP 0
 ..
 
+.	\" H2 - Subsection
 .de H2
 .br
 .ne 4
 .NH 3
-\&\\*(SN
-\\$1
+\&\\*(SN \\$1
+.T_ 0 2 "\\*(SN\0\0\\$1  \" add to TOC
 .RT
-.ds _S "\\$1
-.T_ 0 2 "\\*(SN\0\0\\$1
 .nr PP 0
 ..
 
+.	\" U2 - Subsection unnumbered
 .de U2
 .br
 .ne 4
 .SH
-\\$1
+\&\\$1
 .RT
 .nr PP 0
 ..
 
+.	\" U3 - Subsubsection unnumbered
 .de U3
 .br
 .ne 4
@@ -242,30 +251,36 @@
 .nr PP 0
 ..
 
+.	\" P - Paragraph (indented unless following a heading)
 .de P
 .ie \\n(PP .PP
 .el .LP
 .nr PP 1
 ..
 
+.	\" IP - Paragraph with hanging label
 .am IP
 .nr PP 0
 ..
 
+.	\" BU - Bulleted paragraph
 .de BU
 .IP \(bu
 ..
 
+.	\" QP - Block quote paragraph
 .am QP
 .ps -1
 ..
 
+.	\" DS - Code display
 .am DS
 .ft CW
 .ps -1
 .ta T 8n
 ..
 
+.	\" FA - XXX somehow related to footnotes?
 .am FA
 .ps 8
 .vs 9
@@ -297,7 +312,7 @@
 .CW "\\$1" "\\$2
 ..
 
-.de Ci  \" commit ref
+.de Ci  \" commit hash ref
 .ds _t \\$1
 .substring _t 0 6
 [\(rh