Skip to content

Commit 9898287

Browse files
committed
zim reader: fix quoting of href= value
1 parent 6c3925c commit 9898287

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyglossary/plugins/zimfile/reader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
from typing import TYPE_CHECKING
7+
from xml.sax.saxutils import quoteattr
78

89
from pyglossary.core import cacheDir, exc_note, log, pip
910

@@ -103,9 +104,10 @@ def __iter__(self) -> Iterator[EntryType | None]: # noqa: PLR0912
103104
if zEntry.is_redirect:
104105
redirectCount += 1
105106
targetWord = zEntry.get_redirect_entry().title
107+
hrefQuoted = quoteattr("bword://" + targetWord)
106108
yield glos.newEntry(
107109
term,
108-
f'Redirect: <a href="bword://{targetWord}">{targetWord}</a>',
110+
f"Redirect: <a href={hrefQuoted}>{targetWord}</a>",
109111
defiFormat="h",
110112
)
111113
continue

0 commit comments

Comments
 (0)