Implementing Markdown crude semantic splits.
This commit is contained in:
parent
4beca346be
commit
96903d8627
@ -13,9 +13,12 @@ ByteString >> admonitionBorderLines [
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
ByteString >> admonitionBorders [
|
||||
"For the moment I only work with the admonition starting border
|
||||
as adding the closing one would imply to redo the #markdownSplitted
|
||||
method implementing a proper parser, which, ATM is overkill."
|
||||
| response |
|
||||
response := #('info' 'success' 'warning' 'danger') collect: [ :each | ':::', each ].
|
||||
^ response copyWith: ':::'
|
||||
^ response "copyWith: ':::'"
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
@ -38,3 +41,20 @@ ByteString >> markdownSplitLines [
|
||||
yourself.
|
||||
^ (response associations sorted: [ :x :y | x key < y key ]) asOrderedDictionary
|
||||
]
|
||||
|
||||
{ #category : #'*MiniDocs' }
|
||||
ByteString >> markdownSplitted [
|
||||
| response lastPart |
|
||||
self admonitionBorderLines ifEmpty: [ ^ self ].
|
||||
response := OrderedCollection new.
|
||||
self markdownSplitLines keys allButLast doWithIndex: [:key :index | | nextLine part |
|
||||
nextLine := (self markdownSplitLines keys at: index + 1) - 1.
|
||||
part := self lines copyFrom: key to: nextLine.
|
||||
response add: part.
|
||||
].
|
||||
lastPart := self lines
|
||||
copyFrom: self markdownSplitLines keys last
|
||||
to: self lines size.
|
||||
response add: lastPart.
|
||||
^ response
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user