-
Notifications
You must be signed in to change notification settings - Fork 97
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
Support simultaneous Clojure & ClojureScript output #220
base: master
Are you sure you want to change the base?
Conversation
Author: @ptaoussanis - This implementation attempts to be minimally invasive. Most of the logical changes are within `html/write-index` and `html/write-namespaces`, where a special path is introduced for cross-platform projects. - NO behavioural changes are intended for traditional (non-cross-platform) projects. - See weavejester#216 for detailed feature discussion.
Author: @ptaoussanis This is an advanced option to help prevent any broken doc links when upgrading a project's docs from single language to dual language. In this case, :base-language can be set to the previous (single) language for which doc links may already exist in the wild. In detail, if cross-platform project then: {:base-language nil} => ".clj", ".cljs" file extensions ; Default {:base-language :clojure} => nil, ".cljs" file extensions {:base-language :clojurescript} => ".clj", nil file extensions For example: Library Foo previously used {:language :clojure} (either because it was Clojure only, or because of limitations in Codox). Various links to Foo's Codox documentation now exist in the wild. Foo's authors want to change to cross-platform, but don't want to break pre-existing links in the wild. In this case, Foo's authors can use the following opts: {:language #{:clojure :clojurescript} :base-language :clojure} This will produce files like the following: com.foolib.html ; For Clojure platform com.foolib.cljs.html ; For ClojureScript platform Any pre-existing links will successfully point to the same (Clojure) docs they did previously.
Author: @ptaoussanis Note that this commit introduces new classes to `default.css` used (only) by "cross-platform" projects. This means: - NO behavioural changes are intended for non-cross-platform projects. - Cross-platform projects WILL require a theme that includes the new CSS classes.
be6d7ed
to
cf166eb
Compare
Can you briefly go over the changes to the internal project map? I'm not sure I understand the purpose of sorting, or the |
Sure, can do. So the general flow of changes is as follows: 1:
|
What if we ordered the languages. So the configuration would be: {:languages [:clojure, :clojurescript]} This would provide an explicit sort order. We deprecate (defn- convert-deprecated-language-option [options]
(cond-> options
(contains? options :language)
(-> (update :languages (fnil conj []) (:language options))
(dissoc :language)))) When it comes to generating the internal data structure, my suggestion would be to wrap the namespaces in a platform map, and do nothing more, at least not in the Instead, my thought is that information would be better placed in the writer. (defn- cross-platform? [{:keys [languages]}]
(> (count languages) 1)) As for var-langs, again that seems like something the writer could calculate on the fly. Iterate through all the namespaces and create the index when we need it, rather than ahead of time. After all, there's no guarantee that a particular writer will actually want that index; i.e. we could imagine a Markdown writer that might not care. |
Hi James, thanks for your thoughts on this! Unfortunately I need to shift my attention elsewhere, so won't be able to continue on this issue. Please feel free to use anything in my PR if it's helpful, or to close it if you prefer. Thanks again for all your assistance on this (and all your work on Codox, and other libs besides)! And again, my apologies. |
No problem! There's quite a bit here I can use. When I get a little time free I'll see about polishing off the implementation. Thanks for all your work on this so far. |
Fixes #216.
Live examples of the current cross-platform output:
High-level notes
Implementation notes
{:language :clojure}
or{:language :clojurescript}
.project
map for conveying relevant internal state. I'm satisfied with this approach, but drawing attention to it in case you feel differently.html/write-documents
code, and haven't tested it specifically - but I see no reason why this PR should cause any problems with it.Thanks!