~evhan/beaker

e059e15e85a200e33efb4a1b1297fed45bcd9661 — Evan Hanson 3 years ago ff2aa61
Switch documentation generator to Markdown and remove markdown-svnwiki dependency
5 files changed, 29 insertions(+), 34 deletions(-)

M aux/generate-wiki-page.scm
M beaker.egg
M beaker.wiki.in
R lib/beaker/{wiki.scm => markdown.scm}
M lib/beaker/system.scm
M aux/generate-wiki-page.scm => aux/generate-wiki-page.scm +9 -8
@@ 3,15 3,16 @@
exec csi -s "$0" "$@"
|#

(import (beaker wiki))
(import (beaker markdown))
(import (only (chicken port) make-concatenated-port))

(define template
  (make-concatenated-port
   (open-input-string "#<#EOF\n")
   (open-input-file "beaker.wiki.in")
   (open-input-string "EOF\n")))
(import (markdown-svnwiki))

(with-output-to-file "beaker.wiki"
 (lambda ()
   (print (eval (read template)))))
   (let ((markdown (open-output-string))
         (template (make-concatenated-port
                    (open-input-string "#<#EOF\n")
                    (open-input-file "beaker.wiki.in")
                    (open-input-string "EOF\n"))))
     (display (eval (read template)) markdown)
     (markdown->svnwiki (get-output-string markdown)))))

M beaker.egg => beaker.egg +4 -8
@@ 4,10 4,7 @@
 (author "Evan Hanson")
 (build-dependencies module-declarations)
 (dependencies
  ;; Disabled until patches are accepted upsteam:
  ; (compile-file "0.1")
  ; (markdown-svnwiki "0.2.2")
  ; (schematic "0.3.1")
  (schematic "0.3.1")
  (srfi-1 "0.2")
  (srfi-13 "0.2")
  (srfi-14 "0.2")


@@ 29,10 26,9 @@
  (extension beaker.system
   (source "lib/beaker/system.scm")
   (component-dependencies beaker.egg.info beaker.repository))
  ;; See `dependencies` above.
  ; (extension beaker.wiki
  ;  (source "lib/beaker/wiki.scm")
  ;  (component-dependencies beaker.egg.info))
  (extension beaker.markdown
   (source "lib/beaker/markdown.scm")
   (component-dependencies beaker.egg.info))
  (program chicken-clean
   (linkage static)
   (component-dependencies beaker.interactive))))

M beaker.wiki.in => beaker.wiki.in +1 -1
@@ 1,6 1,6 @@
== Beaker

Lab supplies for CHICKEN development.
Lab supplies for CHICKEN Scheme.

[[toc:]]


R lib/beaker/wiki.scm => lib/beaker/markdown.scm +14 -16
@@ 1,6 1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Generate wiki documentation.
;;; Generate Markdown documentation.
;;;
;;; Copyright (c) 2018, Evan Hanson
;;;


@@ 8,7 8,7 @@
;;;

(declare
  (module (beaker wiki))
  (module (beaker markdown))
  (export document-dependencies
          document-extension
          document-license


@@ 21,18 21,17 @@
          (chicken process-context)
          (chicken read-syntax)
          (chicken string)
          (markdown-svnwiki)
          (schematic extract)
          (srfi 13)))

;;
;; Reads Scheme source from `input` and writes wiki documentation
;; fragments to `output`.
;; Reads Scheme source from `input` and writes Markdown documentation
;; for each commented value to `output`.
;;
;; If no arguments are given, `input` and `output` default to
;; the `(current-input-port)` and `(current-output-port)`.
;; If no arguments are given, `input` and `output` default to the
;; `(current-input-port)` and `(current-output-port)`.
;;
(define (generate-documentation #!optional input output)
(define (generate-markdown #!optional input output)
  (let* ((buffer  (open-output-string))
         (input*  (or input (current-input-port)))
         (output* (or output (current-output-port)))


@@ 44,19 43,18 @@
          ((eof-object? x))
        (for-each (lambda (d)
                    (unless (eq? (car d) 'declaration)
                      (print "<" (car d) ">" (cdr d) "</" (car d) ">")))
                      (print "    [" (car d) "] " (cdr d))))
                  (cdr x))
        (newline)
        (markdown->svnwiki (car x))))))
        (print #\newline (car x) #\newline)))))

(define (document-file file)
  (string-trim-both
   (with-input-from-file file
   (with-output-to-string
    (lambda ()
      (with-output-to-string generate-documentation)))))
      (call-with-input-file file generate-markdown)))))

(define (document-command command)
  (string-append " " (string-trim-both (with-input-from-pipe command read-string))))
  (string-append "    " (string-trim-both (with-input-from-pipe command read-string))))

(define (document-extension file)
  (document-file file))


@@ 66,12 64,12 @@

(define (document-dependencies egg-file)
  (string-intersperse
   (map (lambda (d) (conc "* [[/eggref/5/" d "|" d "]]"))
   (map (lambda (d) (conc "* [" d " ](/eggref/5/" d ")"))
        (egg-dependencies egg-file))
   "\n"))

(define (document-license file)
  (string-intersperse
   (map (lambda (l) (string-append " " l))
   (map (lambda (l) (string-append "    " l))
        (with-input-from-file file read-lines))
   "\n"))

M lib/beaker/system.scm => lib/beaker/system.scm +1 -1
@@ 116,7 116,7 @@
;; recompiled and the egg's extension libraries are loaded into the
;; calling program.
;;
;; Subsequent calls cause components to be recompiled to be reloaded as
;; Subsequent calls cause components to be recompiled and reloaded as
;; necessary.
;;
(define (load-system egg-file #!key (skip '()))