From 7fc72d91719ae9585cdbd323031d0144596e1248 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Mon, 18 Jan 2021 09:39:25 +0000 Subject: [PATCH] Fix Markdown quoting * dev/examples-to-docs.el (format-docstring): Avoid unquoting already quoted metavariables. Fix token boundaries. * README.md: Regenerate. --- README.md | 22 +++++++++++----------- dev/examples-to-docs.el | 11 +++++++---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index df43f2f..09cf700 100644 --- a/README.md +++ b/README.md @@ -543,7 +543,7 @@ For similar operations, see also [`-keep`](#-keep-fn-list) and [`-filter`](#-fil Remove the first item from `list` for which `pred` returns non-nil. This is a non-destructive operation, but only the front of `list` -leading up to the removed item is a copy; the rest is `list``s +leading up to the removed item is a copy; the rest is `list`'s original tail. If no item is removed, then the result is a complete copy. Alias: `-reject-first`. @@ -997,7 +997,7 @@ For other folds, see also [`-reduce-r-from`](#-reduce-r-from-fn-init-list) and [ #### -reductions-from `(fn init list)` -Return a list of `fn``s intermediate reductions across `list`. +Return a list of `fn`'s intermediate reductions across `list`. That is, a list of the intermediate values of the accumulator when [`-reduce-from`](#-reduce-from-fn-init-list) (which see) is called with the same arguments. @@ -1012,7 +1012,7 @@ For other folds, see also [`-reductions`](#-reductions-fn-list) and [`-reduction #### -reductions-r-from `(fn init list)` -Return a list of `fn``s intermediate reductions across reversed `list`. +Return a list of `fn`'s intermediate reductions across reversed `list`. That is, a list of the intermediate values of the accumulator when [`-reduce-r-from`](#-reduce-r-from-fn-init-list) (which see) is called with the same arguments. @@ -1027,7 +1027,7 @@ For other folds, see also [`-reductions`](#-reductions-fn-list) and [`-reduction #### -reductions `(fn list)` -Return a list of `fn``s intermediate reductions across `list`. +Return a list of `fn`'s intermediate reductions across `list`. That is, a list of the intermediate values of the accumulator when [`-reduce`](#-reduce-fn-list) (which see) is called with the same arguments. This function's anaphoric counterpart is `--reductions`. @@ -1041,7 +1041,7 @@ For other folds, see also [`-reductions`](#-reductions-fn-list) and [`-reduction #### -reductions-r `(fn list)` -Return a list of `fn``s intermediate reductions across reversed `list`. +Return a list of `fn`'s intermediate reductions across reversed `list`. That is, a list of the intermediate values of the accumulator when [`-reduce-r`](#-reduce-r-fn-list) (which see) is called with the same arguments. This function's anaphoric counterpart is `--reductions-r`. @@ -1441,8 +1441,8 @@ Return a list of ((-filter `pred` `list`) (-remove `pred` `list`)), in one pass #### -partition `(n list)` -Return a new list with the items in `list` grouped into `n-`sized sublists. -If there are not enough items to make the last group `n-`sized, +Return a new list with the items in `list` grouped into `n`-sized sublists. +If there are not enough items to make the last group `n`-sized, those items are discarded. ```el @@ -1453,7 +1453,7 @@ those items are discarded. #### -partition-all `(n list)` -Return a new list with the items in `list` grouped into `n-`sized sublists. +Return a new list with the items in `list` grouped into `n`-sized sublists. The last group may contain less than `n` items. ```el @@ -1464,8 +1464,8 @@ The last group may contain less than `n` items. #### -partition-in-steps `(n step list)` -Return a new list with the items in `list` grouped into `n-`sized sublists at offsets `step` apart. -If there are not enough items to make the last group `n-`sized, +Return a new list with the items in `list` grouped into `n`-sized sublists at offsets `step` apart. +If there are not enough items to make the last group `n`-sized, those items are discarded. ```el @@ -1476,7 +1476,7 @@ those items are discarded. #### -partition-all-in-steps `(n step list)` -Return a new list with the items in `list` grouped into `n-`sized sublists at offsets `step` apart. +Return a new list with the items in `list` grouped into `n`-sized sublists at offsets `step` apart. The last groups may contain less than `n` items. ```el diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el index 764b002..88c47f2 100644 --- a/dev/examples-to-docs.el +++ b/dev/examples-to-docs.el @@ -94,11 +94,14 @@ FUNCTION may reference an elisp function, alias, macro or a subr." (format "`%s`" name)))) (defun format-docstring (docstring) - (let (case-fold-search) + (let ((case-fold-search nil)) (--> docstring - (replace-regexp-in-string "\\b\\([A-Z][A-Z-]*[0-9]*\\)\\b" 'quote-and-downcase it t) - (replace-regexp-in-string "`\\([^ ]+\\)'" 'unquote-and-link it t) - (replace-regexp-in-string "^ " " " it)))) + (replace-regexp-in-string + (rx bow (in upper) (* (in upper ?-)) (* num) eow) + #'quote-and-downcase it t t) + (replace-regexp-in-string (rx ?` (+? (not (in " `"))) ?\') + #'unquote-and-link it t t) + (replace-regexp-in-string (rx bol " ") " " it t t)))) (defun function-to-md (function) (if (stringp function)