Modyfing nitter user sanitization for tex exporter.

This commit is contained in:
ruidajo 2022-04-29 17:58:03 -05:00
parent 104fe9e348
commit aa5cf9cbba
4 changed files with 19 additions and 7 deletions

View File

@ -2,5 +2,6 @@ accessing
createdAt
^ createdAt ifNil: [| joinDateString |
joinDateString := ((self documentTree xpath: '//div[@class="profile-joindate"]/span/@title') stringValue).
joinDateString := joinDateString copyReplaceAll: '3 May' with: '03 May'.
createdAt := (ZTimestampFormat fromString:'4:05 PM - 03 Feb 2001') parse: joinDateString.
]

View File

@ -1,13 +1,22 @@
accessing
exportWithTemplate: mustacheFile into: folder
| tempDictionary modified |
| tempDictionary bioModified userModified nameModified |
tempDictionary := self asDictionary copy.
modified := self asDictionary at: 'profile-bio'.
modified := modified copyReplaceAll: '@' with: '\@'.
modified := modified copyReplaceAll: '_' with: '\_'.
modified := modified copyReplaceAll: '#' with: '\#'.
tempDictionary at: 'profile-bio' put: modified.
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)

View File

@ -3,5 +3,7 @@ url
^ url ifNil: [ | temp |
temp := ((self documentTree xpath: '//div[@class="profile-website"]') // 'a' @@ 'href') first.
temp ifNil: [ ^ url := nil ].
temp := temp replaceAll: with: $u.
temp := temp replaceAll: with: $i.
url := temp asUrl.
]

View File

@ -1,3 +1,3 @@
accessing
messages
^ messages ifNil: [ messages := OrderedCollection new ]
^ messages ifNil: [ messages := TweetsCollection new ]