Skip to content

Commit

Permalink
Breaking: Glossary: wordTitleStr: rename _class arg to class_
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 12, 2024
1 parent d678708 commit 9cc2887
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyglossary/glossary_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def wordTitleStr(
self,
word: str,
sample: str = "",
_class: str = "",
class_: str = "",
) -> str: ...

def getConfig(self, name: str, default: str | None) -> str | None: ...
Expand Down
6 changes: 3 additions & 3 deletions pyglossary/glossary_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def wordTitleStr(
self,
word: str,
sample: str = "",
_class: str = "",
class_: str = "",
) -> str:
"""
Return title tag for words.
Expand All @@ -587,8 +587,8 @@ def wordTitleStr(
if not sample:
sample = word
tag = self.titleTag(sample)
if _class:
return f'<{tag} class="{_class}">{word}</{tag}><br>'
if class_:
return f'<{tag} class="{class_}">{word}</{tag}><br>'
return f"<{tag}>{word}</{tag}><br>"

def getConfig(self, name: str, default: str | None) -> str | None:
Expand Down
2 changes: 1 addition & 1 deletion pyglossary/plugins/html_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def addLinks(text: str, pos: int) -> None:
title = glos.wordTitleStr(
wordSep.join(words),
sample=entry.l_word[0],
_class="headword",
class_="headword",
)

if not title:
Expand Down
2 changes: 1 addition & 1 deletion tests/deprecated/glossary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ def test_wordTitleStr_b1(self):
def test_wordTitleStr_b2(self):
glos = self.glos = Glossary()
self.assertEqual(
glos.wordTitleStr("test1", _class="headword"),
glos.wordTitleStr("test1", class_="headword"),
'<b class="headword">test1</b><br>',
)

Expand Down
2 changes: 1 addition & 1 deletion tests/glossary_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def test_wordTitleStr_b1(self):
def test_wordTitleStr_b2(self):
glos = self.glos = Glossary()
self.assertEqual(
glos.wordTitleStr("test1", _class="headword"),
glos.wordTitleStr("test1", class_="headword"),
'<b class="headword">test1</b><br>',
)

Expand Down

0 comments on commit 9cc2887

Please sign in to comment.