summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLudovic Court`es2007-08-29 12:56:27 +0000
committerLudovic Court`es2007-08-29 12:56:27 +0000
commit055a955df3fa1fa77b3e962f3a136f5e364abb20 (patch)
tree276a2ab9844f8047508daa940343d3bb8442e684 /src
parent08f2474a31da503120c1f6c180767b2c68c9f498 (diff)
downloadskribilo-055a955df3fa1fa77b3e962f3a136f5e364abb20.tar.gz
skribilo-055a955df3fa1fa77b3e962f3a136f5e364abb20.tar.lz
skribilo-055a955df3fa1fa77b3e962f3a136f5e364abb20.zip
lout: Provide support for separate first-paragraph gap style.
* src/guile/skribilo/engine/lout.scm (lout-engine)[first-paragraph-gap]:
  New custom.
  (paragraph)[first-paragraph?]: New.  Use it to honor
  `first-paragraph-gap'.

git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-100
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/engine/lout.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm
index 5285c76..d2a34e2 100644
--- a/src/guile/skribilo/engine/lout.scm
+++ b/src/guile/skribilo/engine/lout.scm
@@ -630,6 +630,10 @@
 			 (paragraph-gap
 			  "\n//1.0vx @ParaIndent @Wide &{0i}\n")
 
+                         ;; Gap for the first paragraph within a container
+                         ;; (e.g., the first paragraph of a chapter).
+                         (first-paragraph-gap "\n@LP\n")
+
 			 ;; For multi-page tables, it may be
 			 ;; useful to set this to `#t'.  However,
 			 ;; this looks kind of buggy.
@@ -1528,7 +1532,18 @@
 			      (markup-markup (ast-parent n)))
 			 '(chapter section subsection subsubsection slide))))
    :before (lambda (n e)
-	     (let ((gap (engine-custom e 'paragraph-gap)))
+             (define (first-paragraph?)
+               ;; Return true if N is the first paragraph in this container.
+               (let* ((parent   (ast-parent n))
+                      (siblings (markup-body parent)))
+                 (and (pair? siblings)
+                      (eq? n (find (lambda (n)
+                                     (is-markup? n 'paragraph))
+                                   siblings)))))
+
+	     (let ((gap (if (first-paragraph?)
+                            (engine-custom e 'first-paragraph-gap)
+                            (engine-custom e 'paragraph-gap))))
 	       (display (if (string? gap) gap "\n@PP\n")))))
 
 ;*---------------------------------------------------------------------*/