From 301f4aac274c238a7f05f776d12be8591e3be882 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Fri, 1 Apr 2022 19:49:39 -0500 Subject: [PATCH] Creating storeContents of NitterUser in STON format file. --- .../NitterUser.class/instance/exportWithTemplate.On..st | 8 +++++++- .../NitterUser.class/instance/fromSTON..st | 4 ++++ .../NitterUser.class/instance/storeContents.st | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Socialmetrica.package/NitterUser.class/instance/fromSTON..st create mode 100644 Socialmetrica.package/NitterUser.class/instance/storeContents.st diff --git a/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.On..st b/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.On..st index 331664c..6f00dac 100644 --- a/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.On..st +++ b/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.On..st @@ -1,6 +1,12 @@ accessing exportWithTemplate: mustacheFile On: folder + | tempDictionary modified | + tempDictionary := self asDictionary copy. + modified := self asDictionary at: 'profile-bio'. + modified := modified copyReplaceAll: '@' with: '\@'. + modified := modified copyReplaceAll: '_' with: '\_'. + tempDictionary at: 'profile-bio' put: modified. MarkupFile exportAsFileOn: (folder / self userName , 'tex') - containing:(mustacheFile asMustacheTemplate value: self asDictionary) \ No newline at end of file + containing:(mustacheFile asMustacheTemplate value: tempDictionary) \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/fromSTON..st b/Socialmetrica.package/NitterUser.class/instance/fromSTON..st new file mode 100644 index 0000000..8e18863 --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/fromSTON..st @@ -0,0 +1,4 @@ +accessing +fromSTON: aFileReference + + ^ STON fromString:aFileReference contents \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/storeContents.st b/Socialmetrica.package/NitterUser.class/instance/storeContents.st new file mode 100644 index 0000000..bbbf6da --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/storeContents.st @@ -0,0 +1,6 @@ +accessing +storeContents + + | objectString | + objectString := STON toStringPretty: self. + ^ MarkupFile exportAsFileOn: self folder/ self userName, 'ston' containing: objectString. \ No newline at end of file