Find the least indented line instead of just using the second one. Also encourage using verbatim strings («») in docstrings.
Showing the changes to src (2 of 3 files). Show all
Unified · Split
| @@ -19,16 +19,16 @@ · 18 unmodified lines | ||
| 19 | 19 | by `defstruct` to provide full constructor description in the output.» |
| 20 | 20 | :doc-example |
| 21 | 21 | «(defdoc (func arg (arg2 0)) |
| 22 | − "Return something about the `arg` and `arg2`. This is a short | |
| 22 | + «Return something about the `arg` and `arg2`. This is a short | |
| 23 | 23 | description. |
| 24 | 24 | |
| 25 | − This is the longer description, following the short one." | |
| 25 | + This is the longer description, following the short one.\» | |
| 26 | 26 | :doc-example |
| 27 | − "(func 0) | |
| 28 | − ; ↳ T" | |
| 27 | + «(func 0) | |
| 28 | + ; ↳ T\» | |
| 29 | 29 | :doc-example |
| 30 | − "(func 1 3) | |
| 31 | − ; ↳ NIL" | |
| 30 | + «(func 1 3) | |
| 31 | + ; ↳ NIL\» | |
| 32 | 32 | :doc-group stuff |
| 33 | 33 | :doc-see func2 |
| 34 | 34 | :doc-fmt (λ (doc) doc) |
| @@ -169,14 +169,10 @@ · 168 unmodified lines | ||
| 169 | 169 | (let* {[lines (str-split s "\n")] |
| 170 | 170 | [hd (car lines)] |
| 171 | 171 | [tl (cdr lines)] |
| 172 | − [snd (any (λ (s) (and (> (length s) 0) | |
| 173 | − (rune-whitespace? (str-rune s 0)) | |
| 174 | − s)) | |
| 175 | − tl)] | |
| 176 | − [indent (and snd | |
| 177 | − (- (length snd) | |
| 178 | − (length (str-trim snd))))] | |
| 179 | − [trimmed (and snd | |
| 172 | + [indent (and tl (apply min (map (λ (s) (and (> (length s) 0) | |
| 173 | + (- (length s) (length (str-trim s))))) | |
| 174 | + tl)))] | |
| 175 | + [trimmed (and tl | |
| 180 | 176 | (map (λ (s) (if (<= indent (length s)) |
| 181 | 177 | (str-sub s indent) |
| 182 | 178 | s)) |
| @@ -1658,7 +1654,7 @@ · 1475 unmodified lines | ||
| 1658 | 1654 | «Define a new macro.» |
| 1659 | 1655 | :doc-example |
| 1660 | 1656 | «(defmacro (inc! v) |
| 1661 | − "Increments and returns the value." | |
| 1657 | + «Increments and returns the value.\» | |
| 1662 | 1658 | :doc-group my-cool-macros |
| 1663 | 1659 | :doc-see my-other-cool-macro |
| 1664 | 1660 | (if (num? v) |
| @@ -1749,10 +1745,10 @@ · 84 unmodified lines | ||
| 1749 | 1745 | :doc-example |
| 1750 | 1746 | «; a function with documentation (first form) |
| 1751 | 1747 | (def (f x) |
| 1752 | − "Return the square of doubled `x`." | |
| 1748 | + «Return the square of doubled `x`.\» | |
| 1753 | 1749 | :doc-example |
| 1754 | − "(f 3) | |
| 1755 | − ; ↳ 36" | |
| 1750 | + «(f 3) | |
| 1751 | + ; ↳ 36\» | |
| 1756 | 1752 | :doc-group cool-funcs ; documentation group for (help groups) |
| 1757 | 1753 | :doc-see g ; reference another function in the documentation |
| 1758 | 1754 | (def (g y) ; an internal function |
| @@ -2110,7 +2106,7 @@ · 351 unmodified lines | ||
| 2110 | 2106 | If no `else` was specified and no matches occured, `NIL` is |
| 2111 | 2107 | returned.» |
| 2112 | 2108 | :doc-example |
| 2113 | − «(case 'c ; match present | |
| 2109 | + «(case 'c ; match present | |
| 2114 | 2110 | (a 0) |
| 2115 | 2111 | ((b c d) 1)) |
| 2116 | 2112 | ; ↳ b» |
| @@ -2122,7 +2118,7 @@ · 5 unmodified lines | ||
| 2122 | 2118 | (newline)) |
| 2123 | 2119 | ; ‼ yay» |
| 2124 | 2120 | :doc-example |
| 2125 | − «(case "c" ; no matches, without else | |
| 2121 | + «(case "c" ; no matches, without else | |
| 2126 | 2122 | ("a" 0) |
| 2127 | 2123 | ("b" 1)) |
| 2128 | 2124 | ; ↳ NIL» |