Adding hebrew quotation marks (bug #12849).

Patch from Udi Fogiel.
This commit is contained in:
Pavel Sanda 2023-08-06 16:50:07 +02:00
parent d656e01172
commit 9e8901f997
11 changed files with 129 additions and 10 deletions

View File

@ -7,6 +7,11 @@ changes happened in particular if possible. A good example would be
-----------------------
2023-08-01 Udi Fogiel <udifoglle@gmail.com>
* Format incremented to 618: Hebrew quote style
New buffer param \quotes_style hebrew
\begin_inset Quotes d{l,r}{d,s}
2023-07-20 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 617: Update covington support in linguistics module:
- Support enviroment option of example and examples

View File

@ -1,5 +1,5 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 616
\lyxformat 618
\begin_document
\begin_header
\save_transient_properties true
@ -168,6 +168,7 @@ logicalmkup
\author 244031559 "Yuriy"
\author 274215730 "scott"
\author 630872221 "Jean-Pierre Chrétien" jeanpierre.chretien@free.fr
\author 1064312605 "Udi Fogiel"
\author 1549938239 "Kornel Benko"
\author 1675569489 "Stephan Witt"
\end_header
@ -23349,6 +23350,66 @@ Note that these characters are just emulated with similar-looking math symbols i
\end_inset
\change_inserted 1064312605 1690963146
\end_layout
\begin_layout Labeling
\labelwidthstring <<Outer>> and <<inner>>:
\change_inserted 1064312605 1690963188
\family sans
\begin_inset Quotes dld
\end_inset
Outer
\begin_inset Quotes drd
\end_inset
\begin_inset space ~
\end_inset
and
\begin_inset space ~
\end_inset
\begin_inset Quotes dls
\end_inset
inner
\begin_inset Quotes drs
\end_inset
\family default
Produces
\begin_inset Quotes dld
\end_inset
these outer
\family sans
\begin_inset Quotes drd
\end_inset
\family default
and
\begin_inset Quotes dls
\end_inset
these inner
\family sans
\begin_inset Quotes drs
\end_inset
\family default
quotation marks (as common in Hungary)
\change_unchanged
\end_layout

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)
# - hebrew: ''text,, 'text, (99/99 -- 9/9)
# - hungarian: ,,text'' >>text<< (99/99 -- double inward guillemets)
# - polish: ,,text'' ,text' (99/99 -- 9/9)
# - russian: <<text>> ,,text`` (outward guillemets -- 99/66)
@ -850,12 +851,12 @@ Language hebrew
PolyglossiaName hebrew
XindyName hebrew
Encoding cp1255
QuoteStyle english
QuoteStyle hebrew
InternalEncoding true
# babel-hebrew expects the encoding for *other* languages last:
FontEncoding HE8,T1|LHE,T1
## Use font encoding HE8 if the Culmus fonts are installed and
# work around too simple test for article-like classes in rlbabel.def.
# work around to simple test for article-like classes in rlbabel.def.
PreBabelPreamble
\IfFileExists{he8david.fd}{%
\providecommand{\HeblatexEncoding}{HE8}

View File

@ -5525,6 +5525,27 @@ def revert_expreambles(document):
revert_flex_inset(document.body, "Subexample Preamble", "\\subexpreamble")
revert_flex_inset(document.body, "Example Postamble", "\\expostamble")
revert_flex_inset(document.body, "Subexample Postamble", "\\subexpostamble")
def revert_hequotes(document):
" Revert Hebrew Quotation marks "
i = find_token(document.header, "\\quotes_style hebrew", 0)
if i != -1:
document.header[i] = "\\quotes_style english"
i = 0
while True:
i = find_token(document.body, "\\begin_inset Quotes d")
if i == -1:
return
if document.body[i] == "\\begin_inset Quotes dld":
document.body[i] = "\\begin_inset Quotes prd"
elif document.body[i] == "\\begin_inset Quotes drd":
document.body[i] = "\\begin_inset Quotes pld"
elif document.body[i] == "\\begin_inset Quotes dls":
document.body[i] = "\\begin_inset Quotes prd"
elif document.body[i] == "\\begin_inset Quotes drs":
document.body[i] = "\\begin_inset Quotes pld"
##
@ -5605,10 +5626,12 @@ convert = [
[614, [convert_hyper_other]],
[615, [convert_acknowledgment,convert_ack_theorems]],
[616, [convert_empty_macro]],
[617, [convert_cov_options]]
[617, [convert_cov_options]],
[618, []]
]
revert = [[616, [revert_expreambles,revert_exarg2,revert_linggloss2,revert_cov_options]],
revert = [[617, [revert_hequotes]],
[616, [revert_expreambles,revert_exarg2,revert_linggloss2,revert_cov_options]],
[615, [revert_empty_macro]],
[614, [revert_ack_theorems,revert_acknowledgment]],
[613, [revert_hyper_other]],

View File

@ -74,7 +74,7 @@ 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",
"hungarian", ""
"hungarian", "hebrew", ""
};
@ -158,6 +158,7 @@ QuotesStyleTranslator const init_quotesstyletranslator()
translator.addPair(string_quotes_style[12], QuoteStyle::CJK);
translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngle);
translator.addPair(string_quotes_style[14], QuoteStyle::Hungarian);
translator.addPair(string_quotes_style[15], QuoteStyle::Hebrew);
return translator;
}

View File

@ -3479,6 +3479,7 @@ void LyXAction::init()
* 'french' for <<french>> quote style (with ``inner quotation'')\n
* 'frenchin' for <<frenchin>> quote style (with <<inner quotation>>) ["in" = Imprimerie Nationale]\n
* 'german' for ,,German`` quote style (with ,inner quotation`)\n
* 'hebrew' for ''hebrew,, quote style (with 'inner quotation,)\n
* 'plain' for "Plain" quote style (with 'inner quotation')\n
* 'polish' for ,,Polish'' quote style (with ,inner quotation')\n
* 'swedish' for ''Swedish'' quote style (with 'inner quotation')\n

View File

@ -68,10 +68,11 @@ namespace {
* 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<<)
* d ''hebrew,, ('inner quotation,)
* x dynamic style (inherits document settings)
*/
char const * const style_char = "esgpcaqbwfirjkhx";
char const * const style_char = "esgpcaqbwfirjkhdx";
char const * const side_char = "lr" ;
char const * const level_char = "sd";
@ -313,6 +314,13 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
right_secondary = 0x00ab; // <<
break;
}
case QuoteStyle::Hebrew: {
left_primary = 0x201d; // ''
right_primary = 0x201e; // ,,
left_secondary = 0x2019; // '
right_secondary = 0x201a; // ,
break;
}
case QuoteStyle::Dynamic:
default:
// should not happen
@ -641,6 +649,8 @@ QuoteStyle InsetQuotes::getStyle(string const & s)
qs = QuoteStyle::CJKAngle;
else if (s == "hungarian")
qs = QuoteStyle::Hungarian;
else if (s == "hebrew")
qs = QuoteStyle::Hebrew;
else if (s == "dynamic")
qs = QuoteStyle::Dynamic;

View File

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

View File

@ -137,6 +137,9 @@ const char * const known_swiss_quotes_languages[] = {"albanian",
"armenian", "basque", "churchslavonic", "german-ch", "german-ch-old",
"norsk", "nynorsk", "turkmen", "ukrainian", "vietnamese", 0};
/// languages with hebrew quotes (.lyx names)
const char * const known_hebrew_quotes_languages[] = {"hebrew", 0};
/// known language packages from the times before babel
const char * const known_old_language_packages[] = {"french", "frenchle",
"frenchpro", "german", "ngerman", "pmfrench", 0};
@ -3173,7 +3176,7 @@ void Preamble::parse(Parser & p, string const & forceclass,
// Finally, set the quote style.
// LyX knows the following quotes styles:
// british, cjk, cjkangle, danish, english, french, german,
// polish, russian, swedish and swiss
// polish, russian, swedish, swiss, and hebrew
// conversion list taken from
// https://en.wikipedia.org/wiki/Quotation_mark,_non-English_usage
// (quotes for kazakh are unknown)
@ -3210,6 +3213,10 @@ void Preamble::parse(Parser & p, string const & forceclass,
// swiss
else if (is_known(h_language, known_swiss_quotes_languages))
h_quotes_style = "swiss";
// hebrew
else if (is_known(h_language, known_hebrew_quotes_languages))
h_quotes_style = "hebrew";
// english
else if (is_known(h_language, known_english_quotes_languages))
h_quotes_style = "english";

View File

@ -504,6 +504,8 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "hrd";
else if (preamble.quotesStyle() == "swedish")
res = opening ? "sld" : "srd";
else if (preamble.quotesStyle() == "hebrew")
res = "dld";
} else if (in == "els") {// `
if (preamble.quotesStyle() == "german")
res = "grs";
@ -516,6 +518,8 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "brd";
else if (preamble.quotesStyle() == "swedish")
res = opening ? "sls" : "srs";
else if (preamble.quotesStyle() == "hebrew")
res = "dls";
} else if (in == "ard") {// >>
if (preamble.quotesStyle() == "swiss")
res = "cld";
@ -547,9 +551,13 @@ string guessQuoteStyle(string const & in, bool const opening)
res = "hld";
else if (preamble.quotesStyle() == "russian")
res = "rls";
else if (preamble.quotesStyle() == "hebrew")
res = "drd";
} else if (in == "gls") {// ,
if (preamble.quotesStyle() == "polish")
res = "pls";
else if (preamble.quotesStyle() == "hebrew")
res = "drs";
}
return res;
}

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 617 // spitz: linguistics module enhancements
#define LYX_FORMAT_TEX2LYX 617
#define LYX_FORMAT_LYX 618 // Udi_Fogiel: hebrew quote style
#define LYX_FORMAT_TEX2LYX 618
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER