Repackaging functionality.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-05 09:43:37 -05:00
parent 294fa5bde3
commit 6a022aca13
4 changed files with 50 additions and 5 deletions

View File

@ -0,0 +1,8 @@
Extension { #name : #LePage }
{ #category : #'*Markdeep' }
LePage >> markdeepFileName [
| sanitized |
sanitized := self title asDashedLowercase copyWithoutAll: #($/).
^ sanitized, '--',(self uidString copyFrom: 1 to: 5), '.md.html'.
]

View File

@ -0,0 +1,12 @@
Extension { #name : #LeSnippet }
{ #category : #'*Markdeep' }
LeSnippet class >> fromMetaMarkdeep: div [
| className metadata snippet |
className := (div xpath: '@st-class') stringValue.
metadata := STON fromString:(div xpath: '@st-data') stringValue.
snippet := className asClass new.
snippet injectMetadataFrom: metadata.
snippet contentFrom: div.
^ snippet.
]

View File

@ -0,0 +1,11 @@
Extension { #name : #LeTextualSnippet }
{ #category : #'*Markdeep' }
LeTextualSnippet >> markdeepCustomCloser [
^ ''
]
{ #category : #'*Markdeep' }
LeTextualSnippet >> markdeepCustomOpener [
^ ''
]

View File

@ -7,14 +7,14 @@ Class {
#instVars : [ #instVars : [
'title', 'title',
'body', 'body',
'tocStyle',
'comments', 'comments',
'tail', 'tail',
'language', 'language',
'config', 'config',
'metadata', 'metadata',
'head', 'head',
'navTop' 'navTop',
'options'
], ],
#category : #Markdeep #category : #Markdeep
} }
@ -238,6 +238,19 @@ Markdeep >> navTop: aString [
navTop:= aString. navTop:= aString.
] ]
{ #category : #accessing }
Markdeep >> options [
^ options ifNil: [
"Setting defaults accoding to: https://casual-effects.com/markdeep/#api"
options := Dictionary new
at: 'mode' put: nil;
at: 'lang' put: nil;
at: 'tocStyle' put: 'auto';
at: 'autoLinkImages' put: true;
yourself
]
]
{ #category : #printing } { #category : #printing }
Markdeep >> printOn: aStream [ Markdeep >> printOn: aStream [
@ -288,12 +301,13 @@ Markdeep >> title: anObject [
{ #category : #accessing } { #category : #accessing }
Markdeep >> tocStyle [ Markdeep >> tocStyle [
^ tocStyle ifNil: [ tocStyle := 'short' ] ^ self options at: 'tocStyle' ifAbsent: [ 'short' ]
] ]
{ #category : #accessing } { #category : #accessing }
Markdeep >> tocStyle: anObject [ Markdeep >> tocStyle: aString [
tocStyle := anObject "A string can be: 'auto' 'none' 'short' 'medium' or 'long'"
self options at: 'tocStyle' put: aString
] ]
{ #category : #'instance creation' } { #category : #'instance creation' }