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

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

[elpa] externals/dash ab727ba 257/439: Correct anchors for links startin


From: Phillip Lord
Subject: [elpa] externals/dash ab727ba 257/439: Correct anchors for links starting with '!'
Date: Tue, 04 Aug 2015 20:28:45 +0000

branch: externals/dash
commit ab727ba4cfdb305e37ce37d73ee1d235350b080e
Author: Philippe Vaucher <address@hidden>
Commit: Philippe Vaucher <address@hidden>

    Correct anchors for links starting with '!'
---
 README.md               |    4 ++--
 dev/examples-to-docs.el |   12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index d96744a..1436a00 100644
--- a/README.md
+++ b/README.md
@@ -155,8 +155,8 @@ Include this in your emacs settings to get syntax 
highlighting:
 
 ### Destructive operations
 
-* [!cons](#-cons-car-cdr) `(car cdr)`
-* [!cdr](#-cdr-list) `(list)`
+* [!cons](#cons-car-cdr) `(car cdr)`
+* [!cdr](#cdr-list) `(list)`
 
 ### Function combinators
 
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index c8e82de..2353b81 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -72,6 +72,14 @@ FUNCTION may reference an elisp function, alias, macro or a 
subr."
               docstring
               (mapconcat 'identity (-take 3 examples) "\n")))))
 
+(defun docs--chop-prefix (prefix s)
+  "Remove PREFIX if it is at the start of S."
+  (let ((pos (length prefix)))
+    (if (and (>= (length s) (length prefix))
+             (string= prefix (substring s 0 pos)))
+        (substring s pos)
+      s)))
+
 (defun docs--chop-suffix (suffix s)
   "Remove SUFFIX if it is at end of S."
   (let ((pos (- (length suffix))))
@@ -83,7 +91,9 @@ FUNCTION may reference an elisp function, alias, macro or a 
subr."
 (defun github-id (command-name signature)
   (docs--chop-suffix
    "-"
-   (replace-regexp-in-string "[^a-zA-Z0-9-]+" "-" (format "%S %S" command-name 
signature))))
+   (replace-regexp-in-string "[^a-zA-Z0-9-]+" "-" (docs--chop-prefix
+                                                   "!"
+                                                   (format "%S %S" 
command-name signature)))))
 
 (defun s-replace (old new s)
   "Replaces OLD with NEW in S."



reply via email to

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