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

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

[elpa] externals/dash 1b0d54f 044/426: Simplify readme generation.


From: Phillip Lord
Subject: [elpa] externals/dash 1b0d54f 044/426: Simplify readme generation.
Date: Tue, 04 Aug 2015 19:36:36 +0000

branch: externals/dash
commit 1b0d54f1bcae12f233d54d878329dd330fb1671c
Author: Magnar Sveen <address@hidden>
Commit: Magnar Sveen <address@hidden>

    Simplify readme generation.
---
 README.md           |    1 +
 examples-to-docs.el |   29 ++++++-----------
 readme-postfix.md   |   39 -----------------------
 readme-prefix.md    |   31 ------------------
 readme-template.md  |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 97 insertions(+), 88 deletions(-)

diff --git a/README.md b/README.md
index 7baf0aa..2e02855 100644
--- a/README.md
+++ b/README.md
@@ -197,6 +197,7 @@ or with `!compare-fn` if that's non-nil.
 (!contains? '(1 2 3) 4) ;; => nil
 ```
 
+
 ## Development
 
 Run the tests with
diff --git a/examples-to-docs.el b/examples-to-docs.el
index a5685e3..760c57c 100644
--- a/examples-to-docs.el
+++ b/examples-to-docs.el
@@ -55,29 +55,22 @@
       (delete-char 7)
       (insert "'"))))
 
+(defun goto-and-remove (s)
+  (goto-char (point-min))
+  (search-forward s)
+  (delete-char (- (length s))))
+
 (defun create-docs-file ()
   (let ((functions (nreverse functions)))
     (with-temp-file "./README.md"
-      (insert-file-contents-literally "./readme-prefix.md")
-      (goto-char (point-max))
-      (newline)
-      (insert "## Available functions")
-      (newline 2)
-      (insert "```cl")
-      (newline)
+      (insert-file-contents-literally "./readme-template.md")
+
+      (goto-and-remove "[[ function-list ]]")
       (insert (mapconcat 'function-summary functions "\n"))
-      (newline)
-      (insert "```")
-      (newline 2)
-      (insert "There are also anaphoric versions of these
-functions where that makes sense, prefixed with two bangs
-instead of one.")
-      (newline 2)
-      (insert "## Documentation and examples")
-      (newline 2)
+
+      (goto-and-remove "[[ function-docs ]]")
       (insert (mapconcat 'function-to-md functions "\n"))
-      (newline)
-      (insert-file-contents-literally "./readme-postfix.md")
+
       (simplify-quotes))))
 
 (defun three-first (list)
diff --git a/readme-postfix.md b/readme-postfix.md
deleted file mode 100644
index c3a9786..0000000
--- a/readme-postfix.md
+++ /dev/null
@@ -1,39 +0,0 @@
-## Development
-
-Run the tests with
-
-    ./run-tests.sh
-
-Create the docs with
-
-    ./create-docs.sh
-
-I highly recommend that you install these as a pre-commit hook, so that
-the tests are always running and the docs are always in sync:
-
-    cp pre-commit.sh .git/hooks/pre-commit
-
-Oh, and don't edit `README.md` directly, it is generated.
-Change `readme-prefix.md` and `readme-postfix.md` instead,
-or if need be, the `examples-to-docs.el` logic.
-
-## License
-
-Copyright (C) 2012 Magnar Sveen, Joel McCracken
-
-Authors: Magnar Sveen <address@hidden>
-         Joel McCracken
-Keywords: lists
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/readme-prefix.md b/readme-prefix.md
deleted file mode 100644
index 1211751..0000000
--- a/readme-prefix.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# bang.el [![Build 
Status](https://secure.travis-ci.org/magnars/bang.el.png)](http://travis-ci.org/magnars/bang.el)
-
-The startings of a modern list api for Emacs. Does not require 'cl.
-
-We're looking to Clojure for naming and signatures.
-
-## Warning
-
-This is so much a work in progress that you should definitely not be using it 
yet.
-
-## Anaphoric functions
-
-While `!filter` takes a function to filter the list by, you can also use the
-anaphoric form with double bangs - which will then be executed with `it` 
exposed
-as the list item. Here's an example:
-
-```cl
-(!filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) ;; normal version
-
-(!!filter (= 0 (% it 2)) '(1 2 3 4)) ;; anaphoric version
-```
-
-of course the original can also be written like
-
-```cl
-(defun even? (num) (= 0 (% num 2)))
-
-(!filter even? '(1 2 3 4))
-```
-
-which demonstrates the usefulness of both versions.
diff --git a/readme-template.md b/readme-template.md
new file mode 100644
index 0000000..836a22b
--- /dev/null
+++ b/readme-template.md
@@ -0,0 +1,85 @@
+# bang.el [![Build 
Status](https://secure.travis-ci.org/magnars/bang.el.png)](http://travis-ci.org/magnars/bang.el)
+
+The startings of a modern list api for Emacs. Does not require 'cl.
+
+We're looking to Clojure for naming and signatures.
+
+## Warning
+
+This is so much a work in progress that you should definitely not be using it 
yet.
+
+## Anaphoric functions
+
+While `!filter` takes a function to filter the list by, you can also use the
+anaphoric form with double bangs - which will then be executed with `it` 
exposed
+as the list item. Here's an example:
+
+```cl
+(!filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) ;; normal version
+
+(!!filter (= 0 (% it 2)) '(1 2 3 4)) ;; anaphoric version
+```
+
+of course the original can also be written like
+
+```cl
+(defun even? (num) (= 0 (% num 2)))
+
+(!filter even? '(1 2 3 4))
+```
+
+which demonstrates the usefulness of both versions.
+
+## Available functions
+
+```cl
+[[ function-list ]]
+```
+
+There are also anaphoric versions of these
+functions where that makes sense, prefixed with two bangs
+instead of one.
+
+## Documentation and examples
+
+[[ function-docs ]]
+
+## Development
+
+Run the tests with
+
+    ./run-tests.sh
+
+Create the docs with
+
+    ./create-docs.sh
+
+I highly recommend that you install these as a pre-commit hook, so that
+the tests are always running and the docs are always in sync:
+
+    cp pre-commit.sh .git/hooks/pre-commit
+
+Oh, and don't edit `README.md` directly, it is generated.
+Change `readme-prefix.md` and `readme-postfix.md` instead,
+or if need be, the `examples-to-docs.el` logic.
+
+## License
+
+Copyright (C) 2012 Magnar Sveen, Joel McCracken
+
+Authors: Magnar Sveen <address@hidden>
+         Joel McCracken
+Keywords: lists
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.



reply via email to

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