From 390afd31ccb548a2c2cb87906bdb6026fc64fa3e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 20 Jan 2008 00:15:54 +0100 Subject: html: Fix xrefs to the `document' node. * src/guile/skribilo/engine/html.scm (html-file-default): Don't use `tmpnam', was stupid. (document): Record the current `*destination-file*' as `:file' option of N. (&html-generic-document): Parameterize `*destination-file*'. --- src/guile/skribilo/engine/html.scm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm index 7858e1a..d910fee 100644 --- a/src/guile/skribilo/engine/html.scm +++ b/src/guile/skribilo/engine/html.scm @@ -1,6 +1,6 @@ ;;; html.scm -- HTML engine. ;;; -;;; Copyright 2005, 2006, 2007 Ludovic Courtès +;;; Copyright 2005, 2006, 2007, 2008 Ludovic Courtès ;;; Copyright 2003, 2004 Manuel Serrano ;;; ;;; @@ -38,9 +38,11 @@ :autoload (skribilo sui) (document-sui) :autoload (ice-9 rdelim) (read-line) :autoload (ice-9 regex) (regexp-substitute/global) + :use-module (srfi srfi-13) :use-module (srfi srfi-14) :use-module ((srfi srfi-19) :renamer (symbol-prefix-proc 's19:)) + :use-module (srfi srfi-39) :export (html-engine html-title-engine html-file html-width html-class html-markup-class @@ -62,7 +64,7 @@ (define html-file-default ;; Default implementation of the `file-name-proc' custom. (let ((table '()) - (filename (tmpnam))) + (filename (gensym "filename"))) (define (get-file-name base suf) (let* ((c (assoc base table)) (n (if (pair? c) @@ -584,6 +586,7 @@ ;*---------------------------------------------------------------------*/ (markup-writer 'document :options '(:title :author :ending :html-title :env :keywords) + :action (lambda (n e) (let* ((id (markup-ident n)) (title (new markup @@ -593,7 +596,12 @@ (class (markup-class n)) (options `((author ,(markup-option n :author)))) (body (markup-option n :title))))) + + ;; Record the file name, for use by `html-file-default'. + (markup-option-add! n :file (*destination-file*)) + (&html-generic-document n title e))) + :after (lambda (n e) (if (engine-custom e 'emit-sui) (document-sui n e)))) @@ -1196,9 +1204,10 @@ ;; directly opened by Skribe (if (document? n) (output html e) - (with-output-to-file (html-file n e) - (lambda () - (output html e)))))) + (parameterize ((*destination-file* (html-file n e))) + (with-output-to-file (*destination-file*) + (lambda () + (output html e))))))) ;*---------------------------------------------------------------------*/ ;* &html-generic-subdocument ... */ @@ -2259,3 +2268,9 @@ ;* Restore the base engine */ ;*---------------------------------------------------------------------*/ (default-engine-set! (find-engine 'base)) + + +;;; Local Variables: +;;; mode: scheme +;;; coding: latin-1 +;;; End: -- cgit v1.2.3