Implement Hungarian quotation marks style (#12040)

File format change
This commit is contained in:
Juergen Spitzmueller 2020-12-02 17:00:40 +01:00
parent 58e1fc9e3c
commit e9cbd69f6e
11 changed files with 201 additions and 11 deletions

View File

@ -7,6 +7,11 @@ changes happened in particular if possible. A good example would be
-----------------------
2020-12-02 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 600: Hungarian quote style
New buffer param \quotes_style hungarian
\begin_inset Quotes h{l,r}{d,s}
2020-10-10 Pavel Sanda <sanda@lyx.org>
* Format incremented to 599: Add inset for \nopagebreak macro (part of InseNewPage now).

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 599
\lyxformat 600
\begin_document
\begin_header
\save_transient_properties true
@ -19447,7 +19447,13 @@ Quote Style
\family default
(note that \SpecialChar LyX
makes a sensible proposal for the selected main language).
There are 14
There are 1
\change_deleted -712698321 1606924196
4
\change_inserted -712698321 1606924196
5
\change_unchanged
\begin_inset space ~
\end_inset
@ -20078,6 +20084,76 @@ these inner
\end_inset
quotation marks (another style common in Sweden)
\change_inserted -712698321 1606924211
\end_layout
\begin_layout Labeling
\labelwidthstring <<Outer>> and <<inner>>:
\change_inserted -712698321 1606924279
\family sans
\begin_inset Quotes pld
\end_inset
Outer
\begin_inset Quotes prd
\end_inset
\begin_inset space ~
\end_inset
and
\begin_inset space ~
\end_inset
\begin_inset Quotes ald
\end_inset
inner
\begin_inset Quotes ard
\end_inset
\family default
Produces
\family sans
\begin_inset Quotes pld
\end_inset
\family default
these outer
\family sans
\begin_inset Quotes prd
\end_inset
\family default
and
\family sans
\begin_inset Quotes ald
\end_inset
\family default
these inner
\family sans
\begin_inset Quotes ard
\end_inset
\family default
quotation marks (as common in Hungary)
\change_unchanged
\end_layout
\begin_layout Labeling

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 598
\lyxformat 600
\begin_document
\begin_header
\save_transient_properties true
@ -18511,7 +18511,7 @@ Anführungszeichen
Beachten Sie aber, dass \SpecialChar LyX
für die ausgewählte Hauptsprache des Dokuments
jeweils einen sinnvollen Vorschlag macht.
Es stehen 14 Varianten zur Auswahl:
Es stehen 15 Varianten zur Auswahl:
\end_layout
\begin_layout Labeling
@ -19122,6 +19122,62 @@ diese inneren
Anführungszeichen (ein weiterer in Schweden gebräuchlicher Stil)
\end_layout
\begin_layout Labeling
\labelwidthstring <<Äußere>> und <<innere>>:
\family sans
\begin_inset Quotes pld
\end_inset
Äußere
\begin_inset Quotes prd
\end_inset
\begin_inset space ~
\end_inset
und
\begin_inset space ~
\end_inset
\begin_inset Quotes ald
\end_inset
innere
\begin_inset Quotes ard
\end_inset
\family default
Produziert
\begin_inset Quotes pld
\end_inset
diese äußeren
\begin_inset Quotes prd
\end_inset
und
\family sans
\begin_inset Quotes ald
\end_inset
\family default
diese inneren
\family sans
\begin_inset Quotes ard
\end_inset
\family default
Anführungszeichen (in Ungarn gebräuchlich)
\end_layout
\begin_layout Labeling
\labelwidthstring <<Äußere>> und <<innere>>:
\begin_inset Quotes jld

View File

@ -57,6 +57,7 @@
# - french: <<text>> ``text'' (outward guillemets -- 66_99)
# - frenchin: <<text>> <<text>> (French Imprimerie Nationale style)
# - german: ,,text`` ,text` (99/66 -- 9/6)
# - hungarian: ,,text'' >>text<< (99/99 -- double inward guillemets)
# - polish: ,,text'' ,text' (99/99 -- 9/9)
# - russian: <<text>> ,,text`` (outward guillemets -- 99/66)
# - swedish: ''text'' 'text' (99_99 -- 9_9)
@ -1116,7 +1117,7 @@ Language magyar
BabelName magyar
PolyglossiaName magyar
XindyName hungarian
QuoteStyle polish
QuoteStyle hungarian
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "yyyy. MMMM d.|yyyy. MMM d.|yyyy.MM.dd."

View File

@ -3971,6 +3971,28 @@ def revert_nopagebreak(document):
document.body[i : end + 1] = subst
def revert_hrquotes(document):
" Revert Hungarian Quotation marks "
i = find_token(document.header, "\\quotes_style hungarian", 0)
if i != -1:
document.header[i] = "\\quotes_style polish"
i = 0
while True:
i = find_token(document.body, "\\begin_inset Quotes h")
if i == -1:
return
if document.body[i] == "\\begin_inset Quotes hld":
document.body[i] = "\\begin_inset Quotes pld"
elif document.body[i] == "\\begin_inset Quotes hrd":
document.body[i] = "\\begin_inset Quotes prd"
elif document.body[i] == "\\begin_inset Quotes hls":
document.body[i] = "\\begin_inset Quotes ald"
elif document.body[i] == "\\begin_inset Quotes hrs":
document.body[i] = "\\begin_inset Quotes ard"
##
# Conversion hub
#
@ -4031,10 +4053,12 @@ convert = [
[596, [convert_parskip]],
[597, [convert_libertinus_rm_fonts]],
[598, []],
[599, []]
[599, []],
[600, []]
]
revert = [[598, [revert_nopagebreak]],
revert = [[598, [revert_hrquotes]],
[598, [revert_nopagebreak]],
[597, [revert_docbook_table_output]],
[596, [revert_libertinus_rm_fonts,revert_libertinus_sftt_fonts]],
[595, [revert_parskip,revert_line_vspaces]],

View File

@ -73,7 +73,8 @@ static char const * const string_paragraph_separation[] = {
static char const * const string_quotes_style[] = {
"english", "swedish", "german", "polish", "swiss", "danish", "plain",
"british", "swedishg", "french", "frenchin", "russian", "cjk", "cjkangle", ""
"british", "swedishg", "french", "frenchin", "russian", "cjk", "cjkangle",
"hungarian", ""
};
@ -156,6 +157,7 @@ QuotesStyleTranslator const init_quotesstyletranslator()
translator.addPair(string_quotes_style[11], QuoteStyle::Russian);
translator.addPair(string_quotes_style[12], QuoteStyle::CJK);
translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngle);
translator.addPair(string_quotes_style[14], QuoteStyle::Hungarian);
return translator;
}

View File

@ -67,10 +67,11 @@ namespace {
* r <<russian>> (,,inner quotation``)
* j [U+300C]cjk[U+300D] ([U+300E]inner quotation[U+300F]) [CORNER BRACKETS]
* k [U+300A]cjkangle[U+300B] ([U+3008]inner quotation[U+3009]) [ANGLE BRACKETS]
* h ,,hungarian'' (>>inner quotation<<)
* x dynamic style (inherits document settings)
*/
char const * const style_char = "esgpcaqbwfirjkx";
char const * const style_char = "esgpcaqbwfirjkhx";
char const * const side_char = "lr" ;
char const * const level_char = "sd";
@ -305,6 +306,13 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
right_secondary = 0x3009; // RIGHT ANGLE BRACKET
break;
}
case QuoteStyle::Hungarian: {
left_primary = 0x201e; // ,,
right_primary = 0x201d; // ''
left_secondary = 0x00bb; // >>
right_secondary = 0x00ab; // <<
break;
}
case QuoteStyle::Dynamic:
default:
// should not happen
@ -707,6 +715,8 @@ QuoteStyle InsetQuotes::getStyle(string const & s)
qs = QuoteStyle::CJK;
else if (s == "cjkangle")
qs = QuoteStyle::CJKAngle;
else if (s == "hungarian")
qs = QuoteStyle::Hungarian;
else if (s == "dynamic")
qs = QuoteStyle::Dynamic;

View File

@ -51,6 +51,8 @@ enum class QuoteStyle : int {
///
CJKAngle,
///
Hungarian,
///
Dynamic
};

View File

@ -121,6 +121,9 @@ const char * const known_german_quotes_languages[] = {"austrian", "bulgarian",
const char * const known_polish_quotes_languages[] = {"afrikaans", "bosnian", "croatian",
"dutch", "magyar", "polish", "romanian", "serbian", "serbian-latin", 0};
/// languages with hungarian quotes (.lyx names)
const char * const known_hungarian_quotes_languages[] = {"magyar", 0};
/// languages with russian quotes (.lyx names)
const char * const known_russian_quotes_languages[] = {"azerbaijani", "oldrussian",
"russian", "ukrainian", 0};
@ -3173,6 +3176,9 @@ void Preamble::parse(Parser & p, string const & forceclass,
// polish
else if (is_known(h_language, known_polish_quotes_languages))
h_quotes_style = "polish";
// hungarian
else if (is_known(h_language, known_hungarian_quotes_languages))
h_quotes_style = "hungarian";
// russian
else if (is_known(h_language, known_russian_quotes_languages))
h_quotes_style = "russian";

View File

@ -481,6 +481,8 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "brs";
else if (preamble.quotesStyle() == "french")
res = "frs";
else if (preamble.quotesStyle() == "hungarian")
res = "hrd";
else if (preamble.quotesStyle() == "swedish")
res = opening ? "sld" : "srd";
} else if (in == "els") {// `
@ -502,6 +504,8 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "fld";
else if (preamble.quotesStyle() == "russian")
res = "rld";
else if (preamble.quotesStyle() == "hungarian")
res = "hrs";
} else if (in == "ald") {// <<
if (preamble.quotesStyle() == "swiss")
res = "crd";
@ -509,6 +513,8 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "frd";
else if (preamble.quotesStyle() == "russian")
res = "rrd";
else if (preamble.quotesStyle() == "hungarian")
res = "hls";
} else if (in == "ars") {// >
if (preamble.quotesStyle() == "swiss")
res = "cls";
@ -518,6 +524,8 @@ string guessQuoteStyle(string const & in, bool const opening)
} else if (in == "gld") {// ,,
if (preamble.quotesStyle() == "polish")
res = "pld";
else if (preamble.quotesStyle() == "hungarian")
res = "hld";
else if (preamble.quotesStyle() == "russian")
res = "rls";
} else if (in == "gls") {// ,

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 599 // sanda: nobreakpage
#define LYX_FORMAT_TEX2LYX 599
#define LYX_FORMAT_LYX 600 // spitz: hungarian quote style
#define LYX_FORMAT_TEX2LYX 600
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER