Skip to content

Commit 76c930e

Browse files
notes: use runeSubStr for ranges
1 parent f4481c7 commit 76c930e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/views/notes.nim

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: AGPL-3.0-only
2-
import strutils, tables, strformat
2+
import strutils, tables, strformat, unicode
33
import karax/[karaxdsl, vdom, vstyles]
44
from jester import Request
55

@@ -31,13 +31,13 @@ proc renderNoteParagraph(articleParagraph: ArticleParagraph; article: Article):
3131
for er in articleParagraph.entityRanges:
3232
# flush remaining text
3333
if er.offset > last:
34-
result.add text text.substr(last, er.offset - 1)
34+
result.add text text.runeSubStr(last, er.offset - last)
3535

3636
let entity = article.entities[er.key]
3737
case entity.entityType
3838
of ArticleEntityType.link:
3939
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)
4141
result.add link
4242
of ArticleEntityType.media:
4343
for id in entity.mediaIds:

0 commit comments

Comments
 (0)