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

Possible issue with patterned :source-uri option? #118

Closed
ptaoussanis opened this issue Feb 24, 2016 · 1 comment
Closed

Possible issue with patterned :source-uri option? #118

ptaoussanis opened this issue Feb 24, 2016 · 1 comment
Labels

Comments

@ptaoussanis
Copy link

Hi James,

Am running Codox 0.9.4 with Clojure 1.8, project.clj config is:

  :codox
  {:language :clojure
   :source-paths ["target/classes"]
   :source-uri
   {#"target/classes" "https://github.com/ptaoussanis/sente/blob/master/src/{classpath}x#L{line}"
    #".*"             "https://github.com/ptaoussanis/sente/blob/master/{filepath}#L{line}"}}

This matches up closely to the current example in the Codox README:

:codox
{:source-uri
 {#"target/classes" "https://github.com/foo/bar/blob/master/src/{classpath}x#L{line}"
  #".*"             "https://github.com/foo/bar/blob/master/{filepath}#L{line}"}

A user just reported that the source links are broken, generating links like
https://github.com/ptaoussanis/sente/blob/master/target/classes/taoensso/sente.clj#L102
instead of
https://github.com/ptaoussanis/sente/blob/master/src/taoensso/sente.cljx#L102 (which I'd expect with the given config).

On the road atm so only spent a minute looking at this, but removing the #".*" config entry seems to correct the links. Given that the source-uri Regexes are provided through map keys (unordered), I'm wondering if the issue might be a linear search somewhere like this: https://github.com/weavejester/codox/blob/master/codox/src/codox/writer/html.clj#L119

(Just skimmed the code quick; no idea if this particular code path is relevant).

Have I got the config wrong? Or, assuming this could be an ordering issue, any chance we could instead specify :source-uri variations as a vector?

Thanks a lot for your assistance + work on Codox, cheers!

@ptaoussanis ptaoussanis changed the title Possible issue with :source-uri option? Possible issue with patterned :source-uri option? Feb 24, 2016
@weavejester
Copy link
Owner

Yes, this looks like an ordering bug that slipped my mind when I wrote the README. I guess the solution would be to allow an ordered data structure like a vector to be used in place of a map.

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

No branches or pull requests

2 participants