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

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

[elpa] externals/dash eacb6f2 092/426: Docs: Better generation of github


From: Phillip Lord
Subject: [elpa] externals/dash eacb6f2 092/426: Docs: Better generation of github urls.
Date: Tue, 04 Aug 2015 19:36:55 +0000

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

    Docs: Better generation of github urls.
---
 README.md           |   64 +++++++++++++++++++++++++-------------------------
 examples-to-docs.el |   24 ++++++++-----------
 2 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/README.md b/README.md
index 6a248be..59d1dad 100644
--- a/README.md
+++ b/README.md
@@ -12,38 +12,38 @@ Or you can just dump `dash.el` in your load path somewhere.
 
 ## Functions
 
-* [-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)`
-* [-keep](#keep-fn-list) `(fn list)`
-* [-flatten](#flatten-l) `(l)`
-* [-concat](#concat-rest-lists) `(&rest lists)`
-* [-mapcat](#mapcat-fn-list) `(fn list)`
-* [-any?](#any-fn-list) `(fn list)`
-* [-all?](#all-fn-list) `(fn list)`
-* [-none?](#none-fn-list) `(fn list)`
-* [-each](#each-list-fn) `(list fn)`
-* [-take](#take-n-list) `(n list)`
-* [-drop](#drop-n-list) `(n list)`
-* [-take-while](#take-while-fn-list) `(fn list)`
-* [-drop-while](#drop-while-fn-list) `(fn list)`
-* [-split-at](#split-at-n-list) `(n list)`
-* [-split-with](#split-with-fn-list) `(fn list)`
-* [-interpose](#interpose-sep-list) `(sep list)`
-* [-interleave](#interleave-rest-lists) `(&rest lists)`
-* [-replace-where](#replace-where-pred-rep-list) `(pred rep list)`
-* [-first](#first-fn-list) `(fn list)`
-* [-difference](#difference-list-list2) `(list list2)`
-* [-intersection](#intersection-list-list2) `(list list2)`
-* [-distinct](#distinct-list) `(list)`
-* [-contains?](#contains-list-element) `(list element)`
-* [-partial](#partial-fn-rest-args) `(fn &rest args)`
-* [-rpartial](#rpartial-fn-rest-args) `(fn &rest args)`
-* [->](#x-optional-form-rest-more) `(x &optional form &rest more)`
-* [->>](#x-form-rest-more) `(x form &rest more)`
-* [-->](#x-form-rest-more) `(x form &rest more)`
+* [-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)`
+* [-keep](#-keep-fn-list) `(fn list)`
+* [-flatten](#-flatten-l) `(l)`
+* [-concat](#-concat-rest-lists) `(&rest lists)`
+* [-mapcat](#-mapcat-fn-list) `(fn list)`
+* [-any?](#-any-fn-list) `(fn list)`
+* [-all?](#-all-fn-list) `(fn list)`
+* [-none?](#-none-fn-list) `(fn list)`
+* [-each](#-each-list-fn) `(list fn)`
+* [-take](#-take-n-list) `(n list)`
+* [-drop](#-drop-n-list) `(n list)`
+* [-take-while](#-take-while-fn-list) `(fn list)`
+* [-drop-while](#-drop-while-fn-list) `(fn list)`
+* [-split-at](#-split-at-n-list) `(n list)`
+* [-split-with](#-split-with-fn-list) `(fn list)`
+* [-interpose](#-interpose-sep-list) `(sep list)`
+* [-interleave](#-interleave-rest-lists) `(&rest lists)`
+* [-replace-where](#-replace-where-pred-rep-list) `(pred rep list)`
+* [-first](#-first-fn-list) `(fn list)`
+* [-difference](#-difference-list-list) `(list list2)`
+* [-intersection](#-intersection-list-list) `(list list2)`
+* [-distinct](#-distinct-list) `(list)`
+* [-contains?](#-contains-list-element) `(list element)`
+* [-partial](#-partial-fn-rest-args) `(fn &rest args)`
+* [-rpartial](#-rpartial-fn-rest-args) `(fn &rest args)`
+* [->](#--x-optional-form-rest-more) `(x &optional form &rest more)`
+* [->>](#--x-form-rest-more) `(x form &rest more)`
+* [-->](#---x-form-rest-more) `(x form &rest more)`
 
 There are also anaphoric versions of these functions where that makes sense,
 prefixed with two dashs instead of one.
diff --git a/examples-to-docs.el b/examples-to-docs.el
index c343a8d..63e7e22 100644
--- a/examples-to-docs.el
+++ b/examples-to-docs.el
@@ -57,22 +57,18 @@
             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]+" t))
-
-(defun dashed-words (s)
-  "Convert string S to snake-case string."
-  (mapconcat 'identity (mapcar
-                        '(lambda (word) (downcase word))
-                        (split-name s)) "-"))
+(defun docs--chop-suffix (suffix s)
+  "Remove SUFFIX if it is at end of S."
+  (let ((pos (- (length suffix))))
+    (if (and (>= (length s) (length suffix))
+             (string= suffix (substring s pos)))
+        (substring s 0 pos)
+      s)))
 
 (defun github-id (command-name signature)
-  (dashed-words (format "%s %s" command-name signature)))
+  (docs--chop-suffix
+   "-"
+   (replace-regexp-in-string "[^a-zA-Z-]+" "-" (format "%S %S" command-name 
signature))))
 
 (defun function-summary (function)
   (let ((command-name (car function))



reply via email to

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