X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Frstdoc.el;h=5b8a9d01311b4d3055bec7af4d6f45832d661f51;hb=3a175ddffba61e49197190127621684c8f5b18a8;hp=92a337c841fad6bbf90ca8d0772c9a00cf65f099;hpb=e63f37a4a90c5d2a399a99a0566b6e1dfea263aa;p=notmuch diff --git a/emacs/rstdoc.el b/emacs/rstdoc.el index 92a337c8..5b8a9d01 100644 --- a/emacs/rstdoc.el +++ b/emacs/rstdoc.el @@ -1,4 +1,4 @@ -;;; rstdoc.el --- help generate documentation from docstrings -*-lexical-binding: t-*- +;;; rstdoc.el --- help generate documentation from docstrings -*- lexical-binding: t -*- ;; Copyright (C) 2018 David Bremner @@ -24,7 +24,6 @@ ;; ;;; Commentary: -;; ;; Rstdoc provides a facility to extract all of the docstrings defined in ;; an elisp source file. Usage: @@ -33,8 +32,6 @@ ;;; Code: -(provide 'rstdoc) - (defun rstdoc-batch-extract () "Extract docstrings to and from the files on the command line." (apply #'rstdoc-extract command-line-args-left)) @@ -43,6 +40,7 @@ "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,11 +66,15 @@ (insert "\n")) (defvar rst--escape-alist - '( ("\\\\='" . "\\\\'") - ("\\([^\\]\\)'" . "\\1`") - ("^[[:space:]\t]*$" . "|br|") - ("^[[:space:]\t]" . "|indent| ")) - "List of (regex . replacement) pairs.") + '( ("\\\\='" . "\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) (with-temp-buffer @@ -83,4 +85,6 @@ (replace-match (cdr pair)))) (buffer-substring (point-min) (point-max)))) +(provide 'rstdoc) + ;;; rstdoc.el ends here