summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès2012-05-18 01:04:38 +0200
committerLudovic Courtès2012-05-18 01:04:38 +0200
commite99751896bdbff10fa49a2eeb1d7e06db5172f69 (patch)
tree791bafdb33b85ee69079ece9f863402bb0a3b2fb
parent1c445dd093cb6a02289f25324039ce1cba358145 (diff)
downloadskribilo-e99751896bdbff10fa49a2eeb1d7e06db5172f69.tar.gz
skribilo-e99751896bdbff10fa49a2eeb1d7e06db5172f69.tar.lz
skribilo-e99751896bdbff10fa49a2eeb1d7e06db5172f69.zip
html: Set the output encoding for secondary output files as well.
* src/guile/skribilo/engine/html.scm (document)[guile-2]: Move
  `set-port-encoding!' code to...
  (&html-generic-document): ... here, in `set-output-encoding' nested
  procedure.  Call `set-output-encoding' in both the `document?' case
  and other cases.
-rw-r--r--src/guile/skribilo/engine/html.scm26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index b04b848..39ab06e 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -1,7 +1,7 @@
 ;;; html.scm  --  HTML engine.
 ;;; -*- coding: iso-8859-1 -*-
 ;;;
-;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011  Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2003, 2004  Manuel Serrano
 ;;;
 ;;;
@@ -608,16 +608,6 @@
 
                  ;; Record the file name, for use by `html-file-default'.
                  (markup-option-add! n :file (*destination-file*))
-
-                 (cond-expand
-                  (guile-2
-                   ;; Make sure the output is suitably encoded.
-                   (and=> (engine-custom e 'charset)
-                          (lambda (charset)
-                            (set-port-encoding! (current-output-port)
-                                                charset))))
-                  (else #t))
-
 		 (&html-generic-document n title e)))
 
    :after (lambda (n e)
@@ -1177,6 +1167,15 @@
 ;*    &html-generic-document ...                                       */
 ;*---------------------------------------------------------------------*/
 (define (&html-generic-document n title e)
+  (define (set-output-encoding)
+    (cond-expand
+     (guile-2
+      ;; Make sure the output is suitably encoded.
+      (and=> (engine-custom e 'charset)
+             (lambda (charset)
+               (set-port-encoding! (current-output-port) charset))))
+     (else #t)))
+
    (let* ((id (markup-ident n))
 	  (header (new markup
 		     (markup '&html-chapter-header)
@@ -1248,10 +1247,13 @@
       ;; No file must be opened for documents. These files are
       ;; directly opened by Skribe
       (if (document? n)
-	  (output html e)
+          (begin
+            (set-output-encoding)
+            (output html e))
           (parameterize ((*destination-file* (html-file n e)))
             (with-output-to-file (*destination-file*)
               (lambda ()
+                (set-output-encoding)
 		(output html e)))))))
 
 ;*---------------------------------------------------------------------*/