diff options
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))))) |