aboutsummaryrefslogtreecommitdiff
path: root/web/view/markdown.scm
diff options
context:
space:
mode:
authorPjotr Prins2023-09-13 11:16:59 -0500
committerPjotr Prins2023-09-13 11:16:59 -0500
commit54c351f585a3695d441bc44e14d6b3e68e58da79 (patch)
tree13e6f3d5dcc4391ee2d4ad73e2eea6559a815954 /web/view/markdown.scm
parent3b7f80d4471036050e6416e029f2c76c8e468ed0 (diff)
downloadgn-guile-54c351f585a3695d441bc44e14d6b3e68e58da79.tar.gz
wip
Diffstat (limited to 'web/view/markdown.scm')
-rw-r--r--web/view/markdown.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm
index b63e48d..a147231 100644
--- a/web/view/markdown.scm
+++ b/web/view/markdown.scm
@@ -7,11 +7,37 @@
#:use-module (ice-9 string-fun)
#:use-module (ice-9 textual-ports)
#:use-module (sxml simple)
+ #:use-module (web client)
+ #:use-module (web uri)
+ #:use-module (web request)
#:use-module (web sxml)
#:use-module (commonmark)
- #:export (markdown-file->sxml))
+
+ #:export (markdown-file->sxml
+ markdown-github->sxml)
+ )
+
(define (markdown-file->sxml fn)
+ "Parse a local file"
(commonmark->sxml
(call-with-input-file fn
get-string-all)))
+
+;; --- fetch github style URLs
+;;
+;; https://github.com/genenetwork/gn-docs/master/general/brand/aging/home.md
+;; https://github.com/genenetwork/gn-docs/edit/master/general/brand/aging/home.md
+
+(define (fetch-raw-file url)
+ (bytevector->string (receive (response-status response-body)
+ (http-request "https://github.com/genenetwork/gn-docs/master/general/brand/aging/home.md")
+ response-body) "UTF-8"))
+
+
+(define (markdown-github->sxml fn)
+ "Parse a github file"
+ (commonmark->sxml
+ (call-with-input-file (pk fn)
+ get-string-all)))
+