Skip to content

Commit

Permalink
Merge pull request #3 from strboul/nice-mode
Browse files Browse the repository at this point in the history
Make sukela nice mode consistent
  • Loading branch information
beucismis authored Apr 30, 2023
2 parents 1e987af + a7c22f1 commit 8b60525
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ozgursozluk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Topic:
pagecount: int
permalink: str
entrys: Iterator[Entry]
nice: bool | None = None

def title_id(self) -> str:
return _unicode_tr(f"{self.title}--{self.id}")
Expand Down Expand Up @@ -129,6 +130,7 @@ def get_topic(self, title: str, page: int = 1, a: str = None) -> Topic:
int(pager.attrs["data-pagecount"]) if pager is not None else 0,
self.base_url + h1.find("a", href=True)["href"],
self._get_entrys(soup),
a == "nice",
)

def get_entry(self, id: str) -> Topic:
Expand Down
8 changes: 7 additions & 1 deletion ozgursozluk/templates/topic.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
<div class="info">
<div>
<p>
{{ topic.title }} - şükela:
{{ topic.title }} - şükela:
{% if topic.nice %}
<a href="{{ url_for('topic', title=topic.title_id()) }}">
<b>nice</b>
</a>
{% else %}
<a href="{{ url_for('topic', title=topic.title_id(), p=p, a='nice') }}">nice</a>
{% endif %}
</p>
</div>
<div>
Expand Down

0 comments on commit 8b60525

Please sign in to comment.