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
```cl
!map (fn list)
!reduce-from (fn initial-value list)
!reduce (fn list)
!filter (fn list)
!remove (fn list)
!concat (&rest lists)
!mapcat (fn list)
!partial (fn &rest args)
!difference (list list2)
!intersection (list list2)
!uniq (list)
!contains? (list element)
```
* [!map](#map-fn-list) `(fn list)`
* [!reduce-from](#reduce-from-fn-initial-value-list) `(fn initial-value list)`
* [!reduce](#reduce-fn-list) `(fn list)`
* [!filter](#filter-fn-list) `(fn list)`
* [!remove](#remove-fn-list) `(fn list)`
* [!concat](#concat-rest-lists) `(&rest lists)`
* [!mapcat](#mapcat-fn-list) `(fn list)`
* [!partial](#partial-fn-rest-args) `(fn &rest args)`
* [!difference](#difference-list-list2) `(list list2)`
* [!intersection](#intersection-list-list2) `(list list2)`
* [!uniq](#uniq-list) `(list)`
* [!contains?](#contains-list-element) `(list element)`
There are also anaphoric versions of these functions where that makes sense,
prefixed with two bangs instead of one.

@ -4,4 +4,4 @@ if [ -z "$EMACS" ] ; then
EMACS="emacs"
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 '())
(defun example-to-string (example)
@ -39,10 +41,27 @@
docstring
(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)
(let ((command-name (car 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 ()
(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
```cl
[[ function-list ]]
```
There are also anaphoric versions of these functions where that makes sense,
prefixed with two bangs instead of one.

Loading…
Cancel
Save