summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/user/latexe.skb4
-rw-r--r--doc/user/loute.skb6
-rw-r--r--src/guile/skribilo/engine/html.scm2
-rw-r--r--src/guile/skribilo/engine/info.scm7
-rw-r--r--src/guile/skribilo/engine/latex.scm13
-rw-r--r--src/guile/skribilo/engine/lout.scm18
6 files changed, 45 insertions, 5 deletions
diff --git a/doc/user/latexe.skb b/doc/user/latexe.skb
index 805b9f8..dab4189 100644
--- a/doc/user/latexe.skb
+++ b/doc/user/latexe.skb
@@ -1,7 +1,7 @@
 ;;; latexe.skb  --  Documentation of the LaTeX engine.
 ;;; -*- coding: iso-8859-1 -*-
 ;;;
-;;; Copyright 2007, 2008  Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2007, 2008, 2012  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2003, 2004  Manuel Serrano
 ;;;
 ;;;
@@ -37,6 +37,8 @@ used to produce high-quality PostScript of PDF files for printing.])
       
       (doc-engine 'latex
 	 `((documentclass ,[A string declaring the LaTeX document class.])
+           (encoding ,[The encoding of the output document,(footnote
+[This option is supported when Guile 2.0+ is being used.]).])
            (class-has-chapters? ,[A boolean indicating whether the
 document class has a ,(code [chapter]) markup.  If ,(code "#f"), then
 Skribilo's ,(code [chapter]) is mapped to LaTeX' ,(code [section]), and
diff --git a/doc/user/loute.skb b/doc/user/loute.skb
index a3f1993..2adf9dd 100644
--- a/doc/user/loute.skb
+++ b/doc/user/loute.skb
@@ -1,7 +1,7 @@
 ;;; loute.skb  --  Documentation of the Lout engine.
 ;;; -*- coding: iso-8859-1 -*-
 ;;;
-;;; Copyright 2008  Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2008, 2012  Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
@@ -61,6 +61,10 @@ directives.])
 	  (inline-definitions-proc ,[A procedure that is passed the
 engine and returns Lout definitions to be included at the beginning of
 the document as a string.])
+          (encoding ,[The encoding of the output document,(footnote
+[This option is supported when Guile 2.0+ is being used.]).  As of
+Lout,(~)3.39, only ,(code ["ISO-8859-1"]) and ,(code ["ISO-8859-2"]) are
+supported.])
 
 	  (initial-font     ,[Lout specification of the document font.])
 	  (initial-break    ,[Lout specification of the default
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index ae414b6..1621595 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -611,7 +611,7 @@
 
                  (cond-expand
                   (guile-2
-                   ;; Make sure the output is suitable encoded.
+                   ;; Make sure the output is suitably encoded.
                    (and=> (engine-custom e 'charset)
                           (lambda (charset)
                             (set-port-encoding! (current-output-port)
diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index ec92ce5..592e1fe 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -1,7 +1,7 @@
 ;;; info.scm  --  GNU Info engine.
 ;;; -*- coding: iso-8859-1 -*-
 ;;;
-;;; Copyright 2008, 2009  Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2008, 2009, 2012  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2001, 2002  Manuel Serrano
 ;;;
 ;;;
@@ -186,6 +186,11 @@
   :options '(:title :author :ending)
   :action (lambda (doc e)
             (check-node-title-conflicts doc e)
+
+            (cond-expand
+             (guile-2 (set-port-encoding! (current-output-port) "UTF-8"))
+             (else #t))
+
             (let ((title     (markup-option doc :title))
                   (authors   (markup-option doc :author))
                   (body      (markup-body doc))
diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm
index ab19ee4..eeae1fc 100644
--- a/src/guile/skribilo/engine/latex.scm
+++ b/src/guile/skribilo/engine/latex.scm
@@ -1,7 +1,7 @@
 ;;; latex.scm  --  LaTeX engine.
 ;;; -*- coding: iso-8859-1 -*-
 ;;;
-;;; Copyright 2007, 2009  Ludovic Courtès <ludo@gnu.org>
+;;; Copyright 2007, 2009, 2012  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2003, 2004  Manuel Serrano
 ;;;
 ;;;
@@ -356,6 +356,7 @@
 	 :delegate (find-engine 'base)
 	 :filter (make-string-replace latex-encoding)
 	 :custom '((documentclass "\\documentclass{article}")
+                   (encoding "UTF-8")
                    (class-has-chapters? #f)
 		   (usepackage "\\usepackage{epsfig}\n")
 		   (predocument "\\newdimen\\oldframetabcolsep\n\\newdimen\\oldcolortabcolsep\n\\newdimen\\oldpretabcolsep\n")
@@ -517,6 +518,16 @@
 		 (if dc
 		     (begin (display dc) (newline))
 		     (display "\\documentclass{article}\n")))
+
+              (cond-expand
+               (guile-2
+                (let ((encoding (engine-custom e 'encoding)))
+                  (set-port-encoding! (current-output-port) encoding)
+                  (set-port-conversion-strategy! (current-output-port) 'error)
+                  (if (string-ci=? encoding "UTF-8") ; FIXME: other encodings?
+                      (display "\\usepackage[utf8]{inputenc}\n"))))
+               (else #t))
+
 	      (if (latex-color? e)
 		  (display (engine-custom e 'color-usepackage)))
 	      (if (engine-custom e 'hyperref)
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm
index 93a7f5b..7ce8efa 100644
--- a/src/guile/skribilo/engine/lout.scm
+++ b/src/guile/skribilo/engine/lout.scm
@@ -577,6 +577,9 @@
 			 ;; file is deduced from `document-type'.
 			 (document-include auto)
 
+                         ;; Encoding of the output file.
+                         (encoding "ISO-8859-1")
+
 			 (includes "@SysInclude { tbl }\n")
 			 (initial-font "Palatino Base 10p")
 			 (initial-break
@@ -1080,6 +1083,21 @@
 (markup-writer 'document
    :options '(:title :author :ending :keywords :env)
    :before (lambda (n e) ;; `e' is the engine
+             (cond-expand
+              (guile-2
+               ;; Make sure the output is suitably encoded.
+               (let ((encoding (engine-custom e 'encoding)))
+                 (set-port-encoding! (current-output-port) encoding)
+                 (set-port-conversion-strategy! (current-output-port) 'error)
+                 (cond ((string-ci=? encoding "ISO-8859-2")
+                        (display "@SysInclude { latin2 }\n"))
+                       ((not (string-ci=? encoding "ISO-8859-1"))
+                        (raise (condition
+                                (&invalid-argument-error
+                                 (proc-name 'lout)
+                                 (argument encoding))))))))
+              (else #t))
+
 	     (let* ((doc-type (let ((d (engine-custom e 'document-type)))
 				(if (string? d)
 				    (begin