perun

Discuss perun static site generator
podviaznikov 2019-03-25T18:47:35.003900Z

Hey everyone! I'm working on new library/project. I would like to get feedback from you: 1) is it ok idea 2) do you know of other similar projects. So the project is called montaigne. It's basically superset of markdown used for writing personal wikis and journals. The cool thing is that I can inline Clojure code that will be evaluated. So in one markdown file (with some specific conventions) you write both text and code. Than on top of that you have CLI that generates HTML version (with multiple pages) of our wiki/journal. CLI can also be used to query data. The cool thing that it's juts markdown and everything works with standard editors.

podviaznikov 2019-03-25T18:49:42.004Z

E.g. here I'm using VS Code Outline view and see all types of content I'm tracking, all books I've read. So navigation is easy. And search just works If anyone has any feedback about this, please let me know. I'm still just prototyping and need a lot of things to implement. But still want to get some feedback. I've looked at other systems like Org mode and others, but for various reasons they didn't work for me.

2019-03-25T19:13:26.005300Z

That’s awesome! Sounds a bit like my book report project but yours has a more valuable use case for structuring content accessible outside of an application. Do you have a sample of what a more complex page’s source would look like?

podviaznikov 2019-03-25T20:56:01.009200Z

Yes, I saw https://github.com/eccentric-j/book-report. It's a great project 👍 I only have one example document so far: https://github.com/montaigneio/montaigne/blob/master/journal.md#itinerary-2. But this table is an example of what I want to add soon. E.g. I want to define table with dynamic columns. I'll just put my trips itinerary with names of airports. But in dynamic columns I'll be able to write function that will calculate distance between airport, emissions etc. And any user will be able to user their own functions over data. And it will allow to build dynamic pages too: like how many books I've read in the past year, or how many kms did I travel and what was my environmental impact in terms of emissions. Basically I'll want to store info on all books I've read, trips I did (and maybe collection of quotes too)

2019-03-25T21:00:09.010700Z

So you get markdown where it works but when you need more power you can use @template to render some clojure generated HTML markup? If it gets hiccup that could be amazing, especially for perun!

podviaznikov 2019-03-25T21:14:20.013700Z

Any property with markdown code syntax (some code) or

clojure ..some code..
will be evaluated:) Yes, I want to add hiccup, but I started with CLJS (maybe just need to switch to Clojure) and it was a bit challenging to pass hiccup macros into dynamic eval function (pretty sure in pure Clojure it should be much easier) -- It's a good feedback already. I need to write some docs and also improve implementation (it's tiny so far, under 500 lines of code https://github.com/montaigneio/montaigne/blob/master/src/montaigne/parser.cljs)

2019-03-25T21:34:32.016200Z

If you’re using ClojureScript, I’ve had success with https://github.com/thi-ng/umbrella/tree/master/packages/hiccup. However, I had to add a toHiccup method to the cljs vector and sequence prototypes to call (clj->js (js-this)) since that hiccup implementation only deals with native js types.

2019-03-25T21:34:53.016400Z

(defn to-hiccup
  "Used as toHiccup method on cljs vectors and lists.
  Takes no arguments but uses js-this.
  Returns a js array for <http://thi.ng|thi.ng> umbrella hiccup compatability."
  []
  (-&gt;&gt; (js-this)
       (clj-&gt;js)))

;; Add a toHiccup method to cljs vectors and sequences
(doseq [o [[] ()]]
  (-&gt; (.getPrototypeOf js/Object o)
      (.-toHiccup)
      (set! to-hiccup)))

podviaznikov 2019-03-25T21:46:25.017100Z

oh, wow. Thanks! I was trying another library and it didn't work well. I think this might work!! Going to try it

2019-03-25T22:15:13.017400Z

No problem! Let me know if you run into any issues.