From 4beca346beeffef824f2901ba449edb323a5ef40 Mon Sep 17 00:00:00 2001 From: Offray Date: Sun, 3 Nov 2024 08:59:48 -0500 Subject: [PATCH] Renaming and modularizing. --- src/MiniDocs/ByteString.extension.st | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/MiniDocs/ByteString.extension.st b/src/MiniDocs/ByteString.extension.st index 35b4f83..cf8e616 100644 --- a/src/MiniDocs/ByteString.extension.st +++ b/src/MiniDocs/ByteString.extension.st @@ -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 ]