weavejester / codox

Clojure documentation tool
Eclipse Public License 1.0
668 stars 97 forks source link

{git-commit} for Source Links #168

Open UweHubert opened 6 years ago

UweHubert commented 6 years ago

Problem We can not link to the exact code of a SNAPSHOT using the :source-uri.

Either we are forced to use the master branch, which is not desirable, as this renders links in old documentation useless. Or we would wind up with the snapshot version in the source link:

http://gerrit.mydomain.de/gitlist/myproject.git/blob/0.6.0-SNAPSHOT/src/de/mydomain/foo/bar.clj#L23

That would force us to use branches for this sole purpose, leaving us with the same problem of documentation links pointing to changing source code.

Proposed solution Allowing a placeholder ({git-commit}) for :source-uri that is replaced with the Git commit id.

:codox {:source-uri "http://gerrit.mydomain.de/gitlist/myproject.git/blob/{git-commit}/{filepath}#L{line}"}

Which would result in:

http://gerrit.mydomain.de/gitlist/myproject.git/blob/17073c0db441f5550a6cdbd1e5d2143ae6f5b576/src/de/mydomain/foo/bar.clj#L23

If you are generally interested in this solution we can supply a patch.

weavejester commented 6 years ago

I think sounds reasonable.