clojure-grimoire / grimoire

Community documentation of Clojure
http://conj.io
159 stars 41 forks source link

The .. macro docs are inaccessible #241

Closed Biserkov closed 7 years ago

Biserkov commented 8 years ago

I looked around, but couldn't find where the magic actually happens. If someone can point me in the right direction I'm willing to make a PR.

Cause:

Browsers interpret the .. at the end of the URL as a relative URL which points to the parent directory.

conj.io/store/v1/org.clojure/clojure/1.8.0/clj/clojure.core/%2E%2E

becomes

conj.io/store/v1/org.clojure/clojure/1.8.0/clj/

Suggested workaround:

ClojureDocs fixes this by adding an underscore:

clojuredocs.org/clojure.core/_..

arrdem commented 8 years ago

Interesting. This is a long known bug, as you said due to the way that browsers interpret .. Technically according to the URL encoding spec, . urlencodes to itself, so the tactic of urlencoding to work around this is browser dependent. IIRC on Firefox where I originally implemented the %2E hack it worked, Chrome and other browsers aren't quite so happy with this workaround.

Way back when I solved this particular problem by munging . to _DOT_ and ? to _QMARK_ along with some other such changes. This is all visible in the lib-grimoire repo's history, and there are remains of it in the upgrade-munge code.

I honestly don't remember what all would be required to make this work, although I'm sure there are a couple more or less hacky implementations possible. I'll take a look today.

arrdem commented 7 years ago

Okay. So I started looking into this.... it looks like I was relying on spec-unsupported behavior. There's gonna have to be some other munging strategy here. Probably the best thing to do is to just bring the old augmented clojure.core/munge back from the reflog. Sigh.

arrdem commented 7 years ago

I have a working patch for this locally. Will try and get it finished/deployed today.

Biserkov commented 7 years ago

Cool!

From: Reid D McKenzie Sent: 05 декември 2016 г. 19:14 To: clojure-grimoire/grimoire Cc: Jordan Biserkov; Author Subject: Re: [clojure-grimoire/grimoire] The .. macro docs are inaccessible(#241)

I have a working patch for this locally. Will try and get it finished/deployed today. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

arrdem commented 7 years ago

Well the last patch got part of the way there

clojure.core/. clojure.core/..

but the generated links on the cheatsheet page are still hosed for some reason. More debugging work required there.

arrdem commented 7 years ago

There we go. The link to .. in the cheatsheet works against the live site, as does searching for . or .. :smile: