aboutsummaryrefslogtreecommitdiff
path: root/web/view
diff options
context:
space:
mode:
Diffstat (limited to 'web/view')
-rw-r--r--web/view/markdown.scm29
1 files changed, 14 insertions, 15 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm
index 653596f..6aa2935 100644
--- a/web/view/markdown.scm
+++ b/web/view/markdown.scm
@@ -15,9 +15,8 @@
#:use-module (web request)
#:use-module (web sxml)
#:use-module (commonmark)
-
#:export (markdown-file->sxml markdown-github->sxml fetch-file
- fetch-raw-file commit-file))
+ fetch-raw-file commit-file git-invoke))
(define (markdown-file->sxml fn)
"Parse a local file"
@@ -26,26 +25,26 @@
(define (fetch-raw-file url)
(receive (response-status response-body)
- (http-request url) 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
+ (http-request url) response-body))
-(define (form-github-raw-url project repo page)
+(define* (form-github-raw-url project repo page #:optional (branch "master"))
(string-append "https://raw.githubusercontent.com/"
project
"/"
repo
- "/master/"
+ "/"
+ branch
+ "/"
(string-join page "/")))
-(define (form-github-edit-url project repo page)
+(define* (form-github-edit-url project repo page #:optional (branch "master"))
(string-append "https://github.com/"
project
"/"
repo
- "/edit/master/"
+ "/edit/"
+ branch
+ "/"
(string-join page "/")))
(define (markdown-github->sxml path)
@@ -120,12 +119,12 @@
(if (zero? git-commit-file)
`(("status" . "201")
("message" . "committed file successfully")
- ("content" unquote content)
- ("commit_sha" unquote git-commit-sha)
- ("commit_message" unquote commit-message))
+ ("content" . ,content)
+ ("commit_sha" . ,git-commit-sha)
+ ("commit_message" . ,commit-message))
`(("status" . "200")
("message" . "Nothing to commit, working tree clean")
- ("commit_sha" unquote git-commit-sha)))))
+ ("commit_sha" . ,git-commit-sha)))))
(#f (throw 'system-error
(format #f "~a File does not exist error" file-path))))
(throw 'system-error