Added support for defprotocol docstring

This commit is contained in:
fogus 2011-01-05 12:36:27 -05:00
parent 1e257ba0a1
commit 8b3ab21e85
7 changed files with 33 additions and 10 deletions

View file

@ -16,15 +16,15 @@ Currently Marginalia can be used in a number of ways as described below.
### Command Line
You can download the [Marginalia 0.2.3 jar including packaged dependencies from Github](https://github.com/downloads/fogus/marginalia/marginalia-0.2.3-standalone.jar).
You can download the [Marginalia 0.2.4 jar including packaged dependencies from Github](https://github.com/downloads/fogus/marginalia/marginalia-0.2.4-standalone.jar).
Running Marginalia given the jar file linked above is as easy as:
java -jar marginalia-0.2.3-standalone.jar
java -jar marginalia-0.2.4-standalone.jar
This will search the `PWD` for a `src` directory which it will then traverse looking for Clojure source files to parse and generate documentation for. Marginalia also takes specific locations and files to generate docs for:
java -jar marginalia-0.2.3-standalone.jar <file1> <file2> ... <filen>
java -jar marginalia-0.2.4-standalone.jar <file1> <file2> ... <filen>
Arguments can be specific files or directories.
@ -32,7 +32,7 @@ Arguments can be specific files or directories.
To use Marginalia in your own projects simply add the following to your `project.clj` file in the `:dev-dependencies` section:
[marginalia "0.2.3"]
[marginalia "0.2.4"]
After executing `lein deps` you can generate your complete source documentation with the following command:

View file

@ -1,4 +1,4 @@
(defproject marginalia "0.2.3"
(defproject marginalia "0.2.4"
:description "lightweight literate programming for clojure -- inspired by [docco](http://jashkenas.github.com/docco/)"
:main marginalia.core
:dependencies
@ -12,7 +12,7 @@
;;Needed for testing lein plugin
[hiccup "0.3.0"]
[org.clojars.nakkaya/markdownj "1.0.2b4"]
[marginalia "0.2.3"]]
[marginalia "0.2.4"]]
;;Needed for testing cake plugin
:tasks [marginalia.tasks]
;;Needed for testing Latex equation formatting. You must download

View file

@ -3260,4 +3260,16 @@ See <a href="https://github.com/fogus/marginalia/issues/#issue/4">https://github
&lt;array-end&gt; \]
&lt;object-start&gt; \{
&lt;object-end&gt; \})</pre></td></tr><tr><td class="spacer docs">&nbsp;</td><td class="codes" /></tr></table><div class="footer">Generated by <a href="https://github.com/fogus/marginalia">marginalia</a>.&nbsp;&nbsp;Syntax highlighting provided by Alex Gorbatchev's <a href="http://alexgorbatchev.com/SyntaxHighlighter/">SyntaxHighlighter</a><div id="floating-toc"><ul><li class="floating-toc-li" id="floating-toc_leiningen.marg">leiningen.marg</li><li class="floating-toc-li" id="floating-toc_marginalia.core">marginalia.core</li><li class="floating-toc-li" id="floating-toc_marginalia.html">marginalia.html</li><li class="floating-toc-li" id="floating-toc_marginalia.tasks">marginalia.tasks</li><li class="floating-toc-li" id="floating-toc_problem-cases.general">problem-cases.general</li></ul></div></div><script type="text/javascript">SyntaxHighlighter.defaults['gutter'] = false;
SyntaxHighlighter.all()</script></body></html>
SyntaxHighlighter.all()</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-921112-2");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body></html>

View file

@ -3,7 +3,7 @@
## Usage
1. Add `[marginalia \"0.2.3\"]` to your project.clj's `:dev-dependencies` section.
1. Add `[marginalia \"0.2.4\"]` to your project.clj's `:dev-dependencies` section.
2. run `lein marg` from your project's root directory. "
(:use [marginalia.core]))

View file

@ -144,6 +144,10 @@
;; decl, and does the current line start with a quote?
(and (re-find #"^\(ns" last-code-text)
(re-find #"^\"" (str/trim (str line))))
;; Is the last line's code-text the start of a defprotocol,
;; and does the current line start with a quote?
(and (re-find #"^\(defprotocol" last-code-text)
(re-find #"^\"" (str/trim (str line))))
;; Is the prev line a docstring, prev line not end with a quote,
;; and the current line empty?
(and (:docstring-text l)

View file

@ -3,7 +3,7 @@
## Usage
1. In your project.clj, add `[marginalia \"0.2.3\"] to your `:dev-dependencies` and `marginalia.tasks` to `:tasks`
1. In your project.clj, add `[marginalia \"0.2.4\"] to your `:dev-dependencies` and `marginalia.tasks` to `:tasks`
2. Run `cake marg` from within your project directory."
(:use marginalia.core
[cake.core :only [deftask]]))

View file

@ -21,6 +21,13 @@
"Here is just a string. It should be to the right."
(* x x))
(defprotocol CacheProtocol
"This is a protocol docstring. It should be on the left."
(lookup [cache e])
(has? [cache e] )
(hit [cache e])
(miss [cache e ret]))
(def ^{:doc "This is also a docstring via metadata. It should be on the left."}
a 42)
@ -48,4 +55,4 @@
<array-start> \[
<array-end> \]
<object-start> \{
<object-end> \})
<object-end> \})