Create templates file to handle rendering and move temp scripts into it
Create docs module Add templates file to handle html wrapping and rendering Remove temp rendering files Add templates to hall file
This commit is contained in:
parent
4835576f46
commit
2d6d1294d4
5 changed files with 35 additions and 28 deletions
|
@ -1,4 +1,11 @@
|
|||
(use-modules (srfi srfi-9))
|
||||
(define-module (guile-docs docs)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:export (make-doc
|
||||
doc?
|
||||
doc-module
|
||||
doc-symbol
|
||||
doc-documentation
|
||||
docs-in-module))
|
||||
|
||||
(define-record-type <doc>
|
||||
(make-doc module symbol documentation)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
;; todo: module
|
||||
(define-module (guile-docs html templates)
|
||||
#:use-module (guile-docs docs))
|
||||
|
||||
(define (overall-wrapper content)
|
||||
`(html
|
||||
(link (@ (rel "stylesheet")
|
||||
|
@ -21,3 +23,24 @@
|
|||
(li "srfi"))))
|
||||
,content
|
||||
(footer (p (i "powered by solarpunks.")))))))
|
||||
|
||||
(define index-page
|
||||
(overall-wrapper
|
||||
'(main
|
||||
(h1 "Welcome")
|
||||
(p "This is GuileDocs."))))
|
||||
|
||||
(define (render-doc doc)
|
||||
`((hgroup
|
||||
(h1 ,(doc-symbol doc))
|
||||
(p "In " ,(doc-module doc)))
|
||||
(p ,(or (doc-documentation doc) ""))))
|
||||
|
||||
(define (render-module module)
|
||||
(let ((docs (docs-in-module module)))
|
||||
(overall-wrapper
|
||||
`(main ,(map render-doc docs)))))
|
||||
|
||||
(define test-module (resolve-interface '(srfi srfi-9)))
|
||||
(define (test-rendering)
|
||||
(render-module test-module))
|
4
hall.scm
4
hall.scm
|
@ -13,7 +13,9 @@
|
|||
(files (libraries
|
||||
((directory
|
||||
"guile-docs"
|
||||
((scheme-file "reflection") (scheme-file "docs")))))
|
||||
((directory "html" ((scheme-file "templates")))
|
||||
(scheme-file "reflection")
|
||||
(scheme-file "docs")))))
|
||||
(tests ())
|
||||
(programs
|
||||
((scheme-file "guile-docs")
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
;; TODO: move to modules - need to set up pre-inst-env or w/e
|
||||
(load "overall-wrapper.scm")
|
||||
|
||||
(overall-wrapper
|
||||
'(main
|
||||
(h1 "Welcome")
|
||||
(p "This is GuileDocs.")))
|
|
@ -1,18 +0,0 @@
|
|||
(load "overall-wrapper.scm")
|
||||
|
||||
(load "../guile-docs/docs.scm")
|
||||
|
||||
(define (render-module module)
|
||||
(let ((docs (docs-in-module module)))
|
||||
(overall-wrapper
|
||||
`(main ,(map render-doc docs)))))
|
||||
|
||||
|
||||
(define (render-doc doc)
|
||||
`((hgroup
|
||||
(h1 ,(doc-symbol doc))
|
||||
(p "In " ,(doc-module doc)))
|
||||
(p ,(or (doc-documentation doc) ""))))
|
||||
|
||||
|
||||
(render-module (resolve-interface '(srfi srfi-19)))
|
Loading…
Reference in a new issue