Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host site as github repo of md files? #192

Open
7 tasks
shaunlebron opened this issue Sep 30, 2022 · 1 comment
Open
7 tasks

Host site as github repo of md files? #192

shaunlebron opened this issue Sep 30, 2022 · 1 comment

Comments

@shaunlebron
Copy link
Member

shaunlebron commented Sep 30, 2022

I’d like to populate the docfiles with generated content to avoid hosting a separate site.

Embed clojure code inside <!-- clj (...) -> tags to generate content.

## Summary
...

## Details
...

## Examples
...

## Source

<!-- clj (cljs-api/get-source *entry*)-->
...
<!-- clj -->

And I’d like a way to run something like clj -M docgen.clj <docfile> to update it using info from cljs-api.edn maybe.

Migration plan

  • Generate cljs-api.edn without docfiles
  • Generate *.clj.md files from original docfiles (“ejecting”)
  • Have newly detected symbols generate *.clj.md stub files.
  • Replace doc: links with relative md links
  • Create a new process for updating *.clj.md files, only by using embedded clojure calls to helper functions using cljs-api.edn
  • Allow insertion of new functions
  • Eventually use this system to document clojure functions
@shaunlebron
Copy link
Member Author

assoc!

function

(assoc! tcoll key val)
(assoc! tcoll key val & kvs)

Summary

assoc(iate) on transient collection

When applied to a transient map, adds mapping of key(s) to val(s).

When applied to a transient vector, sets the val at index. Note - index must
be <= (count vector).

Returns coll.

Examples

(def tcoll (transient! {}))
(assoc! tcoll :a 1)
(assoc! tcoll :b 2)

tcoll
;;=> #<[object Object]> 

(:a tcoll)
;;=> 1

(:b tcoll)
;;=> 2

(def a (persistent! tcoll))
;;=> {:a 1 :b 2}

See Also

  • transient
  • persistent!

Source

When applied to a transient map, adds mapping of key(s) to
val(s). When applied to a transient vector, sets the val at index.
Note - index must be <= (count vector). Returns coll.

clojurescript:src/main/cljs/cljs/core.cljs

(defn assoc!
  ([tcoll key val]
    (-assoc! tcoll key val))
  ([tcoll key val & kvs]
    (let [ntcoll (-assoc! tcoll key val)]
      (if kvs
        (recur ntcoll (first kvs) (second kvs) (nnext kvs))
        ntcoll))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant