Additional way of showing the stress in DSL dicts: via font styles instead of accents.

The default is the same: Stress is shown by adding accent sign.

With this change it is now possible to configure GoldenDict
in such a way that stress could be shown with font styles
(e.g., color, boldness, etc).

Add the following to your article-style.css:

.dsl_stress_without_accent {
  color: red;
  display:inline;
}

.dsl_stress_with_accent {
  display: none;
}
This commit is contained in:
Tvangeste 2011-06-02 13:30:38 +02:00
parent adc4c56954
commit c11c3c25fe
2 changed files with 11 additions and 1 deletions

View file

@ -271,6 +271,10 @@ div.sdct_x
cursor: default; cursor: default;
} }
.dsl_stress_without_accent {
display: none;
}
.dsl_t .dsl_t
{ {
font-weight: bold; font-weight: bold;

8
dsl.cc
View file

@ -848,7 +848,13 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
else else
if ( node.tagName == GD_NATIVE_TO_WS( L"'" ) ) if ( node.tagName == GD_NATIVE_TO_WS( L"'" ) )
{ {
result += "<span class=\"dsl_stress\">" + processNodeChildren( node ) + Utf8::encode( wstring( 1, 0x301 ) ) + "</span>"; // There are two ways to display the stress: by adding an accent sign or via font styles.
// We generate two spans, one with accented data and another one without it, so the
// user could pick up the best suitable option.
string data = processNodeChildren( node );
result += "<span class=\"dsl_stress\"><span class=\"dsl_stress_without_accent\">" + data + "</span>"
+ "<span class=\"dsl_stress_with_accent\">" + data + Utf8::encode( wstring( 1, 0x301 ) )
+ "</span></span>";
} }
else else
if ( node.tagName == GD_NATIVE_TO_WS( L"lang" ) ) if ( node.tagName == GD_NATIVE_TO_WS( L"lang" ) )