From 3f0c581adcdb9928eaaf3f086fdc893301412c95 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 26 May 2012 16:36:56 +0200 Subject: info: Factorize section cross-referencing. * src/guile/skribilo/engine/info.scm (ref): Use `info-block-ref' for chapters, sections, subsections, subsubsections, and marks. (info-chapter-ref): Rename to... (info-block-ref): ... this. (info-section-ref, info-subsection-ref, info-subsubsection-ref): Remove. --- src/guile/skribilo/engine/info.scm | 43 +++++--------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm index 06916d2..6a09b1c 100644 --- a/src/guile/skribilo/engine/info.scm +++ b/src/guile/skribilo/engine/info.scm @@ -443,19 +443,13 @@ :action (lambda (n e) (let ((target (handle-ast (markup-body n)))) (case (markup-markup target) - ((chapter) - (info-chapter-ref target e)) - ((section) - (info-section-ref target e)) - ((subsection) - (info-subsection-ref target e)) - ((subsubsection) - (info-subsubsection-ref target e)) + ((chapter section subsection subsubsection) + (info-block-ref target e)) ((mark) ;; We can't refer directly to marks, so refer to the ;; enclosing section as an approximation. (let ((parent (find1-up %block? target))) - (info-chapter-ref parent e))) + (info-block-ref parent e))) (else (skribe-warning/ast 1 target "ref: don't know how to refer to target") @@ -477,40 +471,13 @@ (and text (output-justified ")"))))) ;*---------------------------------------------------------------------*/ -;* info-chapter-ref ... */ +;* info-block-ref ... */ ;*---------------------------------------------------------------------*/ -(define (info-chapter-ref obj e) +(define (info-block-ref obj e) (output-justified "*Note ") (output (block-title obj e) e) (output-justified ":: ")) -;*---------------------------------------------------------------------*/ -;* info-section-ref ... */ -;*---------------------------------------------------------------------*/ -(define (info-section-ref obj e) - (let ((title (markup-option obj :title))) - (output-justified "*Note ") - (output title e) - (output-justified ":: "))) - -;*---------------------------------------------------------------------*/ -;* info-subsection-ref ... */ -;*---------------------------------------------------------------------*/ -(define (info-subsection-ref obj e) - (let ((title (markup-option obj :title))) - (output-justified "*Note ") - (output title e) - (output-justified ":: "))) - -;*---------------------------------------------------------------------*/ -;* info-subsubsection-ref ... */ -;*---------------------------------------------------------------------*/ -(define (info-subsubsection-ref obj e) - (let ((title (markup-option obj :title))) - (output-justified "*Note ") - (output title e) - (output-justified ":: "))) - ;*---------------------------------------------------------------------*/ ;* info ::%biblio-ref ... */ ;*---------------------------------------------------------------------*/ -- cgit v1.2.3