commit e9cbd69f6ef3a41260f1ed4a7f66b48acdcd52a8 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Wed Dec 2 17:00:40 2020 +0100
Implement Hungarian quotation marks style (#12040) File format change --- development/FORMAT | 5 +++ lib/doc/UserGuide.lyx | 80 ++++++++++++++++++++++++++++++++++++++++++- lib/doc/de/UserGuide.lyx | 60 ++++++++++++++++++++++++++++++++- lib/languages | 3 +- lib/lyx2lyx/lyx_2_4.py | 28 ++++++++++++++- src/BufferParams.cpp | 4 ++- src/insets/InsetQuotes.cpp | 12 ++++++- src/insets/InsetQuotes.h | 2 + src/tex2lyx/Preamble.cpp | 6 +++ src/tex2lyx/text.cpp | 8 ++++ src/version.h | 4 +- 11 files changed, 201 insertions(+), 11 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index c8a237a..98ad456 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,11 @@ changes happened in particular if possible. A good example would be ----------------------- +2020-12-02 Jürgen Spitzmüller <sp...@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 <sa...@lyx.org> * Format incremented to 599: Add inset for \nopagebreak macro (part of InseNewPage now). diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index afd39d5..f7cba1f 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -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 diff --git a/lib/doc/de/UserGuide.lyx b/lib/doc/de/UserGuide.lyx index 7d8fa3b..651e7f2 100644 --- a/lib/doc/de/UserGuide.lyx +++ b/lib/doc/de/UserGuide.lyx @@ -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 @@ -19124,6 +19124,62 @@ diese inneren \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 \end_inset diff --git a/lib/languages b/lib/languages index b6cd6ef..76652f9 100644 --- a/lib/languages +++ b/lib/languages @@ -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." diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index fafa8dd..a6ce67a 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -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]], diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index ea60c75..beb6eb2 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -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; } diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 5fe2939..d503e8b 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -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; diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index 14b3ba0..4035e13 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -51,6 +51,8 @@ enum class QuoteStyle : int { /// CJKAngle, /// + Hungarian, + /// Dynamic }; diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 5d329ae..f15a9f1 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -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"; diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index e06ba2d..8d5ec7a 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -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") {// , diff --git a/src/version.h b/src/version.h index f137661..7b31131 100644 --- a/src/version.h +++ b/src/version.h @@ -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 -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs