Improving Markdeep.
This commit is contained in:
parent
0bf527c0f3
commit
bd897d8def
16
repository/Grafoscopio-Utils/MarkupFile.class.st
Normal file
16
repository/Grafoscopio-Utils/MarkupFile.class.st
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Class {
|
||||||
|
#name : #MarkupFile,
|
||||||
|
#superclass : #Object,
|
||||||
|
#instVars : [
|
||||||
|
'file'
|
||||||
|
],
|
||||||
|
#category : #'Grafoscopio-Utils'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #persistence }
|
||||||
|
MarkupFile class >> exportAsFileOn: aFileReference containing: contents [
|
||||||
|
aFileReference exists ifFalse: [ aFileReference ensureCreateFile ].
|
||||||
|
aFileReference writeStreamDo: [ :stream |
|
||||||
|
stream nextPutAll: contents ].
|
||||||
|
self inform: 'Exported as: ', String cr, aFileReference fullName
|
||||||
|
]
|
46
repository/Grafoscopio-Utils/OrgMode.class.st
Normal file
46
repository/Grafoscopio-Utils/OrgMode.class.st
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
"
|
||||||
|
I provide some utilites to work with OrgMode files.
|
||||||
|
|
||||||
|
https://orgmode.org/
|
||||||
|
"
|
||||||
|
Class {
|
||||||
|
#name : #OrgMode,
|
||||||
|
#superclass : #Object,
|
||||||
|
#instVars : [
|
||||||
|
'contents',
|
||||||
|
'file'
|
||||||
|
],
|
||||||
|
#category : #'Grafoscopio-Utils'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
OrgMode class >> fromFile: aFileReference [
|
||||||
|
^ self new contents: aFileReference contents.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OrgMode >> contents [
|
||||||
|
^ contents
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OrgMode >> contents: anObject [
|
||||||
|
contents := anObject
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OrgMode >> file [
|
||||||
|
^ file
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OrgMode >> file: anObject [
|
||||||
|
file := anObject
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #utilities }
|
||||||
|
OrgMode >> selectHeadlines [
|
||||||
|
|
||||||
|
^ self contents lines select: [ :line |
|
||||||
|
line isOrgModeHeader ]
|
||||||
|
]
|
15
repository/Grafoscopio-Utils/String.extension.st
Normal file
15
repository/Grafoscopio-Utils/String.extension.st
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Extension { #name : #String }
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils' }
|
||||||
|
String >> asCapitalizedPhrase [
|
||||||
|
"I convert phrases like 'THIS IS A PHASE' into 'This is a Phrase'."
|
||||||
|
|
||||||
|
^ Character space join: (self substrings collect: [:each | each asLowercase capitalized ])
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'*Grafoscopio-Utils' }
|
||||||
|
String >> isOrgModeHeader [
|
||||||
|
^ self beginsWithAnyOf: #('* ' '** ' '*** ' '**** ' '***** ' '***** ')
|
||||||
|
|
||||||
|
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user