1
1
# SPDX-License-Identifier: AGPL-3.0-only
2
- import strutils, tables, strformat
2
+ import strutils, tables, strformat, unicode
3
3
import karax/ [karaxdsl, vdom, vstyles]
4
4
from jester import Request
5
5
@@ -31,13 +31,13 @@ proc renderNoteParagraph(articleParagraph: ArticleParagraph; article: Article):
31
31
for er in articleParagraph.entityRanges:
32
32
# flush remaining text
33
33
if er.offset > last:
34
- result .add text text.substr (last, er.offset - 1 )
34
+ result .add text text.runeSubStr (last, er.offset - last )
35
35
36
36
let entity = article.entities[er.key]
37
37
case entity.entityType
38
38
of ArticleEntityType .link:
39
39
let link = buildHtml (a (href= entity.url)):
40
- text text.substr (er.offset, er.offset + er. length - 1 )
40
+ text text.runeSubStr (er.offset, er.length)
41
41
result .add link
42
42
of ArticleEntityType .media:
43
43
for id in entity.mediaIds:
@@ -55,7 +55,7 @@ proc renderNoteParagraph(articleParagraph: ArticleParagraph; article: Article):
55
55
56
56
# flush remaining text
57
57
if last < text.len:
58
- result .add text text.substr (last)
58
+ result .add text text.runeSubStr (last)
59
59
60
60
proc renderNote * (article: Article ; prefs: Prefs ): VNode =
61
61
let cover = getSmallPic (article.coverImage)
0 commit comments