Skip to content

Commit

Permalink
changed extension to 3md; updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
obarbeau committed Aug 31, 2024
1 parent d845226 commit 3a4623a
Show file tree
Hide file tree
Showing 23 changed files with 138 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/clojure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mkdocs
mkdocs-material
mkdocs-awesome-pages-plugin

Expand Down
4 changes: 2 additions & 2 deletions src/markdown2mindmap/log.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand All @@ -26,6 +26,6 @@
:appenders {:spit (appenders/spit-appender {:fname log-file-name})
:println {:enabled? false}}})

;;(info t/*config*)
#_(clojure.pprint/pprint t/*config*)

;; ------------------------------------
10 changes: 6 additions & 4 deletions src/markdown2mindmap/transform.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
53 changes: 53 additions & 0 deletions test-resources/hiccup-08.edn
Original file line number Diff line number Diff line change
@@ -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"]]]]]]]]
29 changes: 29 additions & 0 deletions test-resources/input-08.md
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions test-resources/map-08.puml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/markdown2mindmap/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Todo

- investigate Coogle

- _Front matter_:
If necessary, manage the file options in the Front matter, why not in TOML

Expand All @@ -15,7 +17,7 @@

- _mkdocs_:
mkdocs plugin <https://www.mkdocs.org/dev-guide/plugins>
to automatically generate mindmaps (`.mm.md`).
to automatically generate mindmaps (`.3md`).
`$HOME/.local/lib/python3.8/site-packages`

- _hiccup_:
Expand Down

0 comments on commit 3a4623a

Please sign in to comment.