From 2a75f39404519ae6697c90a703e61fa65452872e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 14 Sep 2023 12:17:19 -0500 Subject: Added edit button --- web/css/gn-lite.css | 8 ++++++++ web/view/brand/msk.scm | 6 ++++++ web/view/markdown.scm | 11 +++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 web/css/gn-lite.css (limited to 'web') diff --git a/web/css/gn-lite.css b/web/css/gn-lite.css new file mode 100644 index 0000000..3ce6ace --- /dev/null +++ b/web/css/gn-lite.css @@ -0,0 +1,8 @@ +.markdown { + background-color: #fffde7; + padding: 20px; +} + +.button_align_right{ + float:right; +} diff --git a/web/view/brand/msk.scm b/web/view/brand/msk.scm index c20d8d9..69c1253 100644 --- a/web/view/brand/msk.scm +++ b/web/view/brand/msk.scm @@ -37,6 +37,12 @@ (type "text/css") (href "/css/pico.css") )) + (link + (@ (rel "stylesheet") + (media "screen") + (type "text/css") + (href "/css/gn-lite.css") + )) ,@head) (body (main (@ (class "container")) diff --git a/web/view/markdown.scm b/web/view/markdown.scm index c0cb992..4dbedb2 100644 --- a/web/view/markdown.scm +++ b/web/view/markdown.scm @@ -39,8 +39,15 @@ (define (form-github-raw-url project repo page) (string-append "https://raw.githubusercontent.com/" project "/" repo "/master/" (string-join page "/"))) +(define (form-github-edit-url project repo page) + (string-append "https://github.com/" project "/" repo "/edit/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 (pk (form-github-raw-url project repo (pk page))))))) + `(div (@ (class "markdown")) + (div (@ (class "button_align_right")) + (a (@ (href ,(form-github-edit-url project repo page)) (role "button")) "edit text")) + ,(commonmark->sxml + (fetch-raw-file (pk (form-github-raw-url project repo (pk page))))))) +) -- cgit v1.2.3