ocamllabs / opam-doc

Produce documentation for libraries installed with OPAM
22 stars 9 forks source link

Handle local links using javascript #60

Closed lpw25 closed 10 years ago

lpw25 commented 11 years ago

At the moment links do not depend on their context. For example, a link within Std_internal to Std_internal.List will still point to Std_internal.List even when looking at it through Std (which includes Std_internal).

To fix this local links should be treated specially, and should call some JavaScript rather than point to a URL.

This could also be used when following links to components within submodules of the current module, to expand the submodule rather than load it as a page.

dsheets commented 11 years ago

If each referent has a real URL, we can set the links' @hrefs to that URL and also set a @class of "internal". Then, we can intercept click events on elements matching a[@class="internal"] and decompose the URL/fragment and load that referent in context.

lpw25 commented 11 years ago

That might work, but then we need to know how convert the real URL into the local URL. For example, a link to Foo.Bar.Baz may need to become This.Bar.Baz or This.Baz depending on whether Foo or Foo.Bar was included in This.

dsheets commented 11 years ago

Seems like an include map is needed. If dynamic expansions can introduce new include aliases, dynamic expansions need to append to this include map when they are activated.

lpw25 commented 10 years ago

This was fixed a while ago: internal links are now rewritten dynamically as they are included