Make functions paragraph into a list of links

master
Magnar Sveen 14 years ago
parent eea3c533bb
commit 2a9e600186
  1. 26
      README.md
  2. 2
      create-docs.sh
  3. 21
      examples-to-docs.el
  4. 2
      readme-template.md

@ -10,20 +10,18 @@ This is so much a work in progress that you should definitely not be using it ye
## Functions ## Functions
```cl * [!map](#map-fn-list) `(fn list)`
!map (fn list) * [!reduce-from](#reduce-from-fn-initial-value-list) `(fn initial-value list)`
!reduce-from (fn initial-value list) * [!reduce](#reduce-fn-list) `(fn list)`
!reduce (fn list) * [!filter](#filter-fn-list) `(fn list)`
!filter (fn list) * [!remove](#remove-fn-list) `(fn list)`
!remove (fn list) * [!concat](#concat-rest-lists) `(&rest lists)`
!concat (&rest lists) * [!mapcat](#mapcat-fn-list) `(fn list)`
!mapcat (fn list) * [!partial](#partial-fn-rest-args) `(fn &rest args)`
!partial (fn &rest args) * [!difference](#difference-list-list2) `(list list2)`
!difference (list list2) * [!intersection](#intersection-list-list2) `(list list2)`
!intersection (list list2) * [!uniq](#uniq-list) `(list)`
!uniq (list) * [!contains?](#contains-list-element) `(list element)`
!contains? (list element)
```
There are also anaphoric versions of these functions where that makes sense, There are also anaphoric versions of these functions where that makes sense,
prefixed with two bangs instead of one. prefixed with two bangs instead of one.

@ -4,4 +4,4 @@ if [ -z "$EMACS" ] ; then
EMACS="emacs" EMACS="emacs"
fi fi
$EMACS -batch -l examples-to-docs.el -l bang.el -l examples.el -f create-docs-file $EMACS -batch -l bang.el -l examples-to-docs.el -l examples.el -f create-docs-file

@ -1,3 +1,5 @@
(require 'bang)
(defvar functions '()) (defvar functions '())
(defun example-to-string (example) (defun example-to-string (example)
@ -39,10 +41,27 @@
docstring docstring
(mapconcat 'identity (three-first examples) "\n")))) (mapconcat 'identity (three-first examples) "\n"))))
(defun split-name (s)
"Split name into list of words"
(split-string
(let ((case-fold-search nil))
(downcase
(replace-regexp-in-string "\\([a-z]\\)\\([A-Z]\\)" "\\1 \\2" s)))
"[^A-Za-z0-9]+"))
(defun dashed-words (s)
"Convert string S to snake-case string."
(mapconcat 'identity (mapcar
'(lambda (word) (downcase word))
(!!remove (equal it "") (split-name s))) "-"))
(defun github-id (command-name signature)
(dashed-words (format "%s %s" command-name signature)))
(defun function-summary (function) (defun function-summary (function)
(let ((command-name (car function)) (let ((command-name (car function))
(signature (cadr function))) (signature (cadr function)))
(format "%s %s" command-name signature))) (format "* [%s](#%s) `%s`" command-name (github-id command-name signature) signature)))
(defun simplify-quotes () (defun simplify-quotes ()
(goto-char (point-min)) (goto-char (point-min))

@ -10,9 +10,7 @@ This is so much a work in progress that you should definitely not be using it ye
## Functions ## Functions
```cl
[[ function-list ]] [[ function-list ]]
```
There are also anaphoric versions of these functions where that makes sense, There are also anaphoric versions of these functions where that makes sense,
prefixed with two bangs instead of one. prefixed with two bangs instead of one.

Loading…
Cancel
Save