-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to disable welcome page (#561)
When passing the same `:paths` or `:paths-fn` arg as for `build!` to `serve!` Clerk will no longer the built-in welcome page and instead serve the generated or user-specified index page on root. This is a first step towards enabling easy sharing fully interactive Clerk documents including pagination &c. Co-authored-by: Andrea Amantini <[email protected]>
- Loading branch information
Showing
13 changed files
with
348 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{:project "book-of-clerk"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns nextjournal.clerk.git | ||
"Clerk's Git integration for backlinks to source code repos." | ||
(:require [babashka.process :as p] | ||
[clojure.string :as str])) | ||
|
||
(defn ^:private shell-out-str | ||
"Shell helper, calls a cmd and returns it output string trimmed." | ||
[cmd] | ||
(str/trim (:out (p/shell {:out :string} cmd)))) | ||
|
||
#_(shell-out-str "git rev-parse HEAD") | ||
#_(shell-out-str "zonk") | ||
|
||
(defn ->github-project [remote-url] | ||
(second (re-find #"^git@github\.com:(.*)\.git$" remote-url))) | ||
|
||
(defn ->https-git-url | ||
"Takes a git `remote-url` and tries to convert it into a https url for | ||
backlinks. Currently only works for github, should be extended for | ||
gitlab, etc." | ||
[remote-url] | ||
(cond | ||
(str/starts-with? remote-url "https://") | ||
(str/replace remote-url #"\.git$" "") | ||
|
||
(->github-project remote-url) | ||
(str "https://github.com/%s" (->github-project remote-url)))) | ||
|
||
#_(->https-git-url "https://github.com/nextjournal/clerk.git") | ||
#_(->https-git-url "[email protected]:nextjournal/clerk.git") | ||
|
||
(defn read-git-attrs [] | ||
(try {:git/sha (shell-out-str "git rev-parse HEAD") | ||
:git/url (some ->https-git-url | ||
(map #(shell-out-str (str "git remote get-url " %)) | ||
(str/split-lines (shell-out-str "git remote"))))} | ||
(catch Exception _ | ||
{}))) | ||
|
||
#_(read-git-attrs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.