parent
375cb1a243
commit
d358912790
2 changed files with 6 additions and 2 deletions
|
@ -14,6 +14,7 @@ const
|
||||||
manifestRegex = re"(.+(.ts|.m3u8|.vmap))"
|
manifestRegex = re"(.+(.ts|.m3u8|.vmap))"
|
||||||
userpicRegex = re"_(normal|bigger|mini|200x200|400x400)(\.[A-z]+)$"
|
userpicRegex = re"_(normal|bigger|mini|200x200|400x400)(\.[A-z]+)$"
|
||||||
extRegex = re"(\.[A-z]+)$"
|
extRegex = re"(\.[A-z]+)$"
|
||||||
|
illegalXmlRegex = re"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]"
|
||||||
|
|
||||||
twitter = parseUri("https://twitter.com")
|
twitter = parseUri("https://twitter.com")
|
||||||
|
|
||||||
|
@ -26,6 +27,9 @@ proc stripHtml*(text: string): string =
|
||||||
el[0].text = link
|
el[0].text = link
|
||||||
html.innerText()
|
html.innerText()
|
||||||
|
|
||||||
|
proc sanitizeXml*(text: string): string =
|
||||||
|
text.replace(illegalXmlRegex, "")
|
||||||
|
|
||||||
proc shortLink*(text: string; length=28): string =
|
proc shortLink*(text: string; length=28): string =
|
||||||
result = text.replace(wwwRegex, "")
|
result = text.replace(wwwRegex, "")
|
||||||
if result.len > length:
|
if result.len > length:
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
#var title = profile.fullname
|
#var title = profile.fullname
|
||||||
#if not multi: title &= " / " & user
|
#if not multi: title &= " / " & user
|
||||||
#end if
|
#end if
|
||||||
#title = xmltree.escape(title)
|
#title = xmltree.escape(title).sanitizeXml
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
|
||||||
<channel>
|
<channel>
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
<width>128</width>
|
<width>128</width>
|
||||||
<height>128</height>
|
<height>128</height>
|
||||||
</image>
|
</image>
|
||||||
# if timeline.content.len > 0:
|
#if timeline.content.len > 0:
|
||||||
${renderRssTweets(timeline.content, prefs, hostname)}
|
${renderRssTweets(timeline.content, prefs, hostname)}
|
||||||
#end if
|
#end if
|
||||||
</channel>
|
</channel>
|
||||||
|
|
Loading…
Reference in a new issue