On Feb 12, 3:31 pm, Craig Andera <craig.and...@gmail.com> wrote: > > Nice work! > > Thanks. > > > Two things related to 'strcat'. > > > 1) This is already implemented as clojure.core/str (and is more > > efficient than concat'ing) > > 2) This function is never called :) > > Yeah, that code was cut and pasted from some older work I did. It was > removed when I started using prxml. > > > I have some idea's related to the presentation, but I don't have time > > to iterate them right now. > > Well, pass them on whenever you get a minute. I've recently made some > updates that are live on github [1] that may have addressed what you > have in mind. Specifically, I've added the ability to collapse/expand > an individual namespace or all namespaces. I've uploaded an updated > example to the files section of this group [2]. > > There are two more things I want to do, which probably won't be > complete until next week: > > * See if I can strip the docstring from the displayed source code, > since it's redundant. > * Move the code into clojure.contrib, probably under the namespace > clojure.contrib.gen-html-docs. > > Later, I may also have a look at making the symbols in the source code > hyperlinks to the relevant place in the docs. > > [1]http://github.com/candera/doc-browse/blob/master/core.clj > [2]http://clojure.googlegroups.com/web/clj-libs.html
Sorry for the delayed response. I think a problem with the current layout is that once you jump to one of the library sections you have to manually scroll back up to the index. There are a few different ways this could be solved. a) You could just add a "top" link to each library section banner. b) Only show the currently selected library, and hide the rest. c) Same as above, but also change the library navigation to a tree view. -> clojure.contrib.duck-streams -) *default-encoding* -) file -) pwd I did a quick implementation of B, and I think it makes the page feel less cluttered (but I still feel it could be better). However, I did add jQuery as a dependency. I'm not sure how 'light' you were trying to keep this, but jQuery could simplify your JS. Here is a diff: diff --git a/gen_html_docs.clj b/gen_html_docs.clj index eb3616d..2e7e46b 100644 --- a/gen_html_docs.clj +++ b/gen_html_docs.clj @@ -129,12 +129,21 @@ function toggle(targetid, linkid, textWhenOpen, textWhenClosed) } } +$(function() { + $('.lib-link').click(function() { + $('.library').hide(); + var libName = 'library-' + this.text; + $('.library[name=' + libName + ']').show(); + }); +}); + //]]> ") (def *style* " .library { + display: none; padding: 0.5em 0 0 0 } .all-libs-toggle,.library-contents-toggle @@ -350,8 +359,7 @@ visibility of the library contents." "Emits the HTML that documents the namespace identified by the symbol lib." [lib] - [:div {:class "library"} - [:a {:name (anchor-for-library lib)}] + [:div {:class "library" :name (anchor-for-library lib)} [:div {:class "library-name"} [:span {:class "library-contents-toggle"} "[ " @@ -388,7 +396,7 @@ lib, a symbol identifying that namespace." [lib] (let [ns (find-ns lib)] (if ns - [:a {:class "lib-link" :href (str "#" (anchor-for-library lib))} (str (ns-name ns))]))) + [:a {:class "lib-link" :href "#"} (str (ns-name ns))]))) (defn- generate-lib-links "Generates the list of hyperlinks to each namespace, given libs, a @@ -434,6 +442,7 @@ libraries." [:head [:title "Clojure documentation browser"] [:style *style*] + [:script {:type "text/javascript" :src "./jquery-1.3.1.js"} [:raw! ""]] [:script {:language "JavaScript" :type "text/javascript"} [:raw! *script*]] [:script {:language "JavaScript" :type "text/javascript"} Do with my idea as you wish. I just wanted to to throw it out there. I also think the code would be cleaner with the JS and CSS in their own files, but I admit having everything in-lined makes it easy to call. Oh, almost forgot--if you do happen to try out my patch you will notice all the links from 'miglayout.internal' on will not behave correctly. If you look at the DOM with Firebug you'll notice that the 'miglayout' DIV is not being closed and is capturing the others. I didn't have a chance to track down the problem, but you might want to take a look. -Ryan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---