diff --git a/repository/TiddlyWiki/Tiddler.class.st b/repository/TiddlyWiki/Tiddler.class.st index adfd438..38dac1b 100644 --- a/repository/TiddlyWiki/Tiddler.class.st +++ b/repository/TiddlyWiki/Tiddler.class.st @@ -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 ] diff --git a/repository/TiddlyWiki/TiddlyWiki.class.st b/repository/TiddlyWiki/TiddlyWiki.class.st index 77c9ad3..e5a3c1e 100644 --- a/repository/TiddlyWiki/TiddlyWiki.class.st +++ b/repository/TiddlyWiki/TiddlyWiki.class.st @@ -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 ]