From 3ad7148e621bbf8c70709fe8059f67bf981647b3 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Wed, 1 Jun 2022 15:52:32 -0500 Subject: [PATCH] Creating export as static web report. --- .../instance/exportStaticWebReport.st | 5 +++ .../instance/exportWithTemplate.into..st | 41 +++++++++++-------- .../instance/installTemplate.st | 4 +- 3 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 Socialmetrica.package/NitterUser.class/instance/exportStaticWebReport.st diff --git a/Socialmetrica.package/NitterUser.class/instance/exportStaticWebReport.st b/Socialmetrica.package/NitterUser.class/instance/exportStaticWebReport.st new file mode 100644 index 0000000..bc11782 --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/exportStaticWebReport.st @@ -0,0 +1,5 @@ +accessing +exportStaticWebReport + + self installTemplate. + ^ self exportWithTemplate: (TweetsCollection dataStore / 'templates' / 'index.mus.html') into: self folder \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.into..st b/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.into..st index 5096c58..9969549 100644 --- a/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.into..st +++ b/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.into..st @@ -3,20 +3,27 @@ exportWithTemplate: mustacheFile into: folder | tempDictionary bioModified userModified nameModified | tempDictionary := self asDictionary copy. - bioModified := self asDictionary at: 'profile-bio'. - bioModified := bioModified copyReplaceAll: '@' with: '\@'. - bioModified := bioModified copyReplaceAll: '_' with: '\_'. - bioModified := bioModified copyReplaceAll: '#' with: '\#'. - bioModified := bioModified copyReplaceAll: '👑😎' with: ''. - bioModified := bioModified copyReplaceAll: '🇨🇴' with: ''. - bioModified := bioModified copyReplaceAll: '|' with: ''. - userModified := self asDictionary at: 'profile-card-username'. - userModified := userModified copyReplaceAll: '_' with: '\_'. - nameModified := self asDictionary at: 'profile-card-fullname'. - nameModified := nameModified copyReplaceAll: '🇨🇴' with: ''. - tempDictionary at: 'profile-bio' put: bioModified; - at: 'profile-card-username' put: userModified; - at: 'profile-card-fullname' put: nameModified. - ^ MarkupFile - exportAsFileOn: (folder / self userName , 'tex') - containing:(mustacheFile asMustacheTemplate value: tempDictionary) \ No newline at end of file + (mustacheFile fullName endsWith: '.html') + ifTrue: [ ^ MarkupFile + exportAsFileOn: (folder / self userName , 'html') + containing:(mustacheFile asMustacheTemplate value: tempDictionary)]. + + (mustacheFile fullName endsWith: '.tex') + ifTrue: [ bioModified := self asDictionary at: 'profile-bio'. + bioModified := bioModified copyReplaceAll: '@' with: '\@'. + bioModified := bioModified copyReplaceAll: '_' with: '\_'. + bioModified := bioModified copyReplaceAll: '#' with: '\#'. + bioModified := bioModified copyReplaceAll: '👑😎' with: ''. + bioModified := bioModified copyReplaceAll: '🇨🇴' with: ''. + bioModified := bioModified copyReplaceAll: '|' with: ''. + userModified := self asDictionary at: 'profile-card-username'. + userModified := userModified copyReplaceAll: '_' with: '\_'. + nameModified := self asDictionary at: 'profile-card-fullname'. + nameModified := nameModified copyReplaceAll: '🇨🇴' with: ''. + tempDictionary at: 'profile-bio' put: bioModified; + at: 'profile-card-username' put: userModified; + at: 'profile-card-fullname' put: nameModified. + ^ MarkupFile + exportAsFileOn: (folder / self userName , 'tex') + containing:(mustacheFile asMustacheTemplate value: tempDictionary)] + \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/installTemplate.st b/Socialmetrica.package/NitterUser.class/instance/installTemplate.st index 1cd4e82..87deded 100644 --- a/Socialmetrica.package/NitterUser.class/instance/installTemplate.st +++ b/Socialmetrica.package/NitterUser.class/instance/installTemplate.st @@ -3,7 +3,9 @@ installTemplate | templateFiles folder | templateFiles := #( -'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/twentysecondcvMod.cls&ci=tip' 'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/template.mus.tex&ci=tip'). +'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/twentysecondcvMod.cls&ci=tip' +'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/TwentySecondsCV/template.mus.tex&ci=tip' +'https://mutabit.com/repos.fossil/mutabit/raw?name=plantillas/SarissaPersonalBlog/index.mus.html&ci=tip'). folder := TweetsCollection dataStore / 'templates'. folder exists ifTrue: [ folder ensureDeleteAllChildren ]