marklogic-community / RunDMC

MarkLogic application for running a developer site
http://developer.marklogic.com/code/rundmc
Other
17 stars 18 forks source link

links to Java Client javadoc failing from within other pages #691

Open kcoleman-marklogic opened 7 years ago

kcoleman-marklogic commented 7 years ago

We're supposed to be able to link to the Java Client API apidoc (javadoc) from within the guide text. I think there's some fixup that happens either during ingestion or before that. In any case, the resulting links aren't working.

There's some examples on this page: http://docs.marklogic.com/guide/semantics/clientAPIs. Just search for the phrase "java client api documentation".

If you click on one of those links, no javadoc comes up, and the Chrome dev tools report the following error:

Uncaught TypeError: Cannot read property '0' of null
    at extractContainer (jquery.pjax.js:701)
    at m.fn.init.options.success (jquery.pjax.js:263)
    at j (jquery-1.11.2.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-1.11.2.min.js:2)
    at x (jquery-1.11.2.min.js:4)
    at XMLHttpRequest.b (jquery-1.11.2.min.js:4)

If you instead do "copy link address" and paste it into a new tab, it loads fine. The link address you get is http://docs.marklogic.com/javadoc/client/index.html.

The href in the page source looks like this: <a href="/javadoc/client/index.html">. I think that should be OK, which is why I'm filing this against RunDMC instead of pointing fingers at the pre-processing. Of course, it might ultimately requiring fixing on that end to wriggle around this.

However, on the wire, the request has some extra pjax cruft on the end, as shown below. Could that be making a mess?

http://docs.marklogic.com/javadoc/client/index.html?_pjax=%23page_content

This is not an urgent issue, but it would be nice to get some better informed input as to possible cause. My web app skills are easily tapped out. Could it be as simple as needing to include a target="_blank" in the href transform?

kcoleman-marklogic commented 7 years ago

I think linking magic is courtesy of src/apidoc/config/title-aliases.xml and stp:list-page-root in src/apidoc/setup/setup.xqm.

If adding target="_blank" is the right answer, that function needs to get a bit smarter (or dumber, depending on how you look at it) in how it handles the <auto-link> element. For example, copy all the attrs instead of just @href so we could slap @target in as needed, such as for the other javadoc bundles.

dmcassel commented 7 years ago

Able to reproduce locally.