Apparently this rule was preventing underscores from being displayed
(tested in recent versions of Chrome and Opera). Amusingly, searching
for a phrase including an underscore would cause it magically to
appear (in the same two browsers)...
This prevents me from running tests, presumably because test projects
& namespaces are not on the classpath. We could add them to the
classpath, but at least at first glance it seems useful to be able to
parse ns-defining code blocks which are not present on the
classpath (such as those in test/marginalia/test/parse.clj).
With this patch, Marginalia installs a custom keyword reader during
parsing.
This reader reuses clojure.lang.LispReader's readToken and matchSymbol
methods to read in either the whole keyword (when faced with a
single-colon keyword) or the part following the first colon (a
single-colon keyword, if we get to this case). Single-colon keywords
may have arbitrary namespace parts, so no aliasing issues arise.
The object returned depends on the type of keyword being read in:
* :foo, :foo/bar => just the keyword
* ::foo/bar => (DoubleColonKeyword. :foo/bar)
DCK's print-method writes out a single colon followed by the string
representation of the DCK's contents, for the genuine double-colon
keyword look.
Note that readToken and matchSymbol are private; this patch uses
clojure.contrib.reflect/call-method to call them.
Evaluating ns forms which :use some symbols gets as in trouble unless
we also evaluate the relevant definitions in the other namespace. This
leads to the issue of loading the namespaces in the correct order etc.
So, if we want to be able to generate docs without compiling the whole
project, the "eval ns forms" approach is a no-go. :-(
This patch introduces namespace tracking to Marginalia's parser: ns,
in-ns, require, use and alias forms are now evaluated in the proper
namespace at read-time. This is necessary to handle ::keywords in full
generality, since ::foo/bar is a valid token iff the symbol 'foo can
be resolved to a namespace at read time:
(in-ns 'test)
::foo/bar
; => invalid token results in read-time error
(require '[some.namespace :as foo])
::foo/bar
; => :some.namespace/foo
NB. only top-level #{ns in-ns require use alias} forms are recognized.
`multidoc!` generates a `toc.html` file containing the toc (with links)
and project info, and a bunch of `$namespace.html` files (one for each
.clj file).
Implemented basic test framework for working with source trees (similar
to what is done in http://github.com/technomancy/leiningen).
Basic functionality of writing separate source files to separate output
files.