]> git.lyx.org Git - lyx.git/commitdiff
Adding hebrew quotation marks (bug #12849).
authorPavel Sanda <sanda@lyx.org>
Sun, 6 Aug 2023 14:50:07 +0000 (16:50 +0200)
committerPavel Sanda <sanda@lyx.org>
Sun, 6 Aug 2023 14:50:07 +0000 (16:50 +0200)
Patch from Udi Fogiel.

development/FORMAT
lib/doc/UserGuide.lyx
lib/languages
lib/lyx2lyx/lyx_2_4.py
src/BufferParams.cpp
src/LyXAction.cpp
src/insets/InsetQuotes.cpp
src/insets/InsetQuotes.h
src/tex2lyx/Preamble.cpp
src/tex2lyx/text.cpp
src/version.h

index 8adbb250a1c9eee981823e250d7c0f6174bd6b69..2687c18a799eda30fbd9b9060568dc37c3f974a2 100644 (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
index e112cddecb003f8948aa665507d99f2373c4488e..222394f3bcf63c050cdbe1bb8a4fedf6e57b5dcf 100644 (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
index 76652f965465f8f6331afb738c216049b9b98639..7f5d4655c0b58387e68e218751f49f98d4b6be3b 100644 (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}
index 6e4bdbb362ccb318b4ee07f49fecd6efdc25a9a4..ede6e4fae6091e05951909f0e1131ba2921faf18 100644 (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]],
index a6ccd4ed546ff25ce2a632ce5731bac52dce7543..ec4d2906099b9d79df3a29231e24a505b3de1a15 100644 (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;
 }
 
index 3391e228d2f949e9b7b538b0c091b697bd3c1081..19f12038a8a114d7e89d6bcb0faec8d213f94d74 100644 (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
index f5823605543455e820e7fec88a828ced16348efa..53709daba438074a0228087077ebf8d230162527 100644 (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;
 
index 41bad175b8157c342829b302e17e038bfdd4baa6..5e6cb3c4aac9d42c06d40ecf10d58e9527f0943e 100644 (file)
@@ -53,6 +53,8 @@ enum class QuoteStyle : int {
        ///
        Hungarian,
        ///
+       Hebrew,
+       ///
        Dynamic
 };
 
index c7e3f73f37db47f651545c9fd0b6485757b4f735..3226b0f0a5f5cfeeac64cd92e5f09bdc823de63f 100644 (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";
index ed80968f5d7fb4726d39b49b7ae972edc8cd57e7..4dd5f11f3863c22a97f299a5267b2ba05d4a1fef 100644 (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;
 }
index df53604d515686299ea1c895ec8bdd02ef39cef9..ab05f8950442940212067c6b1036cb80013b5a44 100644 (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