Renaming to improve consistency and not revealing implementation details in message names. Improving messages to the user.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-09-10 11:24:19 -05:00
parent 847d1f7bc4
commit b8b4c6863e
2 changed files with 19 additions and 7 deletions

View File

@ -139,14 +139,14 @@ Tiddler >> customFields [
{ #category : 'accessing' }
Tiddler >> exportJSONFile [
| jsonFile |
jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, self created asString, '.json').
jsonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase,'.', self created asString, '.json').
^ MarkupFile exportAsFileOn: jsonFile containing:self asJson
]
{ #category : 'accessing' }
Tiddler >> exportSTONFile [
| stonFile output |
stonFile := self wiki file parent / 'tiddlers' / (self title asLowercase, '.ston') .
stonFile := self wiki file parent / 'tiddlers' / (self title asDashedLowercase, '.', self created asString, '.ston') .
^ MarkupFile exportAsFileOn: stonFile containing: self asStonStringPretty
]

View File

@ -15,7 +15,7 @@ Class {
}
{ #category : 'accessing' }
TiddlyWiki >> exportSTONTiddlersFile [
TiddlyWiki >> exportSTONFile [
| stonFile output |
stonFile := self tiddlersJSONFile withoutExtension, 'ston'.
output := '' writeStream.
@ -38,7 +38,11 @@ TiddlyWiki >> file: anObject [
]
{ #category : 'accessing' }
TiddlyWiki >> importJSONTiddlersFile [
TiddlyWiki >> importJSONFile [
"I import a JSON representation of my tiddlers data, that has been previosly exported
by the TiddlyWiki HTML self contained file.
Such file is called, by convention, 'tiddlers.json' and stored in the same folder where
the HTML file is located."
| tiddlersDict |
self tiddlersJSONFile ifNil: [ ^ self ].
tiddlersDict := STONJSON fromString: self tiddlersJSONFile contents.
@ -89,7 +93,15 @@ TiddlyWiki >> tiddlers: anOrderedCollection [
{ #category : 'accessing' }
TiddlyWiki >> tiddlersJSONFile [
file ifNil: [ self inform: 'You need to export tiddlers as JSON from TiddlyWiki'.
^ nil ].
^ file parent / 'tiddlers.json'.
| jsonFile |
file ifNil: [
self inform: 'Provide the location of the TiddlyWiki HTML file.'.
^ nil
].
jsonFile := file parent / 'tiddlers.json'.
jsonFile exists ifFalse: [
self inform: 'You need to export tiddlers as JSON from TiddlyWiki and locate it in the same folder as the HTML file'.
^ nil
].
^ jsonFile
]