From 055a955df3fa1fa77b3e962f3a136f5e364abb20 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Wed, 29 Aug 2007 12:56:27 +0000 Subject: 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 --- src/guile/skribilo/engine/lout.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') 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"))))) ;*---------------------------------------------------------------------*/ -- cgit v1.2.3