mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Some new quote styles
* b `british' (``inner quotation'') * w >>swedishg>> ('inner quotation') ["g" = Guillemets] * f <<french>> (``inner quotation'') * i <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale] * r <<russian>> (,,inner quotation``) Rename "french" to "swiss" Also rename "single/double" to "secondary/primary" ("inner/outer" in the UI) and "left/right" to "opening/closing". Note that the inset identifier string is left as is ("s/d" and "l/r")
This commit is contained in:
parent
45df1e87a9
commit
237193f8a8
@ -11,6 +11,18 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
|
||||
|
||||
-----------------------
|
||||
|
||||
2016-12-24 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 521:
|
||||
Introduce new quote styles:
|
||||
- british \begin_inset Quotes b..
|
||||
- swiss \begin_inset Quotes c..
|
||||
- swedishg \begin_inset Quotes w..
|
||||
- frenchin \begin_inset Quotes i..
|
||||
- russian \begin_inset Quotes r..
|
||||
Change default behavior of French quote style:
|
||||
- Inner quotes are now ``..''.
|
||||
- Former french style is now called "swiss"
|
||||
|
||||
2016-12-21 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 520: Introduce plain quote style:
|
||||
\begin_inset Quotes qls => \textquotesingle
|
||||
|
@ -12,7 +12,8 @@
|
||||
# PolyglossiaOpts "<language-specific options>"
|
||||
# Encoding <encoding>
|
||||
# FontEncoding <font encoding>
|
||||
# QuoteStyle <danish|english|french|german|polish|swedish>
|
||||
# QuoteStyle <british|danish|english|french|frenchin|
|
||||
# german|polish|russian|swedish|swedishg|swiss|plain>
|
||||
# InternalEncoding <true|false>
|
||||
# RTL <true|false>
|
||||
# AsBabelOptions <true|false>
|
||||
@ -43,13 +44,19 @@
|
||||
# (UK) -- try to select the entry that is most generic -- here
|
||||
# English.
|
||||
# * The QuoteStyle arguments correspond to the following styles:
|
||||
# - danish: >>text<< >text< (inward guillemets)
|
||||
# - english: ``text'' `text' (66_99)
|
||||
# - french: <<text>> <text> (outward guillemets)
|
||||
# - german: ,,text`` ,text` (99/66)
|
||||
# - polish: ,,text'' ,text' (99/99)
|
||||
# - swedish: ''text'' 'text' (99_99)
|
||||
# - plain: "text" 'text' (straight non-typographical quotes)
|
||||
# PRIMARY SECONDARY
|
||||
# - british: `text' ``text'' (6_9 -- 66_99)
|
||||
# - danish: >>text<< >text< (inward guillemets)
|
||||
# - english: ``text'' `text' (66_99 -- 6_9)
|
||||
# - french: <<text>> ``text'' (outward guillemets -- 66_99)
|
||||
# - frenchin: <<text>> <<text>> (French Imprimerie Nationale style)
|
||||
# - german: ,,text`` ,text` (99/66 -- 9/6)
|
||||
# - polish: ,,text'' ,text' (99/99 -- 9/9)
|
||||
# - russian: <<text>> ,,text`` (outward guillemets -- 99/66)
|
||||
# - swedish: ''text'' 'text' (99_99 -- 9_9)
|
||||
# - swedishg: >>text>> 'text' (Swedish Guillemets)
|
||||
# - swiss: <<text>> <text> (outward guillemets)
|
||||
# - plain: "text" 'text' (non-typographical quotes)
|
||||
# Note that the option names have been selected (rather arbitrarily)
|
||||
# because the respective styles are common in the respective countries.
|
||||
# Of course this does not imply any fixed relation to those countries.
|
||||
@ -118,7 +125,7 @@ Language albanian
|
||||
GuiName "Albanian"
|
||||
BabelName albanian
|
||||
PolyglossiaName albanian
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-2
|
||||
LangCode sq_AL
|
||||
End
|
||||
@ -187,7 +194,7 @@ End
|
||||
Language armenian
|
||||
GuiName "Armenian"
|
||||
PolyglossiaName armenian
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding utf8
|
||||
LangCode hy_AM
|
||||
End
|
||||
@ -259,7 +266,7 @@ Language basque
|
||||
HasGuiSupport true
|
||||
BabelName basque
|
||||
PolyglossiaName basque
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-15
|
||||
LangCode eu_ES
|
||||
PostBabelPreamble
|
||||
@ -310,7 +317,7 @@ Language british
|
||||
BabelName british
|
||||
PolyglossiaName english
|
||||
PolyglossiaOpts "variant=british"
|
||||
QuoteStyle english
|
||||
QuoteStyle british
|
||||
Encoding iso8859-15
|
||||
LangCode en_GB
|
||||
End
|
||||
@ -462,7 +469,7 @@ Language estonian
|
||||
GuiName "Estonian"
|
||||
BabelName estonian
|
||||
PolyglossiaName estonian
|
||||
QuoteStyle polish
|
||||
QuoteStyle german
|
||||
Encoding iso8859-15
|
||||
LangCode et_EE
|
||||
PostBabelPreamble
|
||||
@ -480,6 +487,7 @@ Language farsi
|
||||
FontEncoding "LFE,LAE"
|
||||
RTL true
|
||||
LangCode fa_IR
|
||||
QuoteStyle english
|
||||
PostBabelPreamble
|
||||
\DeclareTextSymbol{\guillemotright}{LFE}{62}
|
||||
\DeclareTextSymbol{\guillemotleft}{LFE}{60}
|
||||
@ -577,7 +585,7 @@ Language german-ch
|
||||
BabelName nswissgerman
|
||||
PolyglossiaName german
|
||||
PolyglossiaOpts "variant=swiss,spelling=new,babelshorthands=true"
|
||||
QuoteStyle danish
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-15
|
||||
LangCode de_CH
|
||||
End
|
||||
@ -590,7 +598,7 @@ Language german-ch-old
|
||||
BabelName swissgerman
|
||||
PolyglossiaName german
|
||||
PolyglossiaOpts "variant=swiss,spelling=old,babelshorthands=true"
|
||||
QuoteStyle danish
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-15
|
||||
LangCode de_CH
|
||||
End
|
||||
@ -652,6 +660,7 @@ End
|
||||
# BabelName hungarian
|
||||
# Encoding iso8859-2
|
||||
# LangCode hu_HU
|
||||
# QuoteStyle polish
|
||||
#End
|
||||
|
||||
Language icelandic
|
||||
@ -672,6 +681,7 @@ Language interlingua
|
||||
PolyglossiaName interlingua
|
||||
Encoding iso8859-15
|
||||
LangCode ia_IA
|
||||
QuoteStyle english
|
||||
End
|
||||
|
||||
Language irish
|
||||
@ -787,7 +797,7 @@ Language latvian
|
||||
GuiName "Latvian"
|
||||
BabelName latvian
|
||||
PolyglossiaName latvian
|
||||
QuoteStyle danish
|
||||
QuoteStyle german
|
||||
Encoding iso8859-4
|
||||
# FontEncoding L7x # (required for hyphenation but not set by babel)
|
||||
LangCode lv_LV
|
||||
@ -871,7 +881,7 @@ Language norsk
|
||||
HasGuiSupport true
|
||||
BabelName norsk
|
||||
PolyglossiaName norsk
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-15
|
||||
LangCode nb_NO
|
||||
End
|
||||
@ -881,7 +891,7 @@ Language nynorsk
|
||||
HasGuiSupport true
|
||||
BabelName nynorsk
|
||||
PolyglossiaName nynorsk
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding iso8859-15
|
||||
LangCode nn_NO
|
||||
End
|
||||
@ -905,6 +915,7 @@ End
|
||||
# PolyglossiaName russian
|
||||
# PolyglossiaOpts "spelling=old"
|
||||
# LangCode ru_petr1708
|
||||
# QuoteStyle russian
|
||||
# End
|
||||
|
||||
Language piedmontese
|
||||
@ -933,7 +944,7 @@ Language portuguese
|
||||
HasGuiSupport true
|
||||
BabelName portuges
|
||||
PolyglossiaName portuges
|
||||
QuoteStyle english
|
||||
QuoteStyle french
|
||||
Encoding iso8859-15
|
||||
LangCode pt_PT
|
||||
End
|
||||
@ -963,7 +974,7 @@ Language russian
|
||||
HasGuiSupport true
|
||||
BabelName russian
|
||||
PolyglossiaName russian
|
||||
QuoteStyle french
|
||||
QuoteStyle russian
|
||||
Encoding koi8-r
|
||||
FontEncoding T2A
|
||||
LangCode ru_RU
|
||||
@ -1002,7 +1013,7 @@ Language serbian
|
||||
BabelName serbianc
|
||||
PolyglossiaName serbian
|
||||
PolyglossiaOpts "script=Cyrillic"
|
||||
QuoteStyle german
|
||||
QuoteStyle polish
|
||||
Encoding utf8
|
||||
FontEncoding T2A
|
||||
LangCode sr_RS
|
||||
@ -1016,7 +1027,7 @@ Language serbian-latin
|
||||
BabelName serbian
|
||||
PolyglossiaName serbian
|
||||
PolyglossiaOpts "script=Latin"
|
||||
QuoteStyle german
|
||||
QuoteStyle polish
|
||||
Encoding iso8859-2
|
||||
LangCode sr_RS-Latin
|
||||
End
|
||||
@ -1127,7 +1138,7 @@ Language turkish
|
||||
HasGuiSupport true
|
||||
BabelName turkish
|
||||
PolyglossiaName turkish
|
||||
QuoteStyle french
|
||||
QuoteStyle english
|
||||
Encoding iso8859-9
|
||||
LangCode tr_TR
|
||||
PostBabelPreamble
|
||||
@ -1141,7 +1152,7 @@ Language turkmen
|
||||
GuiName "Turkmen"
|
||||
BabelName turkmen
|
||||
PolyglossiaName turkmen
|
||||
QuoteStyle french
|
||||
QuoteStyle swiss
|
||||
Encoding utf8
|
||||
LangCode tk_TM
|
||||
AsBabelOptions true
|
||||
@ -1152,7 +1163,7 @@ Language ukrainian
|
||||
HasGuiSupport true
|
||||
BabelName ukrainian
|
||||
PolyglossiaName ukrainian
|
||||
QuoteStyle french
|
||||
QuoteStyle russian
|
||||
Encoding koi8-u
|
||||
FontEncoding T2A
|
||||
LangCode uk_UA
|
||||
@ -1183,7 +1194,7 @@ Language vietnamese
|
||||
GuiName "Vietnamese"
|
||||
BabelName vietnam
|
||||
PolyglossiaName vietnamese
|
||||
QuoteStyle french
|
||||
QuoteStyle english
|
||||
Encoding utf8
|
||||
LangCode vi_VN
|
||||
AsBabelOptions true
|
||||
@ -1194,7 +1205,7 @@ Language welsh
|
||||
GuiName "Welsh"
|
||||
BabelName welsh
|
||||
PolyglossiaName welsh
|
||||
QuoteStyle english
|
||||
QuoteStyle british
|
||||
Encoding iso8859-15
|
||||
LangCode cy_GB
|
||||
End
|
||||
|
@ -667,7 +667,7 @@ def revert_quotestyle(document):
|
||||
|
||||
|
||||
def revert_plainquote(document):
|
||||
" Revert plain quote inset "
|
||||
" Revert plain quote insets "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style plain", 0)
|
||||
@ -693,6 +693,162 @@ def revert_plainquote(document):
|
||||
i = l
|
||||
|
||||
|
||||
def convert_frenchquotes(document):
|
||||
" Convert french quote insets to swiss "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style french", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style swiss"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes f', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
newval = val.replace("f", "c", 1)
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_swissquotes(document):
|
||||
" Revert swiss quote insets to french "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style swiss", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style french"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes c', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
newval = val.replace("c", "f", 1)
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_britishquotes(document):
|
||||
" Revert british quote insets to english "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style british", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style english"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes b', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
newval = val.replace("b", "e", 1)
|
||||
if val[2] == "d":
|
||||
# opening mark
|
||||
newval = newval.replace("d", "s")
|
||||
else:
|
||||
# inner marks
|
||||
newval = newval.replace("s", "d")
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_swedishgquotes(document):
|
||||
" Revert swedish quote insets "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style swedishg", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style danish"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes w', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
if val[2] == "d":
|
||||
# outer marks
|
||||
newval = val.replace("w", "a", 1).replace("r", "l")
|
||||
else:
|
||||
# inner marks
|
||||
newval = val.replace("w", "s", 1)
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_frenchquotes(document):
|
||||
" Revert french inner quote insets "
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes f', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
if val[2] == "s":
|
||||
# inner marks
|
||||
newval = val.replace("f", "e", 1).replace("s", "d")
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_frenchinquotes(document):
|
||||
" Revert inner frenchin quote insets "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style frenchin", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style french"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes i', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
newval = val.replace("i", "f", 1)
|
||||
if val[2] == "s":
|
||||
# inner marks
|
||||
newval = newval.replace("s", "d")
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
def revert_russianquotes(document):
|
||||
" Revert russian quote insets "
|
||||
|
||||
# First, revert style setting
|
||||
i = find_token(document.header, "\\quotes_style russian", 0)
|
||||
if i != -1:
|
||||
document.header[i] = "\\quotes_style french"
|
||||
|
||||
# now the insets
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, '\\begin_inset Quotes r', i)
|
||||
if i == -1:
|
||||
return
|
||||
val = get_value(document.body, "\\begin_inset Quotes", i)[7:]
|
||||
newval = val
|
||||
if val[2] == "s":
|
||||
# inner marks
|
||||
newval = val.replace("r", "g", 1).replace("s", "d")
|
||||
else:
|
||||
# outer marks
|
||||
newval = val.replace("r", "f", 1)
|
||||
document.body[i] = document.body[i].replace(val, newval)
|
||||
i += 1
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -710,10 +866,12 @@ convert = [
|
||||
[517, []],
|
||||
[518, [convert_iopart]],
|
||||
[519, [convert_quotestyle]],
|
||||
[520, []]
|
||||
[520, []],
|
||||
[521, [convert_frenchquotes]]
|
||||
]
|
||||
|
||||
revert = [
|
||||
[520, [revert_britishquotes, revert_swedishgquotes, revert_frenchquotes, revert_frenchinquotes, revert_russianquotes, revert_swissquotes]],
|
||||
[519, [revert_plainquote]],
|
||||
[518, [revert_quotestyle]],
|
||||
[517, [revert_iopart]],
|
||||
|
@ -400,8 +400,8 @@ Menuset
|
||||
Item "Symbols...|b" "dialog-show symbols"
|
||||
Item "Ellipsis|i" "specialchar-insert dots"
|
||||
Item "End of Sentence|E" "specialchar-insert end-of-sentence"
|
||||
Item "Plain Quotation Mark|Q" "quote-insert double auto plain"
|
||||
Item "Single Quotation Mark|S" "quote-insert single"
|
||||
Item "Plain Quotation Mark|Q" "quote-insert outer auto plain"
|
||||
Item "Inner Quotation Mark|n" "quote-insert inner"
|
||||
Item "Protected Hyphen|y" "specialchar-insert nobreakdash"
|
||||
Item "Breakable Slash|a" "specialchar-insert slash"
|
||||
Item "Visible Space|V" "space-insert visible"
|
||||
|
@ -72,7 +72,8 @@ static char const * const string_paragraph_separation[] = {
|
||||
|
||||
|
||||
static char const * const string_quotes_style[] = {
|
||||
"english", "swedish", "german", "polish", "french", "danish", "plain", ""
|
||||
"english", "swedish", "german", "polish", "swiss", "danish", "plain",
|
||||
"british", "swedishg", "french", "frenchin", "russian", ""
|
||||
};
|
||||
|
||||
|
||||
@ -138,9 +139,14 @@ QuotesStyleTranslator const init_quotesstyletranslator()
|
||||
translator.addPair(string_quotes_style[1], InsetQuotesParams::SwedishQuotes);
|
||||
translator.addPair(string_quotes_style[2], InsetQuotesParams::GermanQuotes);
|
||||
translator.addPair(string_quotes_style[3], InsetQuotesParams::PolishQuotes);
|
||||
translator.addPair(string_quotes_style[4], InsetQuotesParams::FrenchQuotes);
|
||||
translator.addPair(string_quotes_style[4], InsetQuotesParams::SwissQuotes);
|
||||
translator.addPair(string_quotes_style[5], InsetQuotesParams::DanishQuotes);
|
||||
translator.addPair(string_quotes_style[6], InsetQuotesParams::PlainQuotes);
|
||||
translator.addPair(string_quotes_style[7], InsetQuotesParams::BritishQuotes);
|
||||
translator.addPair(string_quotes_style[8], InsetQuotesParams::SwedishGQuotes);
|
||||
translator.addPair(string_quotes_style[9], InsetQuotesParams::FrenchQuotes);
|
||||
translator.addPair(string_quotes_style[10], InsetQuotesParams::FrenchINQuotes);
|
||||
translator.addPair(string_quotes_style[11], InsetQuotesParams::RussianQuotes);
|
||||
return translator;
|
||||
}
|
||||
|
||||
|
@ -404,17 +404,22 @@ void LyXAction::init()
|
||||
* \li Notion: Currently English, Swedish, German, Polish, French, Danish quotes
|
||||
are distinguished.
|
||||
* \li Syntax: quote-insert [<LEVEL>] [<SIDE>] [<STYLE>]
|
||||
* \li Params: <LEVEL>: 'single' for single (i.e., inner or secondary) quotes, otherwise
|
||||
* double quotes will be used.
|
||||
* <SIDE>: 'left' for opening quotes, 'right' for closing quotes, otherwise
|
||||
* the side will be guessed from the context.
|
||||
* <STYLE>: 'english' for ``English'' quote style
|
||||
* 'swedish' for ''Swedish'' quote style
|
||||
* 'german' for ,,German`` quote style
|
||||
* 'polish' for ,,Polish'' quote style
|
||||
* 'french' for <<French>> quote style
|
||||
* 'danish' for >>Danish<< quote style
|
||||
* 'plain' for "Plain" quote style
|
||||
* \li Params: <LEVEL>: 'inner' for (i.e., secondary, usually single) quotes, otherwise
|
||||
* outer (i.e., primary, usually double) quotes will be used.
|
||||
* <SIDE>: 'opening' for opening quotes, 'closing' for closing quotes,
|
||||
* otherwise the side will be guessed from the context.
|
||||
* <STYLE>: 'british' for `British' quote style (with ``inner quotation'')
|
||||
* 'danish' for >>Danish<< quote style (with >inner quotation<)
|
||||
* 'english' for ``English'' quote style (with `inner quotation')
|
||||
* 'french' for <<french>> quote style (with ``inner quotation'')
|
||||
* 'frenchin' for <<frenchin>> quote style (with <<inner quotation>>) ["in" = Imprimerie Nationale]
|
||||
* 'german' for ,,German`` quote style (with ,inner quotation`)
|
||||
* 'plain' for "Plain" quote style (with 'inner quotation')
|
||||
* 'polish' for ,,Polish'' quote style (with ,inner quotation')
|
||||
* 'swedish' for ''Swedish'' quote style (with 'inner quotation')
|
||||
* 'swedishg' for >>swedishg>> quote style (with 'inner quotation') ["g" = Guillemets]
|
||||
* 'swiss' for <<Swiss>> quote style (with <inner quotation>)
|
||||
* 'russian' for <<Russian>> quote style (with ,,inner quotation``)
|
||||
* If no quote style is specified, the document-wide will be used.
|
||||
* \endvar
|
||||
*/
|
||||
@ -2483,7 +2488,7 @@ void LyXAction::init()
|
||||
inset-modify note Note Comment \n
|
||||
Change a Box into an Ovalbox: \n
|
||||
inset-modify changetype Ovalbox \n
|
||||
Change a quotation mark to e[nglish style], l[eft side], s[ingle] \n
|
||||
Change a quotation mark to e[nglish style], l[eft side = opening], s[ingle = inner, secondary] \n
|
||||
inset-modify changetype els \n
|
||||
Change only the style of a quotation mark, maintaining the other aspects (. = wildcard) \n
|
||||
inset-modify changetype e.. \n
|
||||
|
@ -1551,8 +1551,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
char_type c = ' ';
|
||||
if (pos > 0 && (!cur.prevInset() || !cur.prevInset()->isSpace()))
|
||||
c = par.getChar(pos - 1);
|
||||
InsetQuotesParams::QuoteLevel const quote_level = (cmd.getArg(0) == "single")
|
||||
? InsetQuotesParams::SingleQuotes : InsetQuotesParams::DoubleQuotes;
|
||||
InsetQuotesParams::QuoteLevel const quote_level =
|
||||
(cmd.getArg(0) == "single" || cmd.getArg(0) == "inner")
|
||||
? InsetQuotesParams::SecondaryQuotes : InsetQuotesParams::PrimaryQuotes;
|
||||
cur.insert(new InsetQuotes(cur.buffer(), c, quote_level, cmd.getArg(1), cmd.getArg(2)));
|
||||
cur.buffer()->updateBuffer();
|
||||
cur.posForward();
|
||||
|
@ -1679,9 +1679,14 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
|
||||
MenuDefinition sqs;
|
||||
MenuDefinition gqs;
|
||||
MenuDefinition pqs;
|
||||
MenuDefinition fqs;
|
||||
MenuDefinition cqs;
|
||||
MenuDefinition aqs;
|
||||
MenuDefinition qqs;
|
||||
MenuDefinition bqs;
|
||||
MenuDefinition wqs;
|
||||
MenuDefinition fqs;
|
||||
MenuDefinition iqs;
|
||||
MenuDefinition rqs;
|
||||
for (; qq != end; ++qq) {
|
||||
docstring const style = from_ascii(qq->first);
|
||||
FuncRequest const cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype ") + style);
|
||||
@ -1697,12 +1702,22 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
|
||||
gqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'p') && !prefixIs(qtype, "p"))
|
||||
pqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'f') && !prefixIs(qtype, "f"))
|
||||
fqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'c') && !prefixIs(qtype, "c"))
|
||||
cqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'a') && !prefixIs(qtype, "a"))
|
||||
aqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'q') && !prefixIs(qtype, "q"))
|
||||
qqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'b') && !prefixIs(qtype, "b"))
|
||||
bqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'w') && !prefixIs(qtype, "w"))
|
||||
wqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'f') && !prefixIs(qtype, "f"))
|
||||
fqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'i') && !prefixIs(qtype, "i"))
|
||||
iqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
else if (prefixIs(style, 'r') && !prefixIs(qtype, "r"))
|
||||
rqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
|
||||
}
|
||||
|
||||
if (!eqs.empty()) {
|
||||
@ -1729,10 +1744,10 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
|
||||
item.setSubmenu(pqs);
|
||||
add(item);
|
||||
}
|
||||
if (!fqs.empty()) {
|
||||
if (!cqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::FrenchQuotes)));
|
||||
item.setSubmenu(fqs);
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::SwissQuotes)));
|
||||
item.setSubmenu(cqs);
|
||||
add(item);
|
||||
}
|
||||
if (!aqs.empty()) {
|
||||
@ -1747,6 +1762,36 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
|
||||
item.setSubmenu(qqs);
|
||||
add(item);
|
||||
}
|
||||
if (!bqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::BritishQuotes)));
|
||||
item.setSubmenu(bqs);
|
||||
add(item);
|
||||
}
|
||||
if (!wqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::SwedishGQuotes)));
|
||||
item.setSubmenu(wqs);
|
||||
add(item);
|
||||
}
|
||||
if (!fqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::FrenchQuotes)));
|
||||
item.setSubmenu(fqs);
|
||||
add(item);
|
||||
}
|
||||
if (!iqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::FrenchINQuotes)));
|
||||
item.setSubmenu(iqs);
|
||||
add(item);
|
||||
}
|
||||
if (!rqs.empty()) {
|
||||
MenuItem item(MenuItem::Submenu,
|
||||
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::RussianQuotes)));
|
||||
item.setSubmenu(rqs);
|
||||
add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,12 +56,17 @@ namespace {
|
||||
* s ''swedish'' ('inner quotation')
|
||||
* g ,,german`` (,inner quotation`)
|
||||
* p ,,polish'' (,inner quotation')
|
||||
* f <<french>> (<inner quotation>)
|
||||
* c <<swiss>> (<inner quotation>)
|
||||
* a >>danish<< (>inner quotation<)
|
||||
* q "plain" ('inner quotation')
|
||||
* b `british' (``inner quotation'')
|
||||
* w >>swedishg>> ('inner quotation') ["g" = Guillemets]
|
||||
* f <<french>> (``inner quotation'')
|
||||
* i <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
|
||||
* r <<russian>> (,,inner quotation``)
|
||||
*/
|
||||
|
||||
char const * const style_char = "esgpfaq";
|
||||
char const * const style_char = "esgpcaqbwfir";
|
||||
char const * const side_char = "lr" ;
|
||||
char const * const level_char = "sd";
|
||||
|
||||
@ -124,7 +129,7 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
|
||||
right_secondary = 0x2019; // '
|
||||
break;
|
||||
}
|
||||
case FrenchQuotes: {
|
||||
case SwissQuotes: {
|
||||
left_primary = 0x00ab; // <<
|
||||
right_primary = 0x00bb; // >>
|
||||
left_secondary = 0x2039; // <
|
||||
@ -145,6 +150,41 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
|
||||
right_secondary = 0x0027; // '
|
||||
break;
|
||||
}
|
||||
case BritishQuotes: {
|
||||
left_primary = 0x2018; // `
|
||||
right_primary = 0x2019; // '
|
||||
left_secondary = 0x201c; // ``
|
||||
right_secondary = 0x201d; // ''
|
||||
break;
|
||||
}
|
||||
case SwedishGQuotes: {
|
||||
left_primary = 0x00bb; // >>
|
||||
right_primary = 0x00bb; // >>
|
||||
left_secondary = 0x2019; // '
|
||||
right_secondary = 0x2019; // '
|
||||
break;
|
||||
}
|
||||
case FrenchQuotes: {
|
||||
left_primary = 0x00ab; // <<
|
||||
right_primary = 0x00bb; // >>
|
||||
left_secondary = 0x201c; // ``
|
||||
right_secondary = 0x201d; // ''
|
||||
break;
|
||||
}
|
||||
case FrenchINQuotes:{
|
||||
left_primary = 0x00ab; // <<
|
||||
right_primary = 0x00bb; // >>
|
||||
left_secondary = 0x00ab; // <<
|
||||
right_secondary = 0x00bb; // >>
|
||||
break;
|
||||
}
|
||||
case RussianQuotes:{
|
||||
left_primary = 0x00ab; // <<
|
||||
right_primary = 0x00bb; // >>
|
||||
left_secondary = 0x201e; // ,,
|
||||
right_secondary = 0x201c; // ``
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// should not happen
|
||||
left_primary = 0x003f; // ?
|
||||
@ -155,10 +195,10 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
|
||||
}
|
||||
|
||||
switch (level) {
|
||||
case SingleQuotes:
|
||||
return (side == LeftQuote) ? left_secondary : right_secondary;
|
||||
case DoubleQuotes:
|
||||
return (side == LeftQuote) ? left_primary : right_primary;
|
||||
case SecondaryQuotes:
|
||||
return (side == OpeningQuote) ? left_secondary : right_secondary;
|
||||
case PrimaryQuotes:
|
||||
return (side == OpeningQuote) ? left_primary : right_primary;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -346,10 +386,10 @@ map<string, docstring> InsetQuotesParams::getTypes() const
|
||||
docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs)
|
||||
{
|
||||
return bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, DoubleQuotes, LeftQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, DoubleQuotes, RightQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, SingleQuotes, LeftQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, SingleQuotes, RightQuote))
|
||||
docstring(1, quoteparams.getQuoteChar(qs, PrimaryQuotes, OpeningQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, PrimaryQuotes, ClosingQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, SecondaryQuotes, OpeningQuote)),
|
||||
docstring(1, quoteparams.getQuoteChar(qs, SecondaryQuotes, ClosingQuote))
|
||||
);
|
||||
}
|
||||
|
||||
@ -379,10 +419,10 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve
|
||||
fontenc_ = lyxrc.fontenc;
|
||||
}
|
||||
|
||||
if (side == "left")
|
||||
side_ = InsetQuotesParams::LeftQuote;
|
||||
else if (side == "right")
|
||||
side_ = InsetQuotesParams::RightQuote;
|
||||
if (side == "left" || side == "opening")
|
||||
side_ = InsetQuotesParams::OpeningQuote;
|
||||
else if (side == "right" || side == "closing")
|
||||
side_ = InsetQuotesParams::ClosingQuote;
|
||||
else
|
||||
setSide(c);
|
||||
}
|
||||
@ -396,15 +436,15 @@ docstring InsetQuotes::layoutName() const
|
||||
|
||||
void InsetQuotes::setSide(char_type c)
|
||||
{
|
||||
// Decide whether left or right
|
||||
// Decide whether opening or closing quote
|
||||
switch (c) {
|
||||
case ' ':
|
||||
case '(':
|
||||
case '[':
|
||||
side_ = InsetQuotesParams::LeftQuote; // left quote
|
||||
side_ = InsetQuotesParams::OpeningQuote;// opening quote
|
||||
break;
|
||||
default:
|
||||
side_ = InsetQuotesParams::RightQuote; // right quote
|
||||
side_ = InsetQuotesParams::ClosingQuote;// closing quote
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,7 +486,7 @@ void InsetQuotes::parseString(string const & s, bool const allow_wildcards)
|
||||
if (i >= 2) {
|
||||
LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad side specification.");
|
||||
side_ = InsetQuotesParams::LeftQuote;
|
||||
side_ = InsetQuotesParams::OpeningQuote;
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,7 +501,7 @@ void InsetQuotes::parseString(string const & s, bool const allow_wildcards)
|
||||
if (i >= 2) {
|
||||
LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
|
||||
" bad level specification.");
|
||||
level_ = InsetQuotesParams::DoubleQuotes;
|
||||
level_ = InsetQuotesParams::PrimaryQuotes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -479,12 +519,20 @@ InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s)
|
||||
qs = InsetQuotesParams::GermanQuotes;
|
||||
else if (s == "polish")
|
||||
qs = InsetQuotesParams::PolishQuotes;
|
||||
else if (s == "french")
|
||||
qs = InsetQuotesParams::FrenchQuotes;
|
||||
else if (s == "swiss")
|
||||
qs = InsetQuotesParams::SwissQuotes;
|
||||
else if (s == "danish")
|
||||
qs = InsetQuotesParams::DanishQuotes;
|
||||
else if (s == "plain")
|
||||
qs = InsetQuotesParams::PlainQuotes;
|
||||
else if (s == "british")
|
||||
qs = InsetQuotesParams::BritishQuotes;
|
||||
else if (s == "swedishg")
|
||||
qs = InsetQuotesParams::SwedishGQuotes;
|
||||
else if (s == "french")
|
||||
qs = InsetQuotesParams::FrenchQuotes;
|
||||
else if (s == "frenchin")
|
||||
qs = InsetQuotesParams::FrenchINQuotes;
|
||||
|
||||
return qs;
|
||||
}
|
||||
@ -494,18 +542,20 @@ docstring InsetQuotes::displayString() const
|
||||
{
|
||||
// In PassThru, we use straight quotes
|
||||
if (pass_thru_)
|
||||
return (level_ == InsetQuotesParams::DoubleQuotes) ?
|
||||
return (level_ == InsetQuotesParams::PrimaryQuotes) ?
|
||||
from_ascii("\"") : from_ascii("'");
|
||||
|
||||
docstring retdisp = docstring(1, quoteparams.getQuoteChar(style_, level_, side_));
|
||||
|
||||
// in French, thin spaces are added inside double guillemets
|
||||
if (prefixIs(context_lang_, "fr")
|
||||
&& level_ == InsetQuotesParams::DoubleQuotes
|
||||
&& style_ == InsetQuotesParams::FrenchQuotes) {
|
||||
&& level_ == InsetQuotesParams::PrimaryQuotes
|
||||
&& (style_ == InsetQuotesParams::SwissQuotes
|
||||
|| style_ == InsetQuotesParams::FrenchQuotes
|
||||
|| style_ == InsetQuotesParams::FrenchINQuotes)) {
|
||||
// THIN SPACE (U+2009)
|
||||
char_type const thin_space = 0x2009;
|
||||
if (side_ == InsetQuotesParams::LeftQuote)
|
||||
if (side_ == InsetQuotesParams::OpeningQuote)
|
||||
retdisp += thin_space;
|
||||
else
|
||||
retdisp = thin_space + retdisp;
|
||||
@ -611,11 +661,11 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
|
||||
|
||||
// In pass-thru context, we output plain quotes
|
||||
if (runparams.pass_thru)
|
||||
qstr = (level_ == InsetQuotesParams::DoubleQuotes) ? from_ascii("\"") : from_ascii("'");
|
||||
qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'");
|
||||
else if (style_ == InsetQuotesParams::PlainQuotes && runparams.isFullUnicode()) {
|
||||
// For XeTeX and LuaTeX,we need to disable mapping to get straight
|
||||
// quotes. We define our own commands that do this
|
||||
qstr = (level_ == InsetQuotesParams::DoubleQuotes) ?
|
||||
qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ?
|
||||
from_ascii("\\textquotedblplain") : from_ascii("\\textquotesingleplain");
|
||||
}
|
||||
else if (runparams.use_polyglossia) {
|
||||
@ -624,11 +674,11 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
|
||||
qstr = docstring(1, quotechar);
|
||||
}
|
||||
else if (style_ == InsetQuotesParams::FrenchQuotes
|
||||
&& level_ == InsetQuotesParams::DoubleQuotes
|
||||
&& level_ == InsetQuotesParams::PrimaryQuotes
|
||||
&& prefixIs(runparams.local_font->language()->code(), "fr")) {
|
||||
// Specific guillemets of French babel
|
||||
// including correct French spacing
|
||||
if (side_ == InsetQuotesParams::LeftQuote)
|
||||
if (side_ == InsetQuotesParams::OpeningQuote)
|
||||
qstr = from_ascii("\\og");
|
||||
else
|
||||
qstr = from_ascii("\\fg");
|
||||
@ -690,11 +740,11 @@ docstring InsetQuotes::getQuoteEntity() const {
|
||||
docstring res = quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style_, level_, side_));
|
||||
// in French, thin spaces are added inside double guillemets
|
||||
if (prefixIs(context_lang_, "fr")
|
||||
&& level_ == InsetQuotesParams::DoubleQuotes
|
||||
&& level_ == InsetQuotesParams::PrimaryQuotes
|
||||
&& style_ == InsetQuotesParams::FrenchQuotes) {
|
||||
// THIN SPACE (U+2009)
|
||||
docstring const thin_space = from_ascii(" ");
|
||||
if (side_ == InsetQuotesParams::LeftQuote)
|
||||
if (side_ == InsetQuotesParams::OpeningQuote)
|
||||
res += thin_space;
|
||||
else
|
||||
res = thin_space + res;
|
||||
|
@ -36,25 +36,35 @@ public:
|
||||
///
|
||||
PolishQuotes,
|
||||
///
|
||||
FrenchQuotes,
|
||||
SwissQuotes,
|
||||
///
|
||||
DanishQuotes,
|
||||
///
|
||||
PlainQuotes
|
||||
PlainQuotes,
|
||||
///
|
||||
BritishQuotes,
|
||||
///
|
||||
SwedishGQuotes,
|
||||
///
|
||||
FrenchQuotes,
|
||||
///
|
||||
FrenchINQuotes,
|
||||
///
|
||||
RussianQuotes
|
||||
};
|
||||
///
|
||||
enum QuoteSide {
|
||||
///
|
||||
LeftQuote,
|
||||
OpeningQuote,
|
||||
///
|
||||
RightQuote
|
||||
ClosingQuote
|
||||
};
|
||||
///
|
||||
enum QuoteLevel {
|
||||
///
|
||||
SingleQuotes,
|
||||
SecondaryQuotes,
|
||||
///
|
||||
DoubleQuotes
|
||||
PrimaryQuotes
|
||||
};
|
||||
/// Returns the unicode character of a given quote
|
||||
char_type getQuoteChar(QuoteStyle const &, QuoteLevel const &,
|
||||
|
@ -86,6 +86,17 @@ Format LaTeX feature LyX feature
|
||||
520 Plain InsetQuote Style:
|
||||
\textquotesingle \begin_inset Quotes qls, \begin_inset Quotes qrs
|
||||
\textquotedbl \begin_inset Quotes qld, \begin_inset Quotes qrd
|
||||
521 New Quote Styles InsetQuote
|
||||
- british \begin_inset Quotes b..
|
||||
- swiss \begin_inset Quotes c..
|
||||
- swedishg \begin_inset Quotes w..
|
||||
- frenchin \begin_inset Quotes i..
|
||||
- russian \begin_inset Quotes r..
|
||||
Change default behavior \begin_inset Quotes f..
|
||||
of French quote style:
|
||||
- Inner quotes are now ``..''.
|
||||
- Former french style is now
|
||||
called "swiss"
|
||||
|
||||
General
|
||||
|
||||
|
@ -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 520 // spitz: plain quotes style
|
||||
#define LYX_FORMAT_TEX2LYX 520
|
||||
#define LYX_FORMAT_LYX 521 // spitz: new quotes styles
|
||||
#define LYX_FORMAT_TEX2LYX 521
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user