Skip to content

Commit

Permalink
#1166 replace repeating selector code with a macro -- less prone to e…
Browse files Browse the repository at this point in the history
…rror.
  • Loading branch information
karlkleinpaste committed Aug 12, 2024
1 parent 40dcf0d commit 34771e1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ h3 { font-style: %s } --> \
</style>%s</head><body>"
// 7 interpolable strings: bg/txt/link colors, block, renderHeader, italic heading, external css.

#define ITALIC_SELECTOR (ops->italic_headings ? "italic" : "bold" )

// CSS style blocks to control blocked strongs+morph output
// BOTH is when the user wants to see both types of markup.
// ONE is when he wants one or the other, so we can use a single
Expand Down Expand Up @@ -978,7 +980,7 @@ GTKEntryDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -1341,7 +1343,7 @@ GTKChapDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down Expand Up @@ -1617,7 +1619,7 @@ DialogEntryDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -1751,7 +1753,7 @@ DialogChapDisp::display(SWModule &imodule)
? DOUBLE_SPACE
: ""))),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down Expand Up @@ -1953,7 +1955,7 @@ GTKPrintEntryDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value,
Expand Down Expand Up @@ -2002,7 +2004,7 @@ GTKPrintChapDisp::display(SWModule &imodule)
settings.link_color,
(ops->doublespace ? DOUBLE_SPACE : ""),
imodule.getRenderHeader(),
(ops->italic_headings ? "italic" : "bold" ),
ITALIC_SELECTOR,
get_css_references(imodule),
((mf->old_font) ? mf->old_font : ""),
mf->old_font_size_value);
Expand Down

0 comments on commit 34771e1

Please sign in to comment.