Open srackham opened 13 years ago
The following patch fixes the CoffeeScript issue, and it looks from this example http://joapp.com/docs/#joDoc like the Perl version of jodoc undents and would be fine with CoffeScript outputs, but I haven't tested it.
diff --git a/lib/jodoc-lib.js b/lib/jodoc-lib.js
index 41a7664..bfad125 100644
--- a/lib/jodoc-lib.js
+++ b/lib/jodoc-lib.js
@@ -10,14 +10,17 @@ var external_regex = /(\<a)\s+(href="(?:http[s]?|mailto|ftp)
// input: "code"
// output: "comments"
function docker (input) {
- var strip_code = /\057\*\*(?:.|[\r\n])*?\*\057/gm;
+ var strip_code = /^( *)\057\*\*(?:.|[\r\n])*?\*\057/gm;
var strip_stars = /(\*\057|\057\*\*)/g;
var strip_extra_whitespace = /([\r\n]+)\s/g;
+ var strip_indent;
var output = [];
var a;
while ((a = strip_code.exec(input)) !== null)
{
+ strip_indent = new RegExp("^" + a[1], "gm");
a = a[0];
+ a = a.replace(strip_indent, '');
a = a.replace(strip_stars,'');
a = a.replace(strip_extra_whitespace, '$1');
output.push(a);
Make the strip_code regexp a configuration option and jodoc should work with virtually any language with block comments.
Block comments generated by CoffeeScript are indented to align with the code rendering the Markdown unusable e.g.
Compiles to:
To fix this jodoc would need to unindent by the leading comment delimiter indent.