Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

codify function documentation headers

  • Loading branch information...
commit f5f11586cfcd57d5ae921dfdc70a940221e036f7 1 parent 1b8c329
@mgalgs authored
Showing with 20 additions and 11 deletions.
  1. +7 −7 README.md
  2. +13 −4 make-readme-markdown.el
View
14 README.md
@@ -72,31 +72,31 @@ an issue at https://github.com/mgalgs/make-readme-markdown/issues
Function Documentation
----------------------
-### (strip-comments LINE)
+### `(strip-comments LINE)`
Stip elisp comments from line
-### (trim-string LINE)
+### `(trim-string LINE)`
Trim spaces from beginning and end of string
-### (fix-symbol-references LINE)
+### `(fix-symbol-references LINE)`
Fix refs like `this` so they don't turn adjacent text into code.
-### (print-section LINE CHAR)
+### `(print-section LINE CHAR)`
Prints a markdown section using the underline syntax.
-### (slurp)
+### `(slurp)`
Read all text from stdin as list of lines
-### (print-formatted-line LINE)
+### `(print-formatted-line LINE)`
Prints a line formatted as markdown.
-### (document-a-function)
+### `(document-a-function)`
Searches for next defun/macro and print markdown documentation.
View
17 make-readme-markdown.el
@@ -167,10 +167,19 @@
(eval (read (format "(function %s)" func))))))
(if (and (not (string-match "Not documented\\." text))
(string-match "(" text))
- (princ (fix-symbol-references
- (concat "### "
- (substring text (match-beginning 0))
- "\n\n"))))))))
+ (with-temp-buffer
+ (insert text)
+ (goto-char (match-beginning 0))
+ (forward-line)
+ (let* ((title-txt (buffer-substring (point)
+ (line-end-position)))
+ (rest (buffer-substring (line-beginning-position 2)
+ (point-max)))
+ (cleaned-rest (fix-symbol-references rest))
+ (printable (format "### `%s`\n%s\n\n"
+ title-txt
+ cleaned-rest)))
+ (princ printable))))))))
(let* ((line nil)
(title nil)
Please sign in to comment.
Something went wrong with that request. Please try again.