Socialmetrica/Socialmetrica.package/NitterUser.class/instance/exportWithTemplate.into..st

29 lines
1.4 KiB
Smalltalk
Raw Normal View History

accessing
2022-04-04 21:41:12 +00:00
exportWithTemplate: mustacheFile into: folder
| tempDictionary bioModified userModified nameModified |
tempDictionary := self asDictionary copy.
2022-06-01 20:52:32 +00:00
(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)]