File: docs.el

package info (click to toggle)
f-el 0.21.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: lisp: 2,375; makefile: 24
file content (35 lines) | stat: -rwxr-xr-x 973 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(defvar f-root-path
  (expand-file-name ".." (file-name-directory load-file-name)))

(defvar f-lib-file
  (expand-file-name "f.el" f-root-path))

(defvar f-readme-file
  (expand-file-name "README.org" f-root-path))

(defvar f-readme-template
  (expand-file-name "README.org.tpl" f-root-path))

(defvar f-fn-doc-mapping (make-hash-table :test 'equal))

(require 'f f-lib-file)

(-map
 (lambda (lib)
   (when (equal (car lib) f-lib-file)
     (-select
      (lambda (alist)
        (when (and
               (listp alist)
               (equal (car alist) 'defun)
               (s-matches-p "^f-[^-][a-z-]+\\??$" (symbol-name (cdr alist))))
          (puthash (symbol-name (cdr alist)) (documentation (cdr alist)) f-fn-doc-mapping)))
      (cdr lib))))
 load-history)

(let ((content (f-read f-readme-template)))
  (maphash
   (lambda (fn doc)
     (setq content (s-replace (concat "{{" fn "}}") doc content)))
   f-fn-doc-mapping)
  (f-write content 'utf-8 f-readme-file))