[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 63fa64f 368/439: Add links to references in readme
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 63fa64f 368/439: Add links to references in readme |
Date: |
Tue, 04 Aug 2015 20:30:37 +0000 |
branch: externals/dash
commit 63fa64f7550709d218de794d9e2e3eaffd10d99c
Author: Fredrik Bergroth <address@hidden>
Commit: Fredrik Bergroth <address@hidden>
Add links to references in readme
---
dev/examples-to-docs.el | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index eb2ce7d..0cd5327 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -53,24 +53,31 @@ FUNCTION may reference an elisp function, alias, macro or a
subr."
(defun quote-and-downcase (string)
(format "`%s`" (downcase string)))
-(defun quote-docstring (docstring)
+(defun unquote-and-link (string)
+ (format-link (substring string 1 -1)))
+
+(defun format-link (string-name)
+ (-let* ((name (intern string-name))
+ ((_ signature _ _) (assoc name functions)))
+ (if signature
+ (format "[`%s`](#%s)" name (github-id name signature))
+ (format "`%s`" name))))
+
+(defun format-docstring (docstring)
(let (case-fold-search)
(--> docstring
(replace-regexp-in-string "\\b\\([A-Z][A-Z-]*[0-9]*\\)\\b"
'quote-and-downcase it t)
- (replace-regexp-in-string "`\\([^ ]+\\)'" "`\\1`" it t)
+ (replace-regexp-in-string "`\\([^ ]+\\)'" 'unquote-and-link it t)
(replace-regexp-in-string "^ " " " it))))
(defun function-to-md (function)
(if (stringp function)
(concat "\n" (s-replace "### " "## " function) "\n")
- (let ((command-name (car function))
- (signature (cadr function))
- (docstring (quote-docstring (nth 2 function)))
- (examples (nth 3 function)))
+ (-let [(command-name signature docstring examples) function]
(format "#### %s `%s`\n\n%s\n\n```cl\n%s\n```\n"
command-name
signature
- docstring
+ (format-docstring docstring)
(mapconcat 'identity (-take 3 examples) "\n")))))
(defun docs--chop-prefix (prefix s)
- [elpa] externals/dash edb1e31 356/439: [-let] Add more tests, (continued)
- [elpa] externals/dash edb1e31 356/439: [-let] Add more tests, Phillip Lord, 2015/08/04
- [elpa] externals/dash 4b63be1 362/439: Declare --mapcat macro before using it. #102, Phillip Lord, 2015/08/04
- [elpa] externals/dash 31f321a 358/439: Release 2.9.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2436bf8 361/439: Add debug declaration on -lambda, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9e1a667 360/439: Do not map nodes on conses (be consistent with tree map), Phillip Lord, 2015/08/04
- [elpa] externals/dash 75d29a2 363/439: Declare --iterate macro before using it. #102, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bdf60b 365/439: Add some examples, Phillip Lord, 2015/08/04
- [elpa] externals/dash 03b98ca 364/439: Make -if-let and -when-let families destructure their arguments, Phillip Lord, 2015/08/04
- [elpa] externals/dash 549bfd3 366/439: Reorder macros to make sure they are declared before being used, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8707aaf 367/439: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 63fa64f 368/439: Add links to references in readme,
Phillip Lord <=
- [elpa] externals/dash 0c045f2 369/439: Highlight with el instead of cl, Phillip Lord, 2015/08/04
- [elpa] externals/dash d459b49 374/439: Fix typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash c09c0f6 372/439: Merge branch 'more-destructuring' (#103) of https://github.com/fbergroth/dash.el, Phillip Lord, 2015/08/04
- [elpa] externals/dash 38ef86e 376/439: Update debug forms for -if-let and -when-let, Phillip Lord, 2015/08/04
- [elpa] externals/dash 446c522 375/439: Release 2.10.0, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5e9c1a9 373/439: Add Fredrik Bergroth to the list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash c134705 377/439: Fix compile warning, Phillip Lord, 2015/08/04
- [elpa] externals/dash c7b4cff 370/439: Update readme.md, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8d2227d 380/439: Silence unused variable warning in -table, Phillip Lord, 2015/08/04
- [elpa] externals/dash 47e11ae 378/439: Update docs, Phillip Lord, 2015/08/04