emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dash 2a9e600 046/439: Make functions paragraph into a l


From: Phillip Lord
Subject: [elpa] externals/dash 2a9e600 046/439: Make functions paragraph into a list of links
Date: Tue, 04 Aug 2015 20:26:13 +0000

branch: externals/dash
commit 2a9e600186a7e7cf57bc15e10eef3f082bf7fef1
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>

    Make functions paragraph into a list of links
---
 README.md           |   26 ++++++++++++--------------
 create-docs.sh      |    2 +-
 examples-to-docs.el |   21 ++++++++++++++++++++-
 readme-template.md  |    2 --
 4 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/README.md b/README.md
index 696ed18..b3db2e7 100644
--- a/README.md
+++ b/README.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.
diff --git a/create-docs.sh b/create-docs.sh
index 462a312..3bb561e 100755
--- a/create-docs.sh
+++ b/create-docs.sh
@@ -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
diff --git a/examples-to-docs.el b/examples-to-docs.el
index 760c57c..12a9c25 100644
--- a/examples-to-docs.el
+++ b/examples-to-docs.el
@@ -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))
diff --git a/readme-template.md b/readme-template.md
index aa7f6bc..d3132e7 100644
--- a/readme-template.md
+++ b/readme-template.md
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]