Renaming and modularizing.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-11-03 08:59:48 -05:00
parent 37d6000702
commit 4beca346be

View File

@ -1,17 +1,23 @@
Extension { #name : #ByteString }
{ #category : #'*MiniDocs' }
ByteString >> admonitionStartingLines [
| admonitions response |
admonitions := #('info' 'success' 'warning' 'danger') collect: [ :each | ':::', each ].
ByteString >> admonitionBorderLines [
| response |
response := OrderedDictionary new.
self lines doWithIndex: [:line :index |
(admonitions includes: line trimBoth)
(self admonitionBorders includes: line trimBoth)
ifTrue: [ response at: index put: line trimBoth ]
].
^ response
]
{ #category : #'*MiniDocs' }
ByteString >> admonitionBorders [
| response |
response := #('info' 'success' 'warning' 'danger') collect: [ :each | ':::', each ].
^ response copyWith: ':::'
]
{ #category : #'*MiniDocs' }
ByteString >> email [
"Quick fix for importing Lepiter pages that have a plain ByteString field as email."
@ -19,7 +25,7 @@ ByteString >> email [
]
{ #category : #'*MiniDocs' }
ByteString >> splitLines [
ByteString >> markdownSplitLines [
"I'm useful for conversions between the HedgeDoc Markdown variant and Lepiter page snippets.
I provide broad places to where semantic breaks should be located in a page,
depending on headers or admonitions to create pages snippets with similar divisions.
@ -28,7 +34,7 @@ ByteString >> splitLines [
response := OrderedDictionary new.
response := response
addAll: self markdownHeaders;
addAll: self admonitionStartingLines;
addAll: self admonitionBorderLines;
yourself.
^ (response associations sorted: [ :x :y | x key < y key ]) asOrderedDictionary
]