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