[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 63fa64f 368/426: Add links to references in readme
From: |
Phillip Lord |
Subject: |
[elpa] externals/dash 63fa64f 368/426: Add links to references in readme |
Date: |
Tue, 04 Aug 2015 19:38:57 +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 0fc5d73 351/426: [-let] Make the cons matcher temp-bind as late as possible, (continued)
- [elpa] externals/dash 0fc5d73 351/426: [-let] Make the cons matcher temp-bind as late as possible, Phillip Lord, 2015/08/04
- [elpa] externals/dash 75d29a2 363/426: Declare --iterate macro before using it. #102, Phillip Lord, 2015/08/04
- [elpa] externals/dash 3bdf60b 365/426: Add some examples, Phillip Lord, 2015/08/04
- [elpa] externals/dash 65a3736 349/426: [-let] Fix improper list non-symbol last argument handler, Phillip Lord, 2015/08/04
- [elpa] externals/dash 549bfd3 366/426: Reorder macros to make sure they are declared before being used, Phillip Lord, 2015/08/04
- [elpa] externals/dash db7f651 353/426: [-let] Simplify the conditions in dash--match-cons-1, Phillip Lord, 2015/08/04
- [elpa] externals/dash c6b92ae 324/426: Reorder the examples into more meaningful blocks, Phillip Lord, 2015/08/04
- [elpa] externals/dash 03b98ca 364/426: Make -if-let and -when-let families destructure their arguments, Phillip Lord, 2015/08/04
- [elpa] externals/dash 5e9c1a9 373/426: Add Fredrik Bergroth to the list of contributors, Phillip Lord, 2015/08/04
- [elpa] externals/dash 8707aaf 367/426: Update docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash 63fa64f 368/426: Add links to references in readme,
Phillip Lord <=
- [elpa] externals/dash d459b49 374/426: Fix typo, Phillip Lord, 2015/08/04
- [elpa] externals/dash 9e1a667 360/426: Do not map nodes on conses (be consistent with tree map), Phillip Lord, 2015/08/04
- [elpa] externals/dash 7185db8 311/426: [Issue #83] Add `step` to `-slice`, Phillip Lord, 2015/08/04
- [elpa] externals/dash 2b69c14 411/426: Add dash.info and dash.texi to repo, Phillip Lord, 2015/08/04
- [elpa] externals/dash c61fc34 417/426: Add -remove-first/last, -map-first/last, -replace-first/last, Phillip Lord, 2015/08/04
- [elpa] externals/dash fb51f8f 304/426: Merge pull request #88 from steventlamb/topic/zip_cycle_pad, Phillip Lord, 2015/08/04
- [elpa] externals/dash d0c6fc0 371/426: Merge pull request #104 from fbergroth/linkify-docs, Phillip Lord, 2015/08/04
- [elpa] externals/dash c08fcba 299/426: Fixed documentation of `-last-item'., Phillip Lord, 2015/08/04
- [elpa] externals/dash f96196a 289/426: Merge pull request #75 from Fuco1/prefix, Phillip Lord, 2015/08/04
- [elpa] externals/dash afe2781 388/426: Merge pull request #109 from bbatsov/threading-indentation, Phillip Lord, 2015/08/04