summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Court`es2007-01-29 14:27:34 +0000
committerLudovic Court`es2007-01-29 14:27:34 +0000
commit93c5157e92dc3506aa2b8fd1ab7c611a5f14eb6d (patch)
treefa8eeea008acba6097292c3849cc00f48b42d045
parent308df994d13d8d4f36867b1afee0733cfc03a10b (diff)
downloadskribilo-93c5157e92dc3506aa2b8fd1ab7c611a5f14eb6d.tar.gz
skribilo-93c5157e92dc3506aa2b8fd1ab7c611a5f14eb6d.tar.lz
skribilo-93c5157e92dc3506aa2b8fd1ab7c611a5f14eb6d.zip
`latex' engine: Fixed `ref' with both `:handle' and `:text'.
* src/guile/skribilo/engine/latex.scm (ref): Fixed output of `:handle'
  refs with a `:text' option.  Use `hyperref' to produce cross-references
  with hyperlinks.

git-archimport-id: lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-10
-rw-r--r--src/guile/skribilo/engine/latex.scm27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm
index e62155a..183c822 100644
--- a/src/guile/skribilo/engine/latex.scm
+++ b/src/guile/skribilo/engine/latex.scm
@@ -1494,17 +1494,26 @@
    :action (lambda (n e)
 	      (let ((t (markup-option n :text)))
 		 (if t
-		     (begin
-			(output t e)
-			(output "~" e (markup-writer-get '~ e))))))
+                     (let* ((c (handle-ast (markup-body n)))
+                            (i (markup-ident c))
+                            (hyper? (engine-custom e 'hyperref)))
+                       (if (and hyper? i)
+                           (printf "\\hyperref[~a]{" i))
+                       (output t e)
+                       (if (and hyper? i)
+                           (printf "}"))))))
    :after (lambda (n e)
 	     (let* ((c (handle-ast (markup-body n)))
-		    (id (markup-ident c)))
-		(if (markup-option n :page)
-		    (printf "\\begin{math}{\\pageref{~a}}\\end{math}" 
-			    (string-canonicalize id))
-		    (printf "\\ref{~a}" 
-			    (string-canonicalize id))))))
+		    (id (markup-ident c))
+                    (t (markup-option n :text)))
+		(cond ((markup-option n :page)
+                       (printf "~\\begin{math}{\\pageref{~a}}\\end{math}"
+                               (string-canonicalize id)))
+                      ((markup-option n :text)
+                       #t)
+                      (else
+                       (printf "\\ref{~a}"
+                               (string-canonicalize id)))))))
 
 ;*---------------------------------------------------------------------*/
 ;*    bib-ref ...                                                      */