-
Notifications
You must be signed in to change notification settings - Fork 14
initial implementation of footnotes extension #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
inline references like `[^foo]`, with definitions as blocks starting with `[^foo]:`.
scymtym
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioned a few simplifications using composition of esrap rule actions.
| (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rule action can be written as
(:function rest)
(:destructure (l block)
(text l block))
3bmd-footnote.lisp
Outdated
| (:destructure (i1 i2 line) | ||
| (declare (ignore i1 i2)) | ||
| line)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just (:function third).
3bmd-footnote.lisp
Outdated
| (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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| (:destructure (o id c) | ||
| (declare (ignore o c)) | ||
| (text id))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
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: