Draft
Conversation
inline references like `[^foo]`, with definitions as blocks starting with `[^foo]:`.
scymtym
reviewed
Nov 20, 2025
scymtym
left a comment
There was a problem hiding this comment.
Mentioned a few simplifications using composition of esrap rule actions.
Comment on lines
27
to
32
| (defrule footnote-block (and (! 3bmd-grammar::blank-line) | ||
| 3bmd-grammar::line | ||
| (* footnote-block-line)) | ||
| (:destructure (b l block) | ||
| (declare (ignore b)) | ||
| (text l block))) |
There was a problem hiding this comment.
The rule action can be written as
(:function rest)
(:destructure (l block)
(text l block))
3bmd-footnote.lisp
Outdated
Comment on lines
45
to
47
| (:destructure (i1 i2 line) | ||
| (declare (ignore i1 i2)) | ||
| line)) |
3bmd-footnote.lisp
Outdated
Comment on lines
19
to
23
| (define-extension-inline *footnotes* footnote-ref | ||
| (and footnote (! #\:)) | ||
| (:destructure (id x) | ||
| (declare (ignore x)) | ||
| (list 'footnote-ref id))) |
There was a problem hiding this comment.
For rule actions, esrap can compose multiple transformations. In cases like this, it is convenient to "pre-process" with a :function action:
(:function first)
(:lambda (id)
(list 'footnote-ref id))
3bmd-footnote.lisp
Outdated
Comment on lines
15
to
17
| (:destructure (o id c) | ||
| (declare (ignore o c)) | ||
| (text id))) |
There was a problem hiding this comment.
See next comment for general explanation.
(:function second)
(:text t)Currently prints definitions where they were in original for both, not sure if it would be better to move to the end like html?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
inline references like
[^foo], with definitions as blocks starting with[^foo]:.questions for users::
^[inline footnote]version common/useful enough to be worth implementing? (or some other syntax)todo: