From 3b7f80d4471036050e6416e029f2c76c8e468ed0 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Tue, 12 Sep 2023 15:10:21 -0500 Subject: Adding markdown support --- web/.guix-shell | 4 ++-- web/view/markdown.scm | 17 +++++++++++++++++ web/view/view.scm | 8 +++++--- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 web/view/markdown.scm (limited to 'web') diff --git a/web/.guix-shell b/web/.guix-shell index 7a2f30a..b4aee2a 100644 --- a/web/.guix-shell +++ b/web/.guix-shell @@ -1,8 +1,8 @@ #!/bin/bash # # run with options '-- ./webserver.scm 8091' e.g. -# . .guix-shell -- guile -L .. --listen=1970 -e main ./webserver.scm 8091 +# . .guix-shell -- guile -L .. --fresh-auto-compile --listen=1970 -e main ./webserver.scm 8091 echo "Note run: running web-server" -guix shell guile guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs $* +guix shell guile guile-commonmark guile-fibers guile-json guile-gnutls guile-readline guile-redis openssl nss-certs $* diff --git a/web/view/markdown.scm b/web/view/markdown.scm new file mode 100644 index 0000000..b63e48d --- /dev/null +++ b/web/view/markdown.scm @@ -0,0 +1,17 @@ +(define-module (web view markdown) + #:use-module (json) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:use-module (ice-9 iconv) + #:use-module (ice-9 receive) + #:use-module (ice-9 string-fun) + #:use-module (ice-9 textual-ports) + #:use-module (sxml simple) + #:use-module (web sxml) + #:use-module (commonmark) + #:export (markdown-file->sxml)) + +(define (markdown-file->sxml fn) + (commonmark->sxml + (call-with-input-file fn + get-string-all))) diff --git a/web/view/view.scm b/web/view/view.scm index 20f3578..7ba7979 100644 --- a/web/view/view.scm +++ b/web/view/view.scm @@ -7,6 +7,7 @@ #:use-module (ice-9 string-fun) #:use-module (sxml simple) #:use-module (web sxml) + #:use-module (web view markdown) #:use-module (web view brand msk) #:use-module (web view brand aging) @@ -14,13 +15,14 @@ (define (view-aging) (aging-html #:info - '((h2 "Introduction") + `( (p "New aging portal! This is initial work for providing a full community webservice for aging.") + ,(markdown-file->sxml "test.md") (h2 "Explore GeneNetwork for aging (GN4AGING)") - (p "Find all genes that have a hit for") + (p "Find all " (mark "genes") " that have a hit for") (ul (li (a (@ (href "https://genenetwork.org/gsearch?type=gene&terms=aging")) "aging"))) - (p "Find all phenotypes that have a hit for") + (p "Find all " (mark "phenotypes") " that have a hit for") (ul (li (a (@ (href "https://genenetwork.org/gsearch?type=phenotype&terms=aging")) "aging")) ) -- cgit v1.2.3