diff options
author | Pjotr Prins | 2023-09-13 16:47:30 -0500 |
---|---|---|
committer | Pjotr Prins | 2023-09-13 16:47:30 -0500 |
commit | 29c5964ad6a7d7f01a9b8d08c5db4893bd905f7c (patch) | |
tree | 51d7c5f04c128c1463c4b418d32c8a28cca6f7fb /web/view/markdown.scm | |
parent | 6b9a3e075c598069625a074e74475fa5a0655aca (diff) | |
download | gn-guile-29c5964ad6a7d7f01a9b8d08c5db4893bd905f7c.tar.gz |
Added github resolving and MSK home
Diffstat (limited to 'web/view/markdown.scm')
-rw-r--r-- | web/view/markdown.scm | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm index beabb3d..b7c8a58 100644 --- a/web/view/markdown.scm +++ b/web/view/markdown.scm @@ -26,10 +26,6 @@ get-string-all))) ;; --- fetch github style URLs -;; -;; https://github.com/genenetwork/gn-docs/master/general/brand/aging/home.md -;; https://raw.githubusercontent.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) (receive (response-status response-body) @@ -37,9 +33,15 @@ response-body) ) +;; https://github.com/genenetwork/gn-docs/master/general/brand/aging/home.md +;; https://raw.githubusercontent.com/genenetwork/gn-docs/master/general/brand/aging/home.md +;; https://github.com/genenetwork/gn-docs/edit/master/general/brand/aging/home.md -(define (markdown-github->sxml fn) - "Parse a github markdown file" - (commonmark->sxml - (pk (fetch-raw-file fn)))) +(define (form-github-raw-url project repo page) + (string-append "https://raw.githubusercontent.com/" project "/" repo "/master/" (string-join page "/"))) +(define (markdown-github->sxml path) + "Parse a github markdown file that is formed like genenetwork/gn-docs/general/brand/aging/home.md" + (match-let (((project repo page ...) (string-split path #\/))) + (commonmark->sxml + (fetch-raw-file (form-github-raw-url project repo page))))) |