Add procedure to get the uri of a particular doc
My thinking is that we can generate the URIs for every doc, then use that to wire up the logic for the routing table
This commit is contained in:
parent
04a226e5e0
commit
0ad70e4ada
|
@ -1,11 +1,13 @@
|
|||
(define-module (guile-docs docs)
|
||||
#:use-module (srfi srfi-9)
|
||||
#:use-module (web uri)
|
||||
#:export (make-doc
|
||||
doc?
|
||||
doc-module
|
||||
doc-symbol
|
||||
doc-documentation
|
||||
docs-in-module))
|
||||
docs-in-module
|
||||
document-uri))
|
||||
|
||||
(define-record-type <doc>
|
||||
(make-doc module symbol documentation)
|
||||
|
@ -14,6 +16,15 @@
|
|||
(symbol doc-symbol)
|
||||
(documentation doc-documentation))
|
||||
|
||||
(define (document-uri doc)
|
||||
"Returns the URI for the provided <doc> argument"
|
||||
(when (doc? doc)
|
||||
(let ((symbol-list (append (doc-module doc)
|
||||
(list (doc-symbol doc)))))
|
||||
(build-uri 'guiledoc
|
||||
#:path (string-join (map (lambda (x) (symbol->string x))
|
||||
symbol-list)
|
||||
"/")))))
|
||||
|
||||
(define (docs-in-module module)
|
||||
"Returns a list of <doc> for each symbol in module mod"
|
||||
|
|
Loading…
Reference in New Issue