]> code.delx.au - gnu-emacs-elpa/blobdiff - doc/ivy-ox.el
Bump version to 0.8.0
[gnu-emacs-elpa] / doc / ivy-ox.el
index cb0d2fc496c0b6f27e9010015a2a715bd15b60bc..cb69c7f239d943cb3494007b0583c428e336aa31 100644 (file)
@@ -123,14 +123,47 @@ contextual information."
                       (t "table"))))
     (if (equal list-type "table")
         (mapconcat (lambda (s)
-                     (concat "@subsubheading" s))
-                   (split-string (substring-no-properties contents) "^@item" t)
+                     (cond ((string-match "\\`User Option @code{\\(.*\\)}$" s)
+                            (format "@defopt %s\n%s\n@end defopt\n"
+                                    (match-string-no-properties 1 s)
+                                    (string-trim
+                                     (substring s (1+ (match-end 1))))))
+                           ((string-match "\\(.*\\)$" s)
+                            (let* ((line (match-string 1 s))
+                                   (body (string-trim
+                                          (substring s (1+ (match-end 1)))))
+                                   (symbol-index
+                                    (if (string-match "@code{\\(\\(?:ivy\\|swiper\\|counsel\\)-[^}]+\\)}" line)
+                                        (format "@vindex %s\n" (match-string 1 line))
+                                      ""))
+                                   (key-index
+                                    (apply #'concat
+                                           (mapcar
+                                            (lambda (s)
+                                              (format "@kindex %s\n" s))
+                                            (iox-extract-kbd line)))))
+                              (format "@subsubheading %s\n%s@indentedblock\n%s\n@end indentedblock"
+                                      line
+                                      (concat symbol-index
+                                              key-index)
+                                      body)))
+                           (t
+                            (concat "@subsubheading " s))))
+                   (split-string (substring-no-properties contents) "^@item " t)
                    "\n")
       (format "@%s\n%s@end %s"
               (if (eq type 'descriptive) (concat list-type " " indic) list-type)
               contents
               list-type))))
 
+(defun iox-extract-kbd (str)
+  (let ((start 0)
+        res)
+    (while (string-match "@kbd{\\([^}]+\\)}" str start)
+      (setq start (match-end 0))
+      (push (match-string 1 str) res))
+    (nreverse res)))
+
 ;;* ox-html
 (require 'ox-html)
 (setq org-html-validation-link nil)
@@ -144,4 +177,17 @@ contextual information."
         (verbatim . "<code>%s</code>")))
 (setq org-html-style-default nil)
 
+(defvar ivy-info-dir (file-name-directory
+                      (or load-file-name
+                          (buffer-file-name))))
+
+(defun info-ivy ()
+  (interactive)
+  (let ((buf (get-buffer "*info*")))
+    (when buf
+      (kill-buffer buf)))
+  (Info-find-node
+   (expand-file-name "ivy.info" ivy-info-dir)
+   "Top"))
+
 (provide 'ivy-ox)