reader: Add texinfo support.
* haunt/reader/texinfo.scm: New file. * Makefile.am (SOURCES): Add it. * example/haunt.scm: Activate texinfo reader. * example/posts/quux.scm: New file.
This commit is contained in:
		@@ -46,7 +46,6 @@ SOURCES =					\
 | 
			
		||||
  haunt/config.scm				\
 | 
			
		||||
  haunt/utils.scm				\
 | 
			
		||||
  haunt/post.scm				\
 | 
			
		||||
  haunt/reader.scm				\
 | 
			
		||||
  haunt/page.scm				\
 | 
			
		||||
  haunt/asset.scm				\
 | 
			
		||||
  haunt/site.scm				\
 | 
			
		||||
@@ -54,6 +53,8 @@ SOURCES =					\
 | 
			
		||||
  haunt/builder/assets.scm			\
 | 
			
		||||
  haunt/builder/atom.scm			\
 | 
			
		||||
  haunt/builder/blog.scm			\
 | 
			
		||||
  haunt/reader.scm				\
 | 
			
		||||
  haunt/reader/texinfo.scm			\
 | 
			
		||||
  haunt/ui.scm					\
 | 
			
		||||
  haunt/ui/build.scm				\
 | 
			
		||||
  haunt/ui/serve.scm				\
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
             (haunt builder assets)
 | 
			
		||||
             (haunt reader)
 | 
			
		||||
             (haunt reader skribe)
 | 
			
		||||
             (haunt reader texinfo)
 | 
			
		||||
             (haunt site))
 | 
			
		||||
 | 
			
		||||
(site #:title "Built with Guile"
 | 
			
		||||
@@ -11,7 +12,7 @@
 | 
			
		||||
      #:default-metadata
 | 
			
		||||
      '((author . "Eva Luator")
 | 
			
		||||
        (email  . "eva@example.com"))
 | 
			
		||||
      #:readers (list skribe-reader sxml-reader html-reader)
 | 
			
		||||
      #:readers (list texinfo-reader skribe-reader sxml-reader html-reader)
 | 
			
		||||
      #:builders (list (blog)
 | 
			
		||||
                       (atom-feed)
 | 
			
		||||
                       (atom-feeds-by-tag)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								example/posts/quux.texi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								example/posts/quux.texi
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
title: Hello, Texi!
 | 
			
		||||
date: 2015-10-15 22:00
 | 
			
		||||
tags: foo, bar
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
This is a test of the @emph{texinfo} reader for Haunt.  I sure hope it
 | 
			
		||||
works well.  Here is a URL to the @url{http://haunt.dthompson.us,
 | 
			
		||||
Haunt home page}.
 | 
			
		||||
 | 
			
		||||
@example
 | 
			
		||||
(use-modules (haunt asset)
 | 
			
		||||
             (haunt builder blog)
 | 
			
		||||
             (haunt builder atom)
 | 
			
		||||
             (haunt builder assets)
 | 
			
		||||
             (haunt reader)
 | 
			
		||||
             (haunt reader skribe)
 | 
			
		||||
             (haunt reader texinfo)
 | 
			
		||||
             (haunt site))
 | 
			
		||||
 | 
			
		||||
(site #:title "Built with Guile"
 | 
			
		||||
      #:domain "example.com"
 | 
			
		||||
      #:default-metadata
 | 
			
		||||
      '((author . "Eva Luator")
 | 
			
		||||
        (email  . "eva@@example.com"))
 | 
			
		||||
      #:readers (list texinfo-reader skribe-reader sxml-reader html-reader)
 | 
			
		||||
      #:builders (list (blog)
 | 
			
		||||
                       (atom-feed)
 | 
			
		||||
                       (atom-feeds-by-tag)
 | 
			
		||||
                       (static-directory "images")))
 | 
			
		||||
@end example
 | 
			
		||||
 | 
			
		||||
This is another paragraph.
 | 
			
		||||
							
								
								
									
										44
									
								
								haunt/reader/texinfo.scm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								haunt/reader/texinfo.scm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
			
		||||
;;; Haunt --- Static site generator for GNU Guile
 | 
			
		||||
;;; Copyright © 2015 David Thompson <davet@gnu.org>
 | 
			
		||||
;;;
 | 
			
		||||
;;; This file is part of Haunt.
 | 
			
		||||
;;;
 | 
			
		||||
;;; Haunt is free software; you can redistribute it and/or modify it
 | 
			
		||||
;;; under the terms of the GNU General Public License as published by
 | 
			
		||||
;;; the Free Software Foundation; either version 3 of the License, or
 | 
			
		||||
;;; (at your option) any later version.
 | 
			
		||||
;;;
 | 
			
		||||
;;; Haunt is distributed in the hope that it will be useful, but
 | 
			
		||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
;;; General Public License for more details.
 | 
			
		||||
;;;
 | 
			
		||||
;;; You should have received a copy of the GNU General Public License
 | 
			
		||||
;;; along with Haunt.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
;;; Commentary:
 | 
			
		||||
;;
 | 
			
		||||
;; Texinfo post reader.
 | 
			
		||||
;;
 | 
			
		||||
;;; Code:
 | 
			
		||||
 | 
			
		||||
(define-module (haunt reader texinfo)
 | 
			
		||||
  #:use-module (texinfo)
 | 
			
		||||
  #:use-module (texinfo html)
 | 
			
		||||
  #:use-module (haunt post)
 | 
			
		||||
  #:use-module (haunt reader)
 | 
			
		||||
  #:use-module (haunt utils)
 | 
			
		||||
  #:export (texinfo-reader))
 | 
			
		||||
 | 
			
		||||
(use-modules (srfi srfi-19))
 | 
			
		||||
 | 
			
		||||
(define texi->shtml
 | 
			
		||||
  (compose stexi->shtml texi-fragment->stexi))
 | 
			
		||||
 | 
			
		||||
(define texinfo-reader
 | 
			
		||||
  (make-reader (make-file-extension-matcher "texi")
 | 
			
		||||
               (lambda (file)
 | 
			
		||||
                 (call-with-input-file file
 | 
			
		||||
                   (lambda (port)
 | 
			
		||||
                     (values (read-metadata-headers port)
 | 
			
		||||
                             (texi->shtml port)))))))
 | 
			
		||||
		Reference in New Issue
	
	Block a user