X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Frstdoc.el;h=4221f142ce74e1ea6598fc4118e02d9b6439d253;hb=b4ee80dcbdd6702a693110321ad69c380967846d;hp=2af91186863db5804f3ebd0ac653fcdfd8c427c0;hpb=a4617f29ce81e7ae3e0cb747fdb9070f88407a28;p=notmuch diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el index 2af91186..4221f142 100644 --- a/emacs/rstdoc.el +++ b/emacs/rstdoc.el @@ -24,7 +24,6 @@ ;; ;;; Commentary: -;; ;; Rstdoc provides a facility to extract all of the docstrings defined in ;; an elisp source file. Usage: @@ -33,16 +32,15 @@ ;;; Code: -(provide 'rstdoc) - (defun rstdoc-batch-extract () - "Extract docstrings to and from the files on the command line" + "Extract docstrings to and from the files on the command line." (apply #'rstdoc-extract command-line-args-left)) (defun rstdoc-extract (in-file out-file) - "Write docstrings from IN-FILE to OUT-FILE" + "Write docstrings from IN-FILE to OUT-FILE." (load-file in-file) (let* ((definitions (cdr (assoc (expand-file-name in-file) load-history))) + (text-quoting-style 'grave) (doc-hash (make-hash-table :test 'eq))) (mapc (lambda (elt) @@ -68,10 +66,13 @@ (insert "\n")) (defvar rst--escape-alist - '( ("\\\\='" . "\\\\'") - ("\\([^\\]\\)'" . "\\1`") - ("^[[:space:]\t]*$" . "|br|") - ("^[[:space:]\t]" . "|indent| ")) + '( ("\\\\='" . "\001") + ("`\\([^\n`']*\\)[`']" . "\002\\1\002") ;; good enough for now... + ("`" . "\\\\`") + ("\001" . "'") + ("\002" . "`") + ("^[[:space:]]*$" . "|br|") + ("^[[:space:]]" . "|indent| ")) "list of (regex . replacement) pairs") (defun rstdoc--rst-quote-string (str) @@ -83,4 +84,6 @@ (replace-match (cdr pair)))) (buffer-substring (point-min) (point-max)))) +(provide 'rstdoc) + ;;; rstdoc.el ends here