From 3a4623aca96e3d07bc1f09a49dcf3ad3ad4f539d Mon Sep 17 00:00:00 2001 From: Olivier Barbeau - Rymint Date: Sat, 31 Aug 2024 20:21:08 +0200 Subject: [PATCH] changed extension to 3md; updated deps --- .github/workflows/clojure.yml | 10 ++-- CHANGELOG.md | 1 + {doc => codox}/css/default.css | 0 {doc => codox}/highlight/highlight.min.js | 0 {doc => codox}/highlight/solarized-light.css | 0 {doc => codox}/index.html | 0 {doc => codox}/js/jquery.min.js | 0 {doc => codox}/js/page_effects.js | 0 {doc => codox}/markdown2mindmap.core.html | 0 {doc => codox}/markdown2mindmap.enter.html | 0 {doc => codox}/markdown2mindmap.exit.html | 0 {doc => codox}/markdown2mindmap.log.html | 0 .../markdown2mindmap.transform.html | 0 deps.edn | 16 +++--- git-hooks/pre-commit | 2 +- requirements.txt | 1 + src/markdown2mindmap/log.clj | 4 +- src/markdown2mindmap/transform.clj | 10 ++-- test-resources/hiccup-08.edn | 53 +++++++++++++++++++ test-resources/input-08.md | 29 ++++++++++ test-resources/map-08.puml | 28 ++++++++++ test/markdown2mindmap/core_test.clj | 2 +- todo.md | 4 +- 23 files changed, 138 insertions(+), 22 deletions(-) rename {doc => codox}/css/default.css (100%) rename {doc => codox}/highlight/highlight.min.js (100%) rename {doc => codox}/highlight/solarized-light.css (100%) rename {doc => codox}/index.html (100%) rename {doc => codox}/js/jquery.min.js (100%) rename {doc => codox}/js/page_effects.js (100%) rename {doc => codox}/markdown2mindmap.core.html (100%) rename {doc => codox}/markdown2mindmap.enter.html (100%) rename {doc => codox}/markdown2mindmap.exit.html (100%) rename {doc => codox}/markdown2mindmap.log.html (100%) rename {doc => codox}/markdown2mindmap.transform.html (100%) create mode 100644 test-resources/hiccup-08.edn create mode 100644 test-resources/input-08.md create mode 100644 test-resources/map-08.puml diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index 9b91a78..3447d2a 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -19,25 +19,25 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4.1.2 - name: Prepare java - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v4.2.1 with: distribution: "temurin" java-version: "17" - name: Install clojure tools - uses: DeLaGuardo/setup-clojure@9.5 + uses: DeLaGuardo/setup-clojure@12.5 with: cli: latest # (optional) To avoid rate limit errors please provide github token # github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check out practicalli clojure-deps-edn + - name: Check out practicalli clojure-cli-config uses: actions/checkout@master with: - repository: practicalli/clojure-deps-edn + repository: practicalli/clojure-cli-config path: practicalli - name: Use practicalli diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e5ebc3..0ca1403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,3 +25,4 @@ This change log follows the conventions of [keepachangelog.com](http://keepachan - `puml` files were missing plantuml directives - process complete directory; Both SVG and PUML output are optional - do not generate unchanged file +- changed extension to 3md; updated deps diff --git a/doc/css/default.css b/codox/css/default.css similarity index 100% rename from doc/css/default.css rename to codox/css/default.css diff --git a/doc/highlight/highlight.min.js b/codox/highlight/highlight.min.js similarity index 100% rename from doc/highlight/highlight.min.js rename to codox/highlight/highlight.min.js diff --git a/doc/highlight/solarized-light.css b/codox/highlight/solarized-light.css similarity index 100% rename from doc/highlight/solarized-light.css rename to codox/highlight/solarized-light.css diff --git a/doc/index.html b/codox/index.html similarity index 100% rename from doc/index.html rename to codox/index.html diff --git a/doc/js/jquery.min.js b/codox/js/jquery.min.js similarity index 100% rename from doc/js/jquery.min.js rename to codox/js/jquery.min.js diff --git a/doc/js/page_effects.js b/codox/js/page_effects.js similarity index 100% rename from doc/js/page_effects.js rename to codox/js/page_effects.js diff --git a/doc/markdown2mindmap.core.html b/codox/markdown2mindmap.core.html similarity index 100% rename from doc/markdown2mindmap.core.html rename to codox/markdown2mindmap.core.html diff --git a/doc/markdown2mindmap.enter.html b/codox/markdown2mindmap.enter.html similarity index 100% rename from doc/markdown2mindmap.enter.html rename to codox/markdown2mindmap.enter.html diff --git a/doc/markdown2mindmap.exit.html b/codox/markdown2mindmap.exit.html similarity index 100% rename from doc/markdown2mindmap.exit.html rename to codox/markdown2mindmap.exit.html diff --git a/doc/markdown2mindmap.log.html b/codox/markdown2mindmap.log.html similarity index 100% rename from doc/markdown2mindmap.log.html rename to codox/markdown2mindmap.log.html diff --git a/doc/markdown2mindmap.transform.html b/codox/markdown2mindmap.transform.html similarity index 100% rename from doc/markdown2mindmap.transform.html rename to codox/markdown2mindmap.transform.html diff --git a/deps.edn b/deps.edn index 418eb7e..24376d0 100644 --- a/deps.edn +++ b/deps.edn @@ -1,11 +1,11 @@ {:paths ["src" "resources"] - :deps {com.kiranshila/cybermonday {:mvn/version "0.6.213"} - com.taoensso/timbre {:mvn/version "5.1.2"} - mvxcvi/puget {:mvn/version "1.3.1"} - net.sourceforge.plantuml/plantuml {:mvn/version "1.2023.6"} - org.clojure/clojure {:mvn/version "1.11.1"} + :deps {com.kiranshila/cybermonday {:mvn/version "0.6.215"} + com.taoensso/timbre {:mvn/version "6.5.0"} + mvxcvi/puget {:mvn/version "1.3.4"} + net.sourceforge.plantuml/plantuml {:mvn/version "1.2024.6"} + org.clojure/clojure {:mvn/version "1.11.2"} ;; required when launching with BB - org.clojure/tools.cli {:mvn/version "1.0.219"}} + org.clojure/tools.cli {:mvn/version "1.1.230"}} :aliases {:dev {;; for the profilers :jvm-opts ["-Dproject-name=markdown2mindmap.core"] @@ -15,13 +15,13 @@ :run-m {:main-opts ["-m" "markdown2mindmap.core"]} :build {:deps {io.github.obarbeau/build-clj - {:git/sha "bb7d3f12381d84b9e230d8497d4d09b9fd6971ab"}} + {:local/root "../tools/build-clj"} #_{:git/sha "bb7d3f12381d84b9e230d8497d4d09b9fd6971ab"}} :exec-args {:lib io.github.obarbeau/markdown2mindmap :main-ns markdown2mindmap.core :version "0.1.0-SNAPSHOT"}} ;; clojure -X:env/test:flow-doc - :flow-doc {:extra-deps {com.github.jpmonettas/flow-storm-dbg {:mvn/version "3.3.320"}} + :flow-doc {:extra-deps {com.github.jpmonettas/flow-storm-dbg {:mvn/version "3.7.5"}} :exec-fn flow-storm.api/cli-doc :exec-args {:result-name "autodoc" :print-unsampled? true diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index e462b3d..9cce46a 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -11,7 +11,7 @@ do_exit() { # of the 'src' directory into the 'doc' directory # find last modified file in the doc directory -local latest_doc_file=$(find doc -type f -exec stat -c '%Y %n' {} \; 2>/dev/null | sort --numeric-sort --reverse | head -1 | cut -d' ' -f2) +local latest_doc_file=$(find codox -type f -exec stat -c '%Y %n' {} \; 2>/dev/null | sort --numeric-sort --reverse | head -1 | cut -d' ' -f2) # block if any file in src is more recent if [[ $(find src -newer $latest_doc_file -print) ]]; then diff --git a/requirements.txt b/requirements.txt index 8d38932..88d43f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +mkdocs mkdocs-material mkdocs-awesome-pages-plugin diff --git a/src/markdown2mindmap/log.clj b/src/markdown2mindmap/log.clj index 81b5131..8ff2a00 100644 --- a/src/markdown2mindmap/log.clj +++ b/src/markdown2mindmap/log.clj @@ -9,7 +9,7 @@ (t/merge-config! {:timestamp-opts {:pattern ""} - :min-level :warn + :min-level :debug :output-fn (fn ([data] (let [{:keys [level ?err #_vargs msg_ ?ns-str ?file hostname_ @@ -26,6 +26,6 @@ :appenders {:spit (appenders/spit-appender {:fname log-file-name}) :println {:enabled? false}}}) -;;(info t/*config*) +#_(clojure.pprint/pprint t/*config*) ;; ------------------------------------ \ No newline at end of file diff --git a/src/markdown2mindmap/transform.clj b/src/markdown2mindmap/transform.clj index b520551..0dbedf1 100644 --- a/src/markdown2mindmap/transform.clj +++ b/src/markdown2mindmap/transform.clj @@ -12,6 +12,8 @@ FileFormatOption FileFormat))) +;; TODO cf https://github.com/jimmyhmiller/PlayGround/blob/master/markdown-to-blog/src/markdown_to_blog/core.clj + (defn- walk-fn [result x] (cond @@ -135,14 +137,14 @@ "Generates an mindmap image (with the `type` format) from a markdown file or dir and/or a puml file." [input-file-or-dir {:keys [type style with-svg svg-output-dir with-puml puml-output-dir]}] (doseq [input-file (file-seq (io/file input-file-or-dir)) - :when (str/ends-with? input-file ".mm.md") + :when (str/ends-with? input-file ".3md") :let [svg-output-directory (or svg-output-dir (.getParent input-file)) puml-output-directory (or puml-output-dir (.getParent input-file))]] - (let [;; keeps only filename without 'md' extension - output-name (str/replace (.getName input-file) #"(?i)\.md" "") + (let [;; keeps only filename without '3md' extension + output-name (str/replace (.getName input-file) #"(?i)\.3md" "") output-img (-> output-name ;; adds selected extension - (str "." type) + (str type) (#(io/file svg-output-directory %))) output-puml (-> output-name (str ".puml") diff --git a/test-resources/hiccup-08.edn b/test-resources/hiccup-08.edn new file mode 100644 index 0000000..aa7cac8 --- /dev/null +++ b/test-resources/hiccup-08.edn @@ -0,0 +1,53 @@ +[:div + {} + [:markdown/heading {:level 1} "A"] + [:ul + {} + [:markdown/bullet-list-item + {} + [:p {} "B"] + [:ul + {} + [:markdown/bullet-list-item {} [:p {} "C"]] + [:markdown/bullet-list-item {} [:p {} "D"]] + [:markdown/bullet-list-item {} [:p {} "E"]] + [:markdown/bullet-list-item {} [:p {} "F"]] + [:markdown/bullet-list-item {} [:p {} "G"]] + [:markdown/bullet-list-item + {} + [:p {} "H"] + [:ul + {} + [:markdown/bullet-list-item {} [:p {} "I"]] + [:markdown/bullet-list-item {} [:p {} "J"]]]]]] + [:markdown/bullet-list-item + {} + [:p {} "K"] + [:ul + {} + [:markdown/bullet-list-item + {} + [:p {} "L"] + [:ul + {} + [:markdown/bullet-list-item + {} + [:p {} "M"] + [:ul + {} + [:markdown/bullet-list-item {} [:p {} "N"]] + [:markdown/bullet-list-item {} [:p {} "O"]] + [:markdown/bullet-list-item {} [:p {} "P"]] + [:markdown/bullet-list-item {} [:p {} "Q"]] + [:markdown/bullet-list-item {} [:p {} "R"]]]] + [:markdown/bullet-list-item {} [:p {} "S"]]]] + [:markdown/bullet-list-item {} [:p {} "T"]] + [:markdown/bullet-list-item + {} + [:p {} "U"] + [:ul + {} + [:markdown/bullet-list-item {} [:p {} "V"]] + [:markdown/bullet-list-item {} [:p {} "W"]] + [:markdown/bullet-list-item {} [:p {} "X"]] + [:markdown/bullet-list-item {} [:p {} "Y"]]]]]]]] \ No newline at end of file diff --git a/test-resources/input-08.md b/test-resources/input-08.md new file mode 100644 index 0000000..c4061f2 --- /dev/null +++ b/test-resources/input-08.md @@ -0,0 +1,29 @@ +# A + +- B + + - C + - D + - E + - F + - G + - H + - I + - J + +- K + + - L + - M + - N + - O + - P + - Q + - R + - S + - T + - U + - V + - W + - X + - Y diff --git a/test-resources/map-08.puml b/test-resources/map-08.puml new file mode 100644 index 0000000..d0d40b4 --- /dev/null +++ b/test-resources/map-08.puml @@ -0,0 +1,28 @@ +@startmindmap + +* A +**_ B +***_ C +***_ D +***_ E +***_ F +***_ G +***_ H +****_ I +****_ J +**_ K +***_ L +****_ M +*****_ N +*****_ O +*****_ P +*****_ Q +*****_ R +****_ S +***_ T +***_ U +***_ V +***_ W +***_ X +***_ Y +@endmindmap \ No newline at end of file diff --git a/test/markdown2mindmap/core_test.clj b/test/markdown2mindmap/core_test.clj index eba4520..c34d774 100644 --- a/test/markdown2mindmap/core_test.clj +++ b/test/markdown2mindmap/core_test.clj @@ -7,7 +7,7 @@ (deftest a-test (mth/delete-log) (mth/delete-output-dir) - (doseq [n (range 1 8)] + (doseq [n (range 1 9)] (infof "--- Start of test %d ---" n) (testing "->hiccup" (is (= (mth/read-hiccup n) diff --git a/todo.md b/todo.md index 97f7d63..2b9000b 100644 --- a/todo.md +++ b/todo.md @@ -1,5 +1,7 @@ # Todo +- investigate Coogle + - _Front matter_: If necessary, manage the file options in the Front matter, why not in TOML @@ -15,7 +17,7 @@ - _mkdocs_: mkdocs plugin - to automatically generate mindmaps (`.mm.md`). + to automatically generate mindmaps (`.3md`). `$HOME/.local/lib/python3.8/site-packages` - _hiccup_: