Better %metadata nodes custom keys (pandocOptions, thisNodebook) processing to improve notebook control of

derivated files (Markdown, PDF, etc).
This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-08-19 19:16:59 +00:00
parent 0b96cb3b6c
commit 0495319170

View File

@ -8,7 +8,7 @@ Class {
#category : #'Grafoscopio-Utils'
}
{ #category : #'as yet unclassified' }
{ #category : #utilities }
GrafoscopioUtils class >> checksumFor: aFileReference [
^ (SHA1 new hashMessage: aFileReference binaryReadStream contents) hex.
]
@ -51,6 +51,17 @@ GrafoscopioUtils class >> getContentsFrom: url withMessage: aString [
^ client contents.
]
{ #category : #utilities }
GrafoscopioUtils class >> perform: aString on: anObject [
| msg |
msg := self selectorAndArgumentsFrom: aString.
msg
at: 'args'
ifPresent: [ ^ anObject perform: (msg at: 'selector') withArguments: (msg at: 'args') ]
ifAbsent: [ ^ anObject perform: (msg at: 'selector') ]
]
{ #category : #private }
GrafoscopioUtils class >> sanitize: url [
"I remove white spaces in url's and prepend 'http://' to urls when it is ommited, so
@ -65,6 +76,25 @@ GrafoscopioUtils class >> sanitize: url [
^ sanitized
]
{ #category : #utilities }
GrafoscopioUtils class >> selectorAndArgumentsFrom: aString [
"I return from aString a symbol that contains a message and an array of arguments used in it"
| msgArray answer |
answer := OrderedDictionary new.
msgArray := aString splitOn: ':'.
msgArray size = 1
ifTrue: [
^ answer
at: 'selector' put: (msgArray at: 1) asSymbol;
yourself ].
msgArray size = 2
ifTrue: [
^ answer
at: 'selector' put: ((msgArray at: 1),':') asSymbol;
at: 'args' put: (Array with: (msgArray at: 2));
yourself ].
]
{ #category : #updating }
GrafoscopioUtils class >> update [
"Updates GrafoscopioUtils with new versions of itself take from the source code repository."