Starting support for footnotes in the new parser.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-05-09 18:18:39 -05:00
parent fe0d65cf5a
commit a3741918c9
2 changed files with 28 additions and 6 deletions

View File

@ -389,16 +389,15 @@ Markdeep >> pubPubImagesToMarkdeep [
{ #category : #accessing } { #category : #accessing }
Markdeep >> pubPubRawLinks [ Markdeep >> pubPubRawLinks [
| parser | | parser |
parser := PubPubGrammar new document. parser := PubPubGrammar2 new document.
^ (parser parse: self body) ^ (parser parse: self body)
] ]
{ #category : #accessing } { #category : #accessing }
Markdeep >> removeAlternativeImagesArray [ Markdeep >> removeAlternativeImagesArray [
| parser replacements | | replacements |
self body ifNil: [^ self]. self body ifNil: [^ self].
parser := PubPubGrammar2 new. replacements := self selectPubPubLinksWithSize: 3.
replacements := parser parse: body.
replacements ifEmpty: [^self]. replacements ifEmpty: [^self].
replacements do: [:replacement | replacements do: [:replacement |
self body: self body:

View File

@ -6,14 +6,32 @@ Class {
'imageLink', 'imageLink',
'imagesArray', 'imagesArray',
'imageLocation', 'imageLocation',
'document' 'document',
'footnote',
'footnoteLabel',
'footnoteContent'
], ],
#category : #MiniDocs #category : #MiniDocs
} }
{ #category : #accessing } { #category : #accessing }
PubPubGrammar2 >> document [ PubPubGrammar2 >> document [
^ imageLink islandInSea star ^ (imageLink / footnote) islandInSea star
]
{ #category : #accessing }
PubPubGrammar2 >> footnote [
^ footnoteLabel, footnoteContent
]
{ #category : #accessing }
PubPubGrammar2 >> footnoteContent [
^ '{#' asPParser, #any asPParser starLazy flatten, '}' asPParser ==> #second
]
{ #category : #accessing }
PubPubGrammar2 >> footnoteLabel [
^ '[' asPParser, #any asPParser starLazy flatten, ']' asPParser ==> #second
] ]
{ #category : #accessing } { #category : #accessing }
@ -36,6 +54,11 @@ PubPubGrammar2 >> imagesArray [
^ '{srcset=' asPParser, #any asPParser starLazy flatten, '}' asPParser ==> #second ^ '{srcset=' asPParser, #any asPParser starLazy flatten, '}' asPParser ==> #second
] ]
{ #category : #accessing }
PubPubGrammar2 >> imagesContent [
^ '{src=' asPParser, #any asPParser starLazy flatten, '}' asPParser ==> #second
]
{ #category : #accessing } { #category : #accessing }
PubPubGrammar2 >> start [ PubPubGrammar2 >> start [
^ document ^ document