summary refs log tree commit diff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtès2012-05-26 16:36:56 +0200
committerLudovic Courtès2012-05-27 23:03:49 +0200
commit3f0c581adcdb9928eaaf3f086fdc893301412c95 (patch)
tree8495fe24a46a1b3645a42ad44a5c6c7dd8748856 /src/guile
parent5b7399b25db01fccbe4657ae6d7154a30bc0c000 (diff)
downloadskribilo-3f0c581adcdb9928eaaf3f086fdc893301412c95.tar.gz
skribilo-3f0c581adcdb9928eaaf3f086fdc893301412c95.tar.lz
skribilo-3f0c581adcdb9928eaaf3f086fdc893301412c95.zip
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.
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/engine/info.scm43
1 files 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,41 +471,14 @@
               (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 ...                                           */
 ;*---------------------------------------------------------------------*/
 (markup-writer 'bib-ref info-engine