blob: 8740774379f9d86347ccd4107630ad1fa8184299 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
--- a/doc/embed.scm
+++ b/doc/embed.scm
@@ -1,3 +1,4 @@
+(use gauche.charconv)
(use gauche.regexp)
(define (escape str)
(set! str (regexp-replace-all #/&/ str "&"))
@@ -15,12 +16,18 @@
(define (main args)
(call-with-input-file (cadr args)
(lambda (in)
- (let* ((content (port->string in))
+ (let* ((content (port->string (open-input-conversion-port in "*jp")))
(content (regexp-replace-all #/#\{(.*?)\}/ content
(lambda (m)
(string-append
"<pre>\n"
(read-file-and-escape (rxmatch-substring m 1))
- "</pre>\n")))))
+ "</pre>\n"))))
+ (content (regexp-replace #/(encoding=").*?(")/ content
+ (lambda (m)
+ (string-append
+ (rxmatch-substring m 1)
+ (ces-guess-from-string content "*jp")
+ (rxmatch-substring m 2))))))
(display content))))
0)
|