Skip to content

Commit

Permalink
Fix quotes (#1544)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp authored Apr 4, 2023
1 parent d69016b commit 06ccd62
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
3 changes: 2 additions & 1 deletion frontend/src/style/misago/markup.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// --------------------------------------------------

// Set font-size
.misago-markup {
.misago-markup,
.misago-markup blockquote {
font-size: @misago-markup-font-size;
}

Expand Down
13 changes: 2 additions & 11 deletions misago/markup/finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

QUOTE_HEADER_RE = re.compile(
r"""
<div class="quote-heading">(?P<title>.*?)</div>
<div class="quote-heading" data-noquote="1">(?P<title>.*?)</div>
""".strip(),
re.IGNORECASE | re.MULTILINE | re.DOTALL,
)
Expand All @@ -24,16 +24,7 @@ def replace_quote_headers(matchobj):
quote_title = _("%(title)s has written:") % {"title": title}
else:
quote_title = _("Quoted message:")
return '<div class="quote-heading">%s</div>' % quote_title


def replace_spoiler_headers(matchobj):
title = matchobj.group("title")
if title:
spoiler_title = _("%(title)s:") % {"title": title}
else:
spoiler_title = _("Spoiler:")
return '<div class="spoiler-heading">%s</div>' % spoiler_title
return '<div class="quote-heading" data-noquote="1">%s</div>' % quote_title


def replace_spoiler_reveal_buttons(post):
Expand Down
4 changes: 2 additions & 2 deletions misago/markup/tests/snapshots/snap_test_finalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
snapshots = Snapshot()

snapshots[
"test_finalization_sets_translation_strings_in_quotes 1"
] = '<div class="quote-heading">Quoted message:</div>'
"test_finalization_sets_translation_strings_in_empty_quotes_headings 1"
] = '<div class="quote-heading" data-noquote="1">Quoted message:</div>'

snapshots[
"test_finalization_sets_translation_strings_in_spoilers_buttons 1"
Expand Down
10 changes: 8 additions & 2 deletions misago/markup/tests/test_finalization.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from ..finalize import finalize_markup


def test_finalization_sets_translation_strings_in_quotes(snapshot):
test_text = '<div class="quote-heading"></div>'
def test_finalization_sets_translation_strings_in_empty_quotes_headings(snapshot):
test_text = '<div class="quote-heading" data-noquote="1">Lorem ipsum</div>'
finalized_text = finalize_markup(test_text)
snapshot.assert_match(finalized_text)


def test_finalization_sets_translation_strings_in_empty_quotes_headings(snapshot):
test_text = '<div class="quote-heading" data-noquote="1"></div>'
finalized_text = finalize_markup(test_text)
snapshot.assert_match(finalized_text)

Expand Down
2 changes: 1 addition & 1 deletion misago/static/misago/css/misago.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion misago/static/misago/css/misago.css.map

Large diffs are not rendered by default.

0 comments on commit 06ccd62

Please sign in to comment.