Add date-related info insets

With this commit, info insets leave the dark backstage room of an opaque
and quite hidden dev-only feature and come frontstage.

In the UI, they present themselves as "Fields" since this is what people
know from word processors. Other user-related fields that could be
implemented next: time, user name (I plan to do that for 2.4).

Since this supersedes date-insert, I removed Insert > Date from
the menu and propose to ditch date-insert and the corresponding rc.

The lyx2lyx reversion routine has lots of room for improvement and
attractive tasks for pythons (file timestamp, switch of localization).
Please feel invited!

This is a file format change.
This commit is contained in:
Juergen Spitzmueller 2018-08-05 09:51:12 +02:00
parent 1111c5c13b
commit e730234e57
16 changed files with 819 additions and 84 deletions

View File

@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be
-----------------------
2018-08-04 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 559: Date-related info insets: date, moddate, fixdate.
2018-07-30 Kornel Benko <kornel@lyx.org>
* format incremented to 558: Remove Begin/EndFrontmatter styles from elsarticle layout.

View File

@ -12,8 +12,9 @@
# PolyglossiaOpts "<language-specific options>"
# QuoteStyle <british|danish|english|french|frenchin|
# german|polish|russian|swedish|swedishg|swiss|plain>
# DateFormats "<long>|<medium>|<short>"
# Encoding <encoding>
# FontEncoding <font encoding|font encoding|...]>
# FontEncoding <font encoding|font encoding|...>
# InternalEncoding <true|false>
# RTL <true|false>
# AsBabelOptions <true|false>
@ -63,6 +64,21 @@
# 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.
# * DateFormats lists the localized conventions for three date forms:
# - Long: December 1, 2018
# - Medium: Dec 1, 2018
# - Short: 1/12/2018
# These are separated by | and use the QDate syntax:
# * d the day as number without a leading zero (1 to 31)
# * dd the day as number with a leading zero (01 to 31)
# * ddd the abbreviated localized day name (e.g. 'Mon' to 'Sun')
# * dddd the long localized day name (e.g. 'Monday' to 'Sunday')
# * M the month as number without a leading zero (1 to 12)
# * MM the month as number with a leading zero (01 to 12)
# * MMM the abbreviated localized month name (e.g. 'Jan' to 'Dec')
# * MMMM the long localized month name (e.g. 'January' to 'December')
# * yy the year as two digit number (00 to 99)
# * yyyy the year as four digit number
# * Encoding is the default encoding used with TeX fonts.
# It is only used if Document > Settings > Language > Encoding
# is set to "Language Default" and "use non-TeX fonts" is FALSE.
@ -137,6 +153,7 @@ Language afrikaans
QuoteStyle polish
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd MMMM yyyy|dd MMM yyyy|yyyy/MM/dd"
LangCode af_ZA
End
@ -148,6 +165,7 @@ Language albanian
QuoteStyle swiss
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
LangCode sq_AL
End
@ -159,6 +177,7 @@ Language american
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
DateFormats "MMMM dd, yyyy|MMM dd, yyyy|M/d/yyyy"
LangCode en_US
End
@ -167,6 +186,7 @@ Language amharic
GuiName "Amharic"
PolyglossiaName amharic
Encoding utf8
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
LangCode am_ET
End
@ -184,6 +204,7 @@ Language ancientgreek
Encoding iso8859-7
InternalEncoding true
FontEncoding LGR
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
LangCode grc_GR
Provides textgreek
End
@ -196,6 +217,7 @@ Language arabic_arabtex
BabelName arabtex
QuoteStyle french
Encoding cp1256
DateFormats "d MMMM، yyyy|dd/MM/yyyy|d/M/yyyy"
RTL true
LangCode ar_SA
End
@ -208,6 +230,7 @@ Language arabic_arabi
QuoteStyle french
Encoding cp1256
FontEncoding LAE
DateFormats "d MMMM، yyyy|dd/MM/yyyy|d/M/yyyy"
RTL true
AsBabelOptions true
LangCode ar_SA
@ -219,6 +242,7 @@ Language armenian
PolyglossiaName armenian
QuoteStyle swiss
Encoding utf8
DateFormats "d MMMM، yyyy|d MMM، yyyy|d/M/yyyy"
LangCode hy_AM
End
@ -228,6 +252,7 @@ Language asturian
PolyglossiaName asturian
QuoteStyle french
Encoding iso8859-15
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode ast_ES
End
@ -239,6 +264,7 @@ Language australian
PolyglossiaOpts "variant=australian"
Encoding iso8859-15
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
QuoteStyle english
LangCode en_AU
End
@ -254,6 +280,7 @@ Language austrian
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de
LangVariety alt
End
@ -268,6 +295,7 @@ Language naustrian
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_AT
End
@ -279,6 +307,7 @@ Language bahasa
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode id_ID
End
@ -288,6 +317,7 @@ Language bahasam
PolyglossiaName bahasam
QuoteStyle english
Encoding iso8859-15
DateFormats "dd MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode ms_MY
End
@ -299,6 +329,7 @@ Language basque
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "yyyy MMMM dd|yyyy MMM dd|yyyy/MM/dd"
LangCode eu_ES
PostBabelPreamble
\addto\extrasbasque{\bbl@deactivate{~}}
@ -312,6 +343,7 @@ Language belarusian
QuoteStyle french
Encoding cp1251
FontEncoding T2A
DateFormats "dd MMMM yyyy|d MMM yyyy|d.M.yyyy"
LangCode be_BY
AsBabelOptions true
End
@ -323,6 +355,7 @@ Language bosnian
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|yyyy-MM-dd"
LangCode bs_BA
End
@ -334,6 +367,7 @@ Language brazilian
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d 'de' MMM 'de' yyyy|dd/MM/yyyy"
LangCode pt_BR
End
@ -345,6 +379,7 @@ Language breton
QuoteStyle french
Encoding iso8859-15
#FontEncoding T1
DateFormats "dd MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode br_FR
End
@ -356,6 +391,7 @@ Language british
QuoteStyle british
Encoding iso8859-15
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode en_GB
End
@ -366,6 +402,7 @@ Language bulgarian
QuoteStyle german
Encoding cp1251
FontEncoding T2A
DateFormats "dd MMMM yyyy|d MMM yyyy|yyyy-M-d"
LangCode bg_BG
Provides textcyrillic
End
@ -379,6 +416,7 @@ Language canadian
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
DateFormats "MMMM d, yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode en_CA
End
@ -393,6 +431,7 @@ Language canadien
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode fr_CA
End
@ -405,6 +444,7 @@ Language catalan
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d / MMMM / yyyy|d / MMM / yyyy|dd/MM/yyyy"
LangCode ca_ES
End
@ -415,6 +455,7 @@ Language chinese-simplified
Encoding euc-cn
QuoteStyle english
LangCode zh_CN
DateFormats "yyyy年M月d日|yyyy-M-d|yy-M-d"
Requires CJK
End
@ -425,10 +466,12 @@ Language chinese-traditional
QuoteStyle cjk
Encoding utf8-cjk
LangCode zh_TW
DateFormats "yyyy年M月d日|yyyy年M月d日|yy年M月d日"
Requires CJK
End
# not supported by babel
# FIXME DateFormats
Language coptic
GuiName "Coptic"
PolyglossiaName coptic
@ -443,6 +486,7 @@ Language croatian
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy.|d. MMM. yyyy.|dd.MM.yyyy."
LangCode hr_HR
End
@ -454,6 +498,7 @@ Language czech
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM. yyyy|d.M.yyyy"
LangCode cs_CZ
End
@ -465,6 +510,7 @@ Language danish
QuoteStyle danish
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd/MM/yyyy"
LangCode da_DK
End
@ -473,6 +519,7 @@ Language divehi
GuiName "Divehi (Maldivian)"
PolyglossiaName divehi
Encoding utf8
DateFormats "yyyy MMMM dd|yyyy MMM dd|dd/MM/yyyy"
LangCode dv_MV
End
@ -485,6 +532,7 @@ Language dutch
QuoteStyle polish
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|d-M-yyyy"
LangCode nl_NL
End
@ -495,13 +543,14 @@ Language english
PolyglossiaName english
PolyglossiaOpts "variant=american"
QuoteStyle english
DateFormats "MMMM dd, yyyy|MMM dd, yyyy|M/d/yyyy"
Encoding iso8859-15
FontEncoding ASCII
LangCode en_US
End
# Esperanto has no country code because it is an auxiliary language.
# We therefore the name of its hunspell dictionary.
# We therefore use the name of its hunspell dictionary.
Language esperanto
GuiName "Esperanto"
BabelName esperanto
@ -509,6 +558,7 @@ Language esperanto
QuoteStyle english
Encoding iso8859-3
FontEncoding IL3|T1|OT1
DateFormats "'la' d 'de' MMMM yyyy|'la' d 'de' MMM yyyy|MM/dd/yyyy"
LangCode eo_EO
End
@ -519,6 +569,7 @@ Language estonian
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
LangCode et_EE
PostBabelPreamble
\addto\extrasestonian{\bbl@deactivate{~}}
@ -533,6 +584,7 @@ Language farsi
PolyglossiaName farsi
Encoding utf8
FontEncoding LAE,LFE
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy/M/d"
RTL true
LangCode fa_IR
QuoteStyle english
@ -550,6 +602,7 @@ Language finnish
QuoteStyle swedish
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|d.M.yyyy"
LangCode fi_FI
End
@ -562,6 +615,7 @@ Language french
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode fr_FR
PostBabelPreamble
\addto\extrasfrench{%
@ -579,6 +633,7 @@ Language friulan
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'di' MMMM 'dal' yyyy|d 'di' MMM 'dal' yyyy|dd/MM/yyyy"
LangCode fur_IT
End
@ -590,12 +645,14 @@ Language galician
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d 'de' MMM 'de' yyyy|dd/MM/yyyy"
LangCode gl_ES
PostBabelPreamble
\addto\shorthandsgalician{\galiciandeactivate{~}}
EndPostBabelPreamble
End
# FIXME DateFormats
Language georgian
GuiName "Georgian"
BabelName georgian
@ -614,6 +671,7 @@ Language german
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de
LangVariety alt
End
@ -627,6 +685,7 @@ Language ngerman
QuoteStyle german
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_DE
End
@ -642,6 +701,7 @@ Language german-ch
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_CH
End
@ -656,6 +716,7 @@ Language german-ch-old
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|dd. MMM yyyy|dd.MM.yyyy"
LangCode de_CH
End
@ -669,6 +730,7 @@ Language greek
Encoding iso8859-7
InternalEncoding true
FontEncoding LGR
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
LangCode el_GR
Provides textgreek
End
@ -682,6 +744,7 @@ Language polutonikogreek
Encoding iso8859-7
InternalEncoding true
FontEncoding LGR
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
LangCode el_GR
Provides textgreek
End
@ -697,6 +760,7 @@ Language hebrew
# Hebrew babel loads the font encodings
# itself in the appropriate order
# FontEncoding LHE
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
RTL true
LangCode he_IL
End
@ -706,6 +770,7 @@ Language hindi
GuiName "Hindi"
PolyglossiaName hindi
Encoding utf8
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd-MM-yyyy"
LangCode hi_IN
End
@ -729,6 +794,7 @@ Language icelandic
QuoteStyle german
Encoding iso8859-15
FontEncoding T1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode is_IS
End
@ -742,6 +808,7 @@ Language interlingua
Encoding iso8859-15
FontEncoding ASCII
LangCode ia_IA
DateFormats "'le' d 'de' MMMM yyyy|'le' d 'de' MMM yyyy|yyyy-mm-dd"
QuoteStyle english
End
@ -752,6 +819,7 @@ Language irish
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd/MM/yyyy"
LangCode ga_IE
End
@ -763,6 +831,7 @@ Language italian
QuoteStyle french
Encoding iso8859-15
FontEncoding ASCII
DateFormats "dd MMMM yyyy|dd/MMM/yyyy|dd/MM/yyyy"
LangCode it_IT
End
@ -781,6 +850,7 @@ Language japanese
Requires japanese
InternalEncoding true
FontEncoding None
DateFormats "yyyy年M月d日|yyyy/MM/dd|yy/MM/dd"
QuoteStyle cjk
End
@ -788,6 +858,7 @@ End
Language japanese-cjk
GuiName "Japanese (CJK)"
Encoding euc-jp
DateFormats "yyyy年M月d日|yyyy/MM/dd|yy/MM/dd"
LangCode ja_JP
Requires CJK
QuoteStyle cjk
@ -798,6 +869,7 @@ Language kannada
GuiName "Kannada"
PolyglossiaName kannada
Encoding utf8
DateFormats "dd MMMM yyyy|dd MMMM yyyy|dd-MM-yyyy"
LangCode kn_IN
End
@ -807,6 +879,7 @@ Language kazakh
GuiName "Kazakh"
Encoding ascii
FontEncoding T2A
DateFormats "dd MMMM yyyy|dd MMMM yyyy|yyyy-dd-MM"
LangCode kk_KZ
PostBabelPreamble
\input{t2aenc.def}
@ -819,6 +892,7 @@ Language khmer
GuiName "Khmer"
PolyglossiaName khmer
Encoding utf8
DateFormats "d MMMM yyyy|d MMMM yyyy|dd/MM/yyyy"
LangCode km_KH
End
@ -826,6 +900,7 @@ Language korean
GuiName "Korean"
Encoding euc-kr
QuoteStyle cjkangle
DateFormats "yyyy년 M월 d일|yyyy. M. d.|yy. M. d."
LangCode ko_KR
Requires CJK
End
@ -836,6 +911,7 @@ Language kurmanji
BabelName kurmanji
Encoding utf8
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. M. yyyy|yyyy-MM-dd"
LangCode kmr
AsBabelOptions true
End
@ -845,11 +921,13 @@ Language lao
GuiName "Lao"
PolyglossiaName lao
Encoding utf8
DateFormats "dd MMMM yyyy|dd MMMM yyyy|dd/MM/yyyy"
LangCode lo_LA
End
# There is no country code for Latin because it is a dead language.
# We therefore the name of its hunspell dictionary.
# FIXME DateFormats
Language latin
GuiName "Latin"
BabelName latin
@ -869,6 +947,7 @@ Language latvian
QuoteStyle german
Encoding iso8859-4
FontEncoding L7x|T1|OT1
DateFormats "yyyy. 'gada' d. MMMM|yyyy. 'gada' d. MMM|dd.MM.yyyy"
LangCode lv_LV
AsBabelOptions true
End
@ -883,6 +962,7 @@ Language lithuanian
QuoteStyle german
Encoding iso8859-13
FontEncoding L7x
DateFormats "yyyy 'm.' MMMM d 'd.'|yyyy 'm.' MMMM d 'd.'|yyyy-MM-dd"
LangCode lt_LT
AsBabelOptions true
End
@ -894,6 +974,7 @@ Language lowersorbian
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
LangCode dsb_DE
End
@ -905,6 +986,7 @@ Language magyar
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "yyyy. MMMM d.|yyyy. MMM d.|yyyy.MM.dd."
LangCode hu_HU
End
@ -915,6 +997,7 @@ Language macedonian
QuoteStyle german
Encoding cp1251
FontEncoding T2A
DateFormats "dd MMMM yyyy|d MMM yyyy|d.M.yyyy"
LangCode mk_MK
Provides textcyrillic
End
@ -924,6 +1007,7 @@ Language marathi
GuiName "Marathi"
PolyglossiaName marathi
Encoding utf8
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
LangCode mr_IN
End
@ -935,6 +1019,7 @@ Language mongolian
BabelName mongolian
Encoding utf8
FontEncoding T2A
DateFormats "yyyy оны M сарын d|d-M-yyyy|dd-MM-yyyy"
LangCode mn_MN
AsBabelOptions true
Provides textcyrillic
@ -948,6 +1033,7 @@ Language newzealand
QuoteStyle english
Encoding iso8859-15
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode en_NZ
End
@ -959,6 +1045,7 @@ Language norsk
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode nb_NO
End
@ -970,6 +1057,7 @@ Language nynorsk
QuoteStyle swiss
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode nn_NO
End
@ -979,6 +1067,7 @@ Language occitan
PolyglossiaName occitan
QuoteStyle french
Encoding utf8
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode oc_FR
End
@ -995,6 +1084,7 @@ End
# QuoteStyle russian
# End
# FIXME DateFormats
Language piedmontese
GuiName "Piedmontese"
HasGuiSupport true
@ -1015,6 +1105,7 @@ Language polish
QuoteStyle polish
Encoding iso8859-2
FontEncoding QX|T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode pl_PL
End
@ -1026,6 +1117,7 @@ Language portuguese
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d 'de' MMM 'de' yyyy|yyyy/MM/dd"
LangCode pt_PT
End
@ -1037,6 +1129,7 @@ Language romanian
QuoteStyle polish
Encoding iso8859-16
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
LangCode ro_RO
End
@ -1048,6 +1141,7 @@ Language romansh
QuoteStyle german
Encoding iso8859-15
FontEncoding ASCII
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
LangCode rm_CH
End
@ -1059,6 +1153,7 @@ Language russian
QuoteStyle russian
Encoding koi8-r
FontEncoding T2A
DateFormats "d MMMM yyyy 'г'.|d MMM yyyy 'г'.|dd.MM.yyyy"
LangCode ru_RU
Provides textcyrillic
End
@ -1070,6 +1165,7 @@ Language samin
PolyglossiaName samin
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "MMMM d. 'b'. yyyy|MMM d. 'b'. yyyy|d.M.yyyy"
LangCode se_NO
End
@ -1078,6 +1174,7 @@ Language sanskrit
GuiName "Sanskrit"
PolyglossiaName sanskrit
Encoding utf8
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
LangCode sa_IN
End
@ -1090,6 +1187,7 @@ Language scottish
QuoteStyle english
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "dd MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode gd_GB
End
@ -1104,6 +1202,7 @@ Language serbian
QuoteStyle polish
Encoding utf8
FontEncoding T2A
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode sr_RS
AsBabelOptions true
End
@ -1118,6 +1217,7 @@ Language serbian-latin
QuoteStyle polish
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
LangCode sr_RS-Latin
End
@ -1129,6 +1229,7 @@ Language slovak
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d. MMMM yyyy|d. MMM yyyy|d.M.yyyy"
LangCode sk_SK
End
@ -1139,6 +1240,7 @@ Language slovene
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "dd. MMMM yyyy|d. MMM yyyy|d.M.yyyy"
LangCode sl_SI
End
@ -1150,6 +1252,7 @@ Language spanish
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode es_ES
PostBabelPreamble
\addto\shorthandsspanish{\spanishdeactivate{~<>}}
@ -1164,6 +1267,7 @@ Language spanish-mexico
QuoteStyle french
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d 'de' MMMM 'de' yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode es_MX
PostBabelPreamble
\addto\shorthandsspanish{\spanishdeactivate{~<>.}}
@ -1178,6 +1282,7 @@ Language swedish
QuoteStyle swedish
Encoding iso8859-15
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|yyyy-MM-dd"
LangCode sv_SE
End
@ -1187,6 +1292,7 @@ Language syriac
PolyglossiaName syriac
Encoding utf8
RTL true
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode syr_SY
End
@ -1195,6 +1301,7 @@ Language tamil
GuiName "Tamil"
PolyglossiaName tamil
Encoding utf8
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
LangCode ta_IN
End
@ -1203,6 +1310,7 @@ Language telugu
GuiName "Telugu"
PolyglossiaName telugu
Encoding utf8
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
LangCode te_IN
End
@ -1213,6 +1321,7 @@ Language thai
QuoteStyle english
Encoding tis620-0
FontEncoding LTH
DateFormats "dd MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
LangCode th_TH
PostBabelPreamble
\usepackage{thswitch}
@ -1220,6 +1329,7 @@ Language thai
End
# not supported by babel
#FIXME DateFormats
Language tibetan
GuiName "Tibetan"
PolyglossiaName tibetan
@ -1236,6 +1346,7 @@ Language turkish
Encoding iso8859-9
FontEncoding T1|OT1
LangCode tr_TR
DateFormats "d MMMM yyyy|dd.MMM.yyyy|dd.MM.yyyy"
PostBabelPreamble
\usepackage{xkeyval}
EndPostBabelPreamble
@ -1250,6 +1361,7 @@ Language turkmen
QuoteStyle swiss
Encoding utf8
FontEncoding T1|OT1
DateFormats "yyyy ý. MMMM d|dd.MM.yyyy ý.|dd.MM.yy ý."
LangCode tk_TM
AsBabelOptions true
End
@ -1262,6 +1374,7 @@ Language ukrainian
QuoteStyle russian
Encoding koi8-u
FontEncoding T2A
DateFormats "dd MMMM yyyy|d MM yyyy|dd.MM.yyyy"
LangCode uk_UA
Provides textcyrillic
End
@ -1273,6 +1386,7 @@ Language uppersorbian
QuoteStyle german
Encoding iso8859-2
FontEncoding T1|OT1
DateFormats "d MMMM yyyy|d MMM yyyy|dd.MM.yyyy"
LangCode hsb_DE
End
@ -1281,6 +1395,7 @@ Language urdu
GuiName "Urdu"
PolyglossiaName urdu
Encoding utf8
DateFormats "d MMMM, yyyy|d MMM yyyy|dd/MM/yyyy"
RTL true
LangCode ur_PK
End
@ -1291,6 +1406,7 @@ Language vietnamese
PolyglossiaName vietnamese
QuoteStyle english
Encoding utf8
DateFormats "dd 'tháng' MMMM yyyy|dd-MM-yyyy|dd/MM/yyyy"
FontEncoding T5
LangCode vi_VN
End
@ -1301,6 +1417,7 @@ Language welsh
PolyglossiaName welsh
QuoteStyle british
Encoding iso8859-15
DateFormats "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
FontEncoding T1|OT1
LangCode cy_GB
End

View File

@ -22,6 +22,8 @@ import re, string
import unicodedata
import sys, os
from datetime import date
# Uncomment only what you need to import, please.
from parser_tools import (count_pars_in_inset, find_end_of_inset, find_end_of_layout,
@ -668,6 +670,283 @@ def revert_vcsinfo(document):
i = i + 1
def revert_dateinfo(document):
" Revert date info insets to static text. "
# FIXME This currently only considers the main language and uses the system locale
# Ideally, it should honor context languages and switch the locale accordingly.
# The date formats for each language using strftime syntax:
# long, short, loclong, locmedium, locshort
dateformats = {
"afrikaans" : ["%A, %d %B %Y", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y/%m/%d"],
"albanian" : ["%A, %d %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"american" : ["%A, %B %d, %Y", "%m/%d/%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"amharic" : ["%A ፣%d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"ancientgreek" : ["%A, %d %B %Y", "%d %b %Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"arabic_arabi" : ["%%d %%Y", "%d/%m/%Y", "%d %%Y", "%d/%m/%Y", "%d/%m/%Y"],
"arabic_arabtex" : ["%%d %%Y", "%d/%m/%Y", "%d %%Y", "%d/%m/%Y", "%d/%m/%Y"],
"armenian" : ["%Y թ. %B %d, %A", "%d.%m.%y", "%d %%Y", "%d %%Y", "%d/%m/%Y"],
"asturian" : ["%A, %d %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d %b %Y", "%d/%m/%Y"],
"australian" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"austrian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"bahasa" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"bahasam" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"basque" : ["%Y(e)ko %B %d, %A", "%y/%m/%d", "%Y %B %d", "%Y %b %d", "%Y/%m/%d"],
"belarusian" : ["%A, %d %B %Y г.", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"bosnian" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%Y-%m-%d"],
"brazilian" : ["%A, %d de %B de %Y", "%d/%m/%Y", "%d de %B de %Y", "%d de %b de %Y", "%d/%m/%Y"],
"breton" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"british" : ["%A, %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"bulgarian" : ["%A, %d %B %Y г.", "%d.%m.%y г.", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"canadian" : ["%A, %B %d, %Y", "%Y-%m-%d", "%B %d, %Y", "%d %b %Y", "%Y-%m-%d"],
"canadien" : ["%A %d %B %Y", "%y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"catalan" : ["%A, %d %B de %Y", "%d/%m/%y", "%d / %B / %Y", "%d / %b / %Y", "%d/%m/%Y"],
"chinese-simplified" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y-%m-%d", "%y-%m-%d"],
"chinese-traditional" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y年%m月%d", "%y年%m月%d"],
"coptic" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"croatian" : ["%A, %d. %B %Y.", "%d. %m. %Y.", "%d. %B %Y.", "%d. %b. %Y.", "%d.%m.%Y."],
"czech" : ["%A %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b. %Y", "%d.%m.%Y"],
"danish" : ["%A den %d. %B %Y", "%d/%m/%Y", "%d. %B %Y", "%d. %b %Y", "%d/%m/%Y"],
"divehi" : ["%Y %B %d, %A", "%Y-%m-%d", "%Y %B %d", "%Y %b %d", "%d/%m/%Y"],
"dutch" : ["%A %d %B %Y", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"english" : ["%A, %B %d, %Y", "%m/%d/%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"esperanto" : ["%A, %d %B %Y", "%d %b %Y", "la %d de %B %Y", "la %d de %b %Y", "%m/%d/%Y"],
"estonian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"farsi" : ["%A %d %B %Y", "%Y/%m/%d", "%d %B %Y", "%d %b %Y", "%Y/%m/%d"],
"finnish" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"french" : ["%A %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"friulan" : ["%A %d di %B dal %Y", "%d/%m/%y", "%d di %B dal %Y", "%d di %b dal %Y", "%d/%m/%Y"],
"galician" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d de %b de %Y", "%d/%m/%Y"],
"georgian" : ["%A, %d %B, %Y", "%d.%m.%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"german" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"german-ch" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"german-ch-old" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"greek" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"hebrew" : ["%A, %d ב%B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"hindi" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"icelandic" : ["%A, %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"interlingua" : ["%Y %B %d, %A", "%Y-%m-%d", "le %d de %B %Y", "le %d de %b %Y", "%Y-%m-%d"],
"irish" : ["%A %d %B %Y", "%d/%m/%Y", "%d. %B %Y", "%d. %b %Y", "%d/%m/%Y"],
"italian" : ["%A %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d/%b/%Y", "%d/%m/%Y"],
"japanese" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y/%m/%d", "%y/%m/%d"],
"japanese-cjk" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y/%m/%d", "%y/%m/%d"],
"kannada" : ["%A, %B %d, %Y", "%d/%m/%y", "%d %B %Y", "%d %B %Y", "%d-%m-%Y"],
"kazakh" : ["%Y ж. %d %B, %A", "%d.%m.%y", "%d %B %Y", "%d %B %Y", "%Y-%d-%m"],
"khmer" : ["%A %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %B %Y", "%d/%m/%Y"],
"korean" : ["%Y년 %m월 %d%A", "%y. %m. %d.", "%Y년 %m월 %d", "%Y. %m. %d.", "%y. %m. %d."],
"kurmanji" : ["%A, %d %B %Y", "%d %b %Y", "%d. %B %Y", "%d. %m. %Y", "%Y-%m-%d"],
"lao" : ["%A ທີ %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %B %Y", "%d/%m/%Y"],
"latin" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"latvian" : ["%A, %Y. gada %d. %B", "%d.%m.%y", "%Y. gada %d. %B", "%Y. gada %d. %b", "%d.%m.%Y"],
"lithuanian" : ["%Y m. %B %d d., %A", "%Y-%m-%d", "%Y m. %B %d d.", "%Y m. %B %d d.", "%Y-%m-%d"],
"lowersorbian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"macedonian" : ["%A, %d %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"magyar" : ["%Y. %B %d., %A", "%Y. %m. %d.", "%Y. %B %d.", "%Y. %b %d.", "%Y.%m.%d."],
"marathi" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"mongolian" : ["%A, %Y оны %m сарын %d", "%Y-%m-%d", "%Y оны %m сарын %d", "%d-%m-%Y", "%d-%m-%Y"],
"naustrian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"newzealand" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"ngerman" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"norsk" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"nynorsk" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"occitan" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"piedmontese" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"polish" : ["%A, %d %B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"polutonikogreek" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"portuguese" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d de %b de %Y", "%Y/%m/%d"],
"romanian" : ["%A, %d %B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"romansh" : ["%A, ils %d da %B %Y", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"russian" : ["%A, %d %B %Y г.", "%d.%m.%Y", "%d %B %Y г.", "%d %b %Y г.", "%d.%m.%Y"],
"samin" : ["%Y %B %d, %A", "%Y-%m-%d", "%B %d. b. %Y", "%b %d. b. %Y", "%d.%m.%Y"],
"sanskrit" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"scottish" : ["%A, %dmh %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"serbian" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"serbian-latin" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"slovak" : ["%A, %d. %B %Y", "%d. %m. %Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"slovene" : ["%A, %d. %B %Y", "%d. %m. %y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"spanish" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B %de %Y", "%d %b %Y", "%d/%m/%Y"],
"spanish-mexico" : ["%A, %d de %B %de %Y", "%d/%m/%y", "%d de %B de %Y", "%d %b %Y", "%d/%m/%Y"],
"swedish" : ["%A %d %B %Y", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"syriac" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"tamil" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"telugu" : ["%d, %B %Y, %A", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"thai" : ["%Aที่ %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"tibetan" : ["%Y %Bའི་ཚེས་%d, %A", "%Y-%m-%d", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"turkish" : ["%d %B %Y %A", "%d.%m.%Y", "%d %B %Y", "%d.%b.%Y", "%d.%m.%Y"],
"turkmen" : ["%d %B %Y %A", "%d.%m.%Y", "%Y ý. %B %d", "%d.%m.%Y ý.", "%d.%m.%y ý."],
"ukrainian" : ["%A, %d %B %Y р.", "%d.%m.%y", "%d %B %Y", "%d %m %Y", "%d.%m.%Y"],
"uppersorbian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"urdu" : ["%%d %%Y", "%d/%m/%y", "%d %B, %Y", "%d %b %Y", "%d/%m/%Y"],
"vietnamese" : ["%A, %d %B, %Y", "%d/%m/%Y", "%d tháng %B %Y", "%d-%m-%Y", "%d/%m/%Y"],
"welsh" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"afrikaans" : ["%A, %d %B %Y", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y/%m/%d"],
"albanian" : ["%A, %d %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"american" : ["%A, %B %d, %Y", "%m/%d/%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"amharic" : ["%A ፣%d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"ancientgreek" : ["%A, %d %B %Y", "%d %b %Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"arabic_arabi" : ["%%d %%Y", "%d/%m/%Y", "%d %%Y", "%d/%m/%Y", "%d/%m/%Y"],
"arabic_arabtex" : ["%%d %%Y", "%d/%m/%Y", "%d %%Y", "%d/%m/%Y", "%d/%m/%Y"],
"armenian" : ["%Y թ. %B %d, %A", "%d.%m.%y", "%d %%Y", "%d %%Y", "%d/%m/%Y"],
"asturian" : ["%A, %d %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d %b %Y", "%d/%m/%Y"],
"australian" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"austrian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"bahasa" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"bahasam" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"basque" : ["%Y(e)ko %B %d, %A", "%y/%m/%d", "%Y %B %d", "%Y %b %d", "%Y/%m/%d"],
"belarusian" : ["%A, %d %B %Y г.", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"bosnian" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%Y-%m-%d"],
"brazilian" : ["%A, %d de %B de %Y", "%d/%m/%Y", "%d de %B de %Y", "%d de %b de %Y", "%d/%m/%Y"],
"breton" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"british" : ["%A, %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"bulgarian" : ["%A, %d %B %Y г.", "%d.%m.%y г.", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"canadian" : ["%A, %B %d, %Y", "%Y-%m-%d", "%B %d, %Y", "%d %b %Y", "%Y-%m-%d"],
"canadien" : ["%A %d %B %Y", "%y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"catalan" : ["%A, %d %B de %Y", "%d/%m/%y", "%d / %B / %Y", "%d / %b / %Y", "%d/%m/%Y"],
"chinese-simplified" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y-%m-%d", "%y-%m-%d"],
"chinese-traditional" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y年%m月%d", "%y年%m月%d"],
"coptic" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"croatian" : ["%A, %d. %B %Y.", "%d. %m. %Y.", "%d. %B %Y.", "%d. %b. %Y.", "%d.%m.%Y."],
"czech" : ["%A %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b. %Y", "%d.%m.%Y"],
"danish" : ["%A den %d. %B %Y", "%d/%m/%Y", "%d. %B %Y", "%d. %b %Y", "%d/%m/%Y"],
"divehi" : ["%Y %B %d, %A", "%Y-%m-%d", "%Y %B %d", "%Y %b %d", "%d/%m/%Y"],
"dutch" : ["%A %d %B %Y", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"english" : ["%A, %B %d, %Y", "%m/%d/%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"esperanto" : ["%A, %d %B %Y", "%d %b %Y", "la %d de %B %Y", "la %d de %b %Y", "%m/%d/%Y"],
"estonian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"farsi" : ["%A %d %B %Y", "%Y/%m/%d", "%d %B %Y", "%d %b %Y", "%Y/%m/%d"],
"finnish" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"french" : ["%A %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"friulan" : ["%A %d di %B dal %Y", "%d/%m/%y", "%d di %B %dal %Y", "%d di %b dal %Y", "%d/%m/%Y"],
"galician" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d de %b de %Y", "%d/%m/%Y"],
"georgian" : ["%A, %d %B, %Y", "%d.%m.%y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"german" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"german-ch" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"german-ch-old" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"greek" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"hebrew" : ["%A, %d ב%B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"hindi" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"icelandic" : ["%A, %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"interlingua" : ["%Y %B %d, %A", "%Y-%m-%d", "le %d de %B %Y", "le %d de %b %Y", "%Y-%m-%d"],
"irish" : ["%A %d %B %Y", "%d/%m/%Y", "%d. %B %Y", "%d. %b %Y", "%d/%m/%Y"],
"italian" : ["%A %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d/%b/%Y", "%d/%m/%Y"],
"japanese" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y/%m/%d", "%y/%m/%d"],
"japanese-cjk" : ["%Y年%m月%d%A", "%Y/%m/%d", "%Y年%m月%d", "%Y/%m/%d", "%y/%m/%d"],
"kannada" : ["%A, %B %d, %Y", "%d/%m/%y", "%d %B %Y", "%d %B %Y", "%d-%m-%Y"],
"kazakh" : ["%Y ж. %d %B, %A", "%d.%m.%y", "%d %B %Y", "%d %B %Y", "%Y-%d-%m"],
"khmer" : ["%A %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %B %Y", "%d/%m/%Y"],
"korean" : ["%Y년 %m월 %d%A", "%y. %m. %d.", "%Y년 %m월 %d", "%Y. %m. %d.", "%y. %m. %d."],
"kurmanji" : ["%A, %d %B %Y", "%d %b %Y", "%d. %B %Y", "%d. %m. %Y", "%Y-%m-%d"],
"lao" : ["%A ທີ %d %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %B %Y", "%d/%m/%Y"],
"latin" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"latvian" : ["%A, %Y. gada %d. %B", "%d.%m.%y", "%Y. gada %d. %B", "%Y. gada %d. %b", "%d.%m.%Y"],
"lithuanian" : ["%Y m. %B %d d., %A", "%Y-%m-%d", "%Y m. %B %d d.", "%Y m. %B %d d.", "%Y-%m-%d"],
"lowersorbian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"macedonian" : ["%A, %d %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"magyar" : ["%Y. %B %d., %A", "%Y. %m. %d.", "%Y. %B %d.", "%Y. %b %d.", "%Y.%m.%d."],
"marathi" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"mongolian" : ["%A, %Y оны %m сарын %d", "%Y-%m-%d", "%Y оны %m сарын %d", "%d-%m-%Y", "%d-%m-%Y"],
"naustrian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"newzealand" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"ngerman" : ["%A, %d. %B %Y", "%d.%m.%y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"norsk" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"nynorsk" : ["%A %d. %B %Y", "%d.%m.%Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"occitan" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"piedmontese" : ["%A, %d %B %Y", "%d %b %Y", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"polish" : ["%A, %d %B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"polutonikogreek" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"portuguese" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d de %b de %Y", "%Y/%m/%d"],
"romanian" : ["%A, %d %B %Y", "%d.%m.%Y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"romansh" : ["%A, ils %d da %B %Y", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"russian" : ["%A, %d %B %Y г.", "%d.%m.%Y", "%d %B %Y г.", "%d %b %Y г.", "%d.%m.%Y"],
"samin" : ["%Y %B %d, %A", "%Y-%m-%d", "%B %d. b. %Y", "%b %d. b. %Y", "%d.%m.%Y"],
"sanskrit" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"scottish" : ["%A, %dmh %B %Y", "%d/%m/%Y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"serbian" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"serbian-latin" : ["%A, %d. %B %Y.", "%d.%m.%y.", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"slovak" : ["%A, %d. %B %Y", "%d. %m. %Y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"slovene" : ["%A, %d. %B %Y", "%d. %m. %y", "%d. %B %Y", "%d. %b %Y", "%d.%m.%Y"],
"spanish" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d %b %Y", "%d/%m/%Y"],
"spanish-mexico" : ["%A, %d de %B de %Y", "%d/%m/%y", "%d de %B de %Y", "%d %b %Y", "%d/%m/%Y"],
"swedish" : ["%A %d %B %Y", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%Y-%m-%d"],
"syriac" : ["%Y %B %d, %A", "%Y-%m-%d", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"tamil" : ["%A, %d %B, %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"telugu" : ["%d, %B %Y, %A", "%d-%m-%y", "%d %B %Y", "%d %b %Y", "%d-%m-%Y"],
"thai" : ["%Aที่ %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"],
"tibetan" : ["%Y %Bའི་ཚེས་%d, %A", "%Y-%m-%d", "%B %d, %Y", "%b %d, %Y", "%m/%d/%Y"],
"turkish" : ["%d %B %Y %A", "%d.%m.%Y", "%d %B %Y", "%d.%b.%Y", "%d.%m.%Y"],
"turkmen" : ["%d %B %Y %A", "%d.%m.%Y", "%Y ý. %B %d", "%d.%m.%Y ý.", "%d.%m.%y ý."],
"ukrainian" : ["%A, %d %B %Y р.", "%d.%m.%y", "%d %B %Y", "%d %m %Y", "%d.%m.%Y"],
"uppersorbian" : ["%A, %d. %B %Y", "%d.%m.%y", "%d %B %Y", "%d %b %Y", "%d.%m.%Y"],
"urdu" : ["%%d %%Y", "%d/%m/%y", "%d %B, %Y", "%d %b %Y", "%d/%m/%Y"],
"vietnamese" : ["%A, %d %B, %Y", "%d/%m/%Y", "%d tháng %B %Y", "%d-%m-%Y", "%d/%m/%Y"],
"welsh" : ["%A, %d %B %Y", "%d/%m/%y", "%d %B %Y", "%d %b %Y", "%d/%m/%Y"]
}
types = ["date", "fixdate", "moddate" ]
i = 0
i = find_token(document.header, "\\language", 0)
if i == -1:
# this should not happen
document.warning("Malformed LyX document! No \\language header found!")
return
lang = get_value(document.header, "\\language", i)
i = 0
while True:
i = find_token(document.body, "\\begin_inset Info", i)
if i == -1:
return
j = find_end_of_inset(document.body, i + 1)
if j == -1:
document.warning("Malformed LyX document: Could not find end of Info inset.")
i = i + 1
continue
tp = find_token(document.body, 'type', i, j)
tpv = get_quoted_value(document.body, "type", tp)
if tpv not in types:
i = i + 1
continue
arg = find_token(document.body, 'arg', i, j)
argv = get_quoted_value(document.body, "arg", arg)
isodate = ""
dte = date.today()
if tpv == "fixdate":
datecomps = argv.split('@')
if len(datecomps) > 1:
argv = datecomps[0]
isodate = datecomps[1]
m = re.search('(\d\d\d\d)-(\d\d)-(\d\d)', isodate)
if m:
dte = date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
# FIXME if we had the path to the original document (not the one in the tmp dir),
# we could use the mtime.
# elif tpv == "moddate":
# dte = date.fromtimestamp(os.path.getmtime(document.dir))
result = ""
if argv == "ISO":
result = dte.isodate()
elif argv == "long":
result = dte.strftime(dateformats[lang][0])
elif argv == "short":
result = dte.strftime(dateformats[lang][1])
elif argv == "loclong":
result = dte.strftime(dateformats[lang][2])
elif argv == "locmedium":
result = dte.strftime(dateformats[lang][3])
elif argv == "locshort":
result = dte.strftime(dateformats[lang][4])
else:
fmt = argv.replace("MMMM", "%b").replace("MMM", "%b").replace("MM", "%m").replace("M", "%m")
fmt = fmt.replace("yyyy", "%Y").replace("yy", "%y")
fmt = fmt.replace("dddd", "%A").replace("ddd", "%a").replace("dd", "%d")
fmt = re.sub('[^\'%]d', '%d', fmt)
fmt = fmt.replace("'", "")
result = dte.strftime(fmt)
document.body[i : j+1] = result
i = i + 1
##
# Conversion hub
#
@ -687,11 +966,13 @@ convert = [
[555, []],
[556, []],
[557, [convert_vcsinfo]],
[558, [removeFrontMatterStyles]]
[558, [removeFrontMatterStyles]],
[559, []]
]
revert = [
[557, [addFrontMatterStyles]],
[558, [revert_dateinfo]],
[557, [addFrontMatterStyles]],
[556, [revert_vcsinfo]],
[555, [revert_bibencoding]],
[554, [revert_vcolumns]],

View File

@ -477,22 +477,8 @@ Menuset
# InsetInfo context menu
#
Menu "buffer-info"
Item "File|F" "inset-modify buffer name"
Item "Path|P" "inset-modify buffer path"
Item "Class|C" "inset-modify buffer class"
Separator
Item "File Revision|R" "inset-modify buffer vcs-revision"
Item "Tree Revision|T" "inset-modify buffer vcs-tree-revision"
Item "Revision Author|A" "inset-modify buffer vcs-author"
Item "Revision Date|D" "inset-modify buffer vcs-date"
Item "Revision Time|i" "inset-modify buffer vcs-time"
Separator
Item "LyX Version|X" "inset-modify lyxinfo version"
End
Menu "context-info"
Submenu "Document Info|D" "buffer-info"
InfoArguments
Separator
Item "Copy Text|o" "inset-copy-as"
Item "Settings...|S" "inset-settings info"

View File

@ -374,6 +374,7 @@ Menuset
Submenu "Math|h" "insert_math"
Submenu "Special Character|p" "insert_special"
Submenu "Formatting|o" "insert_formatting"
Submenu "Fields|d" "insert_fields"
Submenu "List / TOC|i" "insert_toc"
Submenu "Float|a" "insert_float"
Submenu "Note|N" "insert_note"
@ -397,7 +398,6 @@ Menuset
Item "Footnote|F" "footnote-insert"
Item "Marginal Note|M" "marginalnote-insert"
Item "Program Listing[[Menu]]" "listing-insert"
Item "Date" "date-insert"
Separator
EnvironmentSeparators
Separator
@ -421,6 +421,14 @@ Menuset
Submenu "Logos|L" "insert_logos"
End
Menu "insert_fields"
Item "Date (Current)|D" "info-insert date"
Item "Date (Last Modification)|L" "info-insert moddate"
Item "Date (Fix)|F" "info-insert fixdate"
Separator
Item "Other...|O" "info-insert"
End
Menu "insert_logos"
Item "LyX Logo|L" "specialchar-insert lyx"
Item "TeX Logo|T" "specialchar-insert tex"

View File

@ -103,11 +103,20 @@ string Language::fontenc(BufferParams const & params) const
}
string Language::dateFormat(size_t i) const
{
if (i > dateformats_.size())
return string();
return dateformats_.at(i);
}
bool Language::readLanguage(Lexer & lex)
{
enum LanguageTags {
LA_AS_BABELOPTS = 1,
LA_BABELNAME,
LA_DATEFORMATS,
LA_ENCODING,
LA_END,
LA_FONTENC,
@ -130,6 +139,7 @@ bool Language::readLanguage(Lexer & lex)
LexerKeyword languageTags[] = {
{ "asbabeloptions", LA_AS_BABELOPTS },
{ "babelname", LA_BABELNAME },
{ "dateformats", LA_DATEFORMATS },
{ "encoding", LA_ENCODING },
{ "end", LA_END },
{ "fontencoding", LA_FONTENC },
@ -196,6 +206,13 @@ bool Language::readLanguage(Lexer & lex)
fontenc_.insert(fontenc_.end(), fe.begin(), fe.end());
break;
}
case LA_DATEFORMATS: {
lex.eatLine();
vector<string> const df =
getVectorFromString(trim(lex.getString(true), "\""), "|");
dateformats_.insert(dateformats_.end(), df.begin(), df.end());
break;
}
case LA_GUINAME:
lex >> display_;
break;
@ -261,6 +278,11 @@ bool Language::read(Lexer & lex)
}
if (fontenc_.empty())
fontenc_.push_back("ASCII");
if (dateformats_.empty()) {
dateformats_.push_back("MMMM dd, yyyy");
dateformats_.push_back("MMM dd, yyyy");
dateformats_.push_back("M/d/yyyy");
}
return true;
}

View File

@ -86,6 +86,8 @@ public:
bool internalFontEncoding() const { return internal_enc_; }
/// The most suitable font encoding(s) for the selected document font
std::string fontenc(BufferParams const &) const;
/// Return the localized date formats (long, medium, short format)
std::string dateFormat(size_t i) const;
/// This language needs to be passed to babel itself (not the class)
bool asBabelOptions() const { return as_babel_options_; }
/// This language corresponds to a translation of the GUI
@ -134,6 +136,8 @@ private:
///
std::vector<std::string> fontenc_;
///
std::vector<std::string> dateformats_;
///
bool internal_enc_;
///
bool as_babel_options_;

View File

@ -1933,6 +1933,9 @@ void LyXAction::init()
* \li Params: <TYPE>: shortcut[s]|lyxrc|lyxinfo|package|textclass|menu|icon|buffer \n
<ARG>: argument for a given type. Look into InsetInfo.h for detailed
description. \n
date: current date (formatted and localized)\n
moddate: date of last modification (saving) (formatted and localized)\n
fixdate: a static date (formatted and localized)\n
shortcut[s]: name of lfun (e.g math-insert \alpha) \n
lyxrc: name of rc_entry (e.g. bind_file) \n
lyxinfo: "version" - used version of LyX \n

View File

@ -1997,21 +1997,17 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_INFO_INSERT: {
Inset * inset;
if (cmd.argument().empty() && cur.selection()) {
// if command argument is empty use current selection as parameter.
docstring ds = cur.selectionAsString(false);
cutSelection(cur, false);
FuncRequest cmd0(cmd, ds);
inset = createInset(cur.buffer(), cmd0);
if (cmd.argument().empty()) {
bv->showDialog("info");
} else {
inset = createInset(cur.buffer(), cmd);
if (!inset)
break;
cur.recordUndo();
insertInset(cur, inset);
cur.forceBufferUpdate();
cur.posForward();
}
if (!inset)
break;
cur.recordUndo();
insertInset(cur, inset);
cur.forceBufferUpdate();
cur.posForward();
break;
}
case LFUN_CAPTION_INSERT:

View File

@ -41,7 +41,10 @@ namespace frontend {
/////////////////////////////////////////////////////////////////
char const * info_types[] =
{ "buffer",
{ "date",
"moddate",
"fixdate",
"buffer",
"vcs",
"package",
"textclass",
@ -57,7 +60,10 @@ char const * info_types[] =
// GUI names (in combo)
char const * info_types_gui[] =
{ N_("Document Information"),// buffer
{ N_("Date (current)"),// date
N_("Date (last modified)"),// moddate
N_("Date (fix)"),// fixdate
N_("Document Information"),// buffer
N_("Version Control Information"),// vcs
N_("LaTeX Package Availability"),// package
N_("LaTeX Class Availability"),// textclass
@ -73,7 +79,10 @@ char const * info_types_gui[] =
// Line edit label
char const * info_name_gui[] =
{ N_("Not Applicable"),// buffer
{ N_("Custom Format"),// date
N_("Custom Format"),// moddate
N_("Custom Format"),// fixdate
N_("Not Applicable"),// buffer
N_("Not Applicable"),// vcs
N_("Package Name"),// package
N_("Class Name"),// textclass
@ -89,7 +98,40 @@ char const * info_name_gui[] =
// Line edit tooltip
char const * info_tooltip[] =
{ N_("Please select a valid type above"),// buffer
{ N_("Enter date format specification, using the following placeholders:\n"
"* d: day as number without a leading zero\n"
"* dd: day as number with a leading zero\n"
"* ddd: abbreviated localized day name\n"
"* dddd: long localized day name\n"
"* M: month as number without a leading zero\n"
"* MM: month as number with a leading zero\n"
"* MMM: abbreviated localized month name\n"
"* MMMM: long localized month name\n"
"* yy: year as two digit number\n"
"* yyyy: year as four digit number"),// date
N_("Enter date format specification, using the following placeholders:\n"
"* d: day as number without a leading zero\n"
"* dd: day as number with a leading zero\n"
"* ddd: abbreviated localized day name\n"
"* dddd: long localized day name\n"
"* M: month as number without a leading zero\n"
"* MM: month as number with a leading zero\n"
"* MMM: abbreviated localized month name\n"
"* MMMM: long localized month name\n"
"* yy: year as two digit number\n"
"* yyyy: year as four digit number"),// moddate
N_("Enter date format specification, using the following placeholders:\n"
"* d: day as number without a leading zero\n"
"* dd: day as number with a leading zero\n"
"* ddd: abbreviated localized day name\n"
"* dddd: long localized day name\n"
"* M: month as number without a leading zero\n"
"* MM: month as number with a leading zero\n"
"* MMM: abbreviated localized month name\n"
"* MMMM: long localized month name\n"
"* yy: year as two digit number\n"
"* yyyy: year as four digit number"),// fixdate
N_("Please select a valid type above"),// buffer
N_("Please select a valid type above"),// vcs
N_("Enter a LaTeX package name such as 'hyperref' (extension is optional). "
"The output will be 'Yes' (package available) or 'No' (package unavailable)."),// package
@ -130,7 +172,16 @@ void GuiInfo::paramsToDialog(Inset const * inset)
InsetInfo const * ii = static_cast<InsetInfo const *>(inset);
inset_ = const_cast<Inset*>(inset);
QString const type = toqstr(ii->infoType());
QString const name = toqstr(ii->infoName());
QString name = toqstr(ii->infoName());
QString fixdate;
if (type == "fixdate") {
fixdate = name.section('@', 1, 1);
name = name.section('@', 0, 0);
if (!fixdate.isEmpty())
fixDateLE->setText(fixdate);
else
fixDateLE->setText(QDate::currentDate().toString(Qt::ISODate));
}
typeCO->blockSignals(true);
nameLE->blockSignals(true);
nameLE->clear();
@ -168,6 +219,12 @@ docstring GuiInfo::dialogToParams() const
: QString();
if (name == "custom")
name = nameLE->text();
if (type == "fixdate") {
QString fd = fixDateLE->text();
if (fd.isEmpty())
fd = QDate::currentDate().toString(Qt::ISODate);
name += "@" + fd;
}
return qstring_to_ucs4(type + ' ' + name);
}
@ -176,7 +233,7 @@ void GuiInfo::updateArguments(int i)
{
infoLW->clear();
if (inset_) {
InsetInfo const * ii = static_cast<InsetInfo const *>(inset_);
InsetInfo * ii = static_cast<InsetInfo *>(inset_);
vector<pair<string,docstring>> args = ii->getArguments(info_types[i]);
for (auto const & p : args) {
QListWidgetItem * li = new QListWidgetItem(toqstr(p.second));
@ -210,6 +267,11 @@ bool GuiInfo::checkWidgets(bool readonly) const
nameLE->setEnabled(type_enabled);
nameLE->setToolTip(qt_(info_tooltip[typeCO->currentIndex()]));
bool const fixdate_enabled =
(info_types[typeCO->currentIndex()] == from_ascii("fixdate"));
fixDateLE->setVisible(fixdate_enabled);
fixDateLA->setVisible(fixdate_enabled);
if (!InsetParamsWidget::checkWidgets())
return false;
return !arg.isEmpty() && (arg != "custom" || !nameLE->text().isEmpty());

View File

@ -36,7 +36,7 @@ private:
//@{
InsetCode insetCode() const { return INFO_CODE; }
FuncCode creationCode() const { return LFUN_INFO_INSERT; }
QString dialogTitle() const { return qt_("Info Inset Settings"); }
QString dialogTitle() const { return qt_("Field Settings"); }
void paramsToDialog(Inset const *);
docstring dialogToParams() const;
bool checkWidgets(bool readonly) const;

View File

@ -60,6 +60,7 @@
#include "insets/Inset.h"
#include "insets/InsetCitation.h"
#include "insets/InsetGraphics.h"
#include "insets/InsetInfo.h"
#include "insets/InsetQuotes.h"
#include "support/lassert.h"
@ -173,6 +174,8 @@ public:
IndicesListsContext,
/** Available citation styles for a given citation */
CiteStyles,
/** Available arguments for a given info inset */
InfoArguments,
/** Available graphics groups */
GraphicsGroups,
/// Words suggested by the spellchecker.
@ -365,6 +368,7 @@ public:
void expandIndices(Buffer const * buf, bool listof = false);
void expandIndicesContext(Buffer const * buf, bool listof = false);
void expandCiteStyles(BufferView const *);
void expandInfoArguments(BufferView const *);
void expandGraphicsGroups(BufferView const *);
void expandSpellingSuggestions(BufferView const *);
void expandLanguageSelector(Buffer const * buf);
@ -466,6 +470,7 @@ void MenuDefinition::read(Lexer & lex)
md_indicescontext,
md_indiceslists,
md_indiceslistscontext,
md_infoarguments,
md_lastfiles,
md_optitem,
md_optsubmenu,
@ -513,6 +518,7 @@ void MenuDefinition::read(Lexer & lex)
{ "indicescontext", md_indicescontext },
{ "indiceslists", md_indiceslists },
{ "indiceslistscontext", md_indiceslistscontext },
{ "infoarguments", md_infoarguments },
{ "item", md_item },
{ "languageselector", md_languageselector },
{ "lastfiles", md_lastfiles },
@ -628,6 +634,11 @@ void MenuDefinition::read(Lexer & lex)
add(MenuItem(MenuItem::CiteStyles));
break;
case md_infoarguments:
add(MenuItem(MenuItem::InfoArguments));
break;
case md_graphicsgroups:
add(MenuItem(MenuItem::GraphicsGroups));
break;
@ -1654,6 +1665,44 @@ void MenuDefinition::expandCiteStyles(BufferView const * bv)
}
void MenuDefinition::expandInfoArguments(BufferView const * bv)
{
if (!bv)
return;
Inset const * inset = bv->cursor().nextInset();
if (!inset || inset->lyxCode() != INFO_CODE) {
add(MenuItem(MenuItem::Command,
qt_("No Text Field in Scope!"),
FuncRequest(LFUN_NOACTION)));
return;
}
InsetInfo const * iinset = static_cast<InsetInfo const *>(inset);
string const type = iinset->infoType();
vector<pair<string,docstring>> const args = iinset->getArguments(type);
// Don't generate a menu for big lists (such as lfuns and rcs)
if (args.size() > 15)
return;
for (auto const & p : args) {
if (p.first == "invalid")
// non-selectable
continue;
if (p.first == "custom") {
add(MenuItem(MenuItem::Command, qt_("Custom..."),
FuncRequest(LFUN_INSET_SETTINGS, "info")));
continue;
}
docstring label = p.second;
addWithStatusCheck(MenuItem(MenuItem::Command, toqstr(label),
FuncRequest(LFUN_INSET_MODIFY, type + " " + p.first)));
}
}
void MenuDefinition::expandArguments(BufferView const * bv, bool switcharg)
{
if (!bv)
@ -2306,6 +2355,11 @@ void Menus::Impl::expand(MenuDefinition const & frommenu,
tomenu.expandCiteStyles(bv);
break;
case MenuItem::InfoArguments:
tomenu.expandInfoArguments(bv);
break;
case MenuItem::Toc:
tomenu.expandToc(buf);
break;

View File

@ -17,9 +17,6 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QListWidget" name="infoLW"/>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -41,7 +38,31 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QListWidget" name="infoLW"/>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="fixDateLA">
<property name="text">
<string>Fix Date:</string>
</property>
<property name="buddy">
<cstring>fixDateLE</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fixDateLE">
<property name="toolTip">
<string>Here you can enter a fix date (in ISO format: YYYY-MM-DD)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="nameLA">

View File

@ -4,6 +4,7 @@
* Licence details can be found in the file COPYING.
*
* \author Bo Peng
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
@ -52,6 +53,8 @@
#include <sstream>
#include <QtGui/QImage>
#include <QDate>
#include <QLocale>
using namespace std;
using namespace lyx::support;
@ -76,6 +79,9 @@ NameTranslator const initTranslator()
translator.addPair(InsetInfo::BUFFER_INFO, "buffer");
translator.addPair(InsetInfo::LYX_INFO, "lyxinfo");
translator.addPair(InsetInfo::VCS_INFO, "vcs");
translator.addPair(InsetInfo::DATE_INFO, "date");
translator.addPair(InsetInfo::MODDATE_INFO, "moddate");
translator.addPair(InsetInfo::FIXDATE_INFO, "fixdate");
return translator;
}
@ -87,6 +93,37 @@ NameTranslator const & nameTranslator()
return translator;
}
typedef Translator<InsetInfo::info_type, string> DefaultValueTranslator;
DefaultValueTranslator const initDVTranslator()
{
DefaultValueTranslator translator(InsetInfo::UNKNOWN_INFO, "");
translator.addPair(InsetInfo::SHORTCUTS_INFO, "info-insert");
translator.addPair(InsetInfo::SHORTCUT_INFO, "info-insert");
translator.addPair(InsetInfo::LYXRC_INFO, "user_name");
translator.addPair(InsetInfo::PACKAGE_INFO, "graphics");
translator.addPair(InsetInfo::TEXTCLASS_INFO, "article");
translator.addPair(InsetInfo::MENU_INFO, "info-insert");
translator.addPair(InsetInfo::ICON_INFO, "info-insert");
translator.addPair(InsetInfo::BUFFER_INFO, "name");
translator.addPair(InsetInfo::LYX_INFO, "version");
translator.addPair(InsetInfo::VCS_INFO, "revision");
translator.addPair(InsetInfo::DATE_INFO, "loclong");
translator.addPair(InsetInfo::MODDATE_INFO, "loclong");
translator.addPair(InsetInfo::FIXDATE_INFO, "loclong");
return translator;
}
/// The translator between the information type enum and some sensible default value.
DefaultValueTranslator const & defaultValueTranslator()
{
static DefaultValueTranslator const translator = initDVTranslator();
return translator;
}
} // namespace
/////////////////////////////////////////////////////////////////////////
@ -183,6 +220,15 @@ docstring InsetInfo::toolTip(BufferView const &, int, int) const
case LYX_INFO:
result = _("The current LyX version");
break;
case DATE_INFO:
result = _("The current date");
break;
case MODDATE_INFO:
result = _("The date of last save");
break;
case FIXDATE_INFO:
result = _("A static date");
break;
}
return result;
@ -224,7 +270,7 @@ void InsetInfo::write(ostream & os) const
bool InsetInfo::validateModifyArgument(docstring const & arg) const
{
string type;
string const name = trim(split(to_utf8(arg), type, ' '));
string name = trim(split(to_utf8(arg), type, ' '));
switch (nameTranslator().find(type)) {
case UNKNOWN_INFO:
@ -266,6 +312,26 @@ bool InsetInfo::validateModifyArgument(docstring const & arg) const
case LYX_INFO:
return name == "version";
case FIXDATE_INFO: {
string date;
string piece;
date = split(name, piece, '@');
if (!date.empty() && !QDate::fromString(toqstr(date), Qt::ISODate).isValid())
return false;
if (!piece.empty())
name = piece;
}
// fall through
case DATE_INFO:
case MODDATE_INFO: {
if (name == "long" || name == "short" || name == "ISO")
return true;
else {
QDate date = QDate::currentDate();
return !date.toString(toqstr(name)).isEmpty();
}
}
}
return false;
@ -299,6 +365,28 @@ set<string> getTexFileList(string const & filename)
} // namespace anon
docstring InsetInfo::getDate(string const name, QDate const date) const
{
QLocale loc;
if (lang_)
loc = QLocale(toqstr(lang_->code()));
if (name == "long")
return qstring_to_ucs4(loc.toString(date, QLocale::LongFormat));
else if (name == "short")
return qstring_to_ucs4(loc.toString(date, QLocale::ShortFormat));
else if (name == "ISO")
return qstring_to_ucs4(date.toString(Qt::ISODate));
else if (name == "loclong")
return qstring_to_ucs4(loc.toString(date, toqstr(lang_->dateFormat(0))));
else if (name == "locmedium")
return qstring_to_ucs4(loc.toString(date, toqstr(lang_->dateFormat(1))));
else if (name == "locshort")
return qstring_to_ucs4(loc.toString(date, toqstr(lang_->dateFormat(2))));
else
return qstring_to_ucs4(loc.toString(date, toqstr(name)));
}
vector<pair<string,docstring>> InsetInfo::getArguments(string const & type) const
{
vector<pair<string,docstring>> result;
@ -364,6 +452,31 @@ vector<pair<string,docstring>> InsetInfo::getArguments(string const & type) cons
case LYX_INFO:
result.push_back(make_pair("version", _("LyX version")));
break;
case FIXDATE_INFO:
case DATE_INFO:
case MODDATE_INFO:
string const dt = split(name_, '@');
QDate date;
if (type == "moddate")
date = QDateTime::fromTime_t(buffer().fileName().lastModified()).date();
else if (type == "fixdate" && !dt.empty())
date = QDate::fromString(toqstr(dt), Qt::ISODate);
else
date = QDate::currentDate();
result.push_back(make_pair("long",getDate("long", date)));
result.push_back(make_pair("short", getDate("short", date)));
result.push_back(make_pair("loclong", getDate("loclong", date)));
result.push_back(make_pair("locmedium", getDate("locmedium", date)));
result.push_back(make_pair("locshort", getDate("locshort", date)));
result.push_back(make_pair("ISO", getDate("ISO", date)));
result.push_back(make_pair("yyyy", getDate("yyyy", date)));
result.push_back(make_pair("MMMM", getDate("MMMM", date)));
result.push_back(make_pair("MMM", getDate("MMM", date)));
result.push_back(make_pair("dddd", getDate("dddd", date)));
result.push_back(make_pair("ddd", getDate("ddd", date)));
result.push_back(make_pair("custom", _("Custom")));
break;
}
return result;
@ -392,6 +505,13 @@ bool InsetInfo::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_INSET_MODIFY:
if (validateModifyArgument(cmd.argument())) {
flag.setEnabled(true);
string typestr;
string name = trim(split(to_utf8(cmd.argument()), typestr, ' '));
info_type type = nameTranslator().find(typestr);
string origname = name_;
if (type == FIXDATE_INFO)
split(name_, origname, '@');
flag.setOnOff(type == type_ && name == origname);
return true;
}
//fall through
@ -437,10 +557,29 @@ void InsetInfo::setInfo(string const & name)
{
if (name.empty())
return;
string saved_date_specifier;
// Store old date specifier for potential re-use
if (!name_.empty())
saved_date_specifier = split(name_, '@');
// info_type name
string type;
name_ = trim(split(name, type, ' '));
type_ = nameTranslator().find(type);
if (name_.empty())
name_ = defaultValueTranslator().find(type_);
if (type_ == FIXDATE_INFO) {
string const date_specifier = split(name_, '@');
// If an explicit new fix date is specified, use that
// Otherwise, use the old one or, if there is none,
// the current date
if (date_specifier.empty()) {
if (saved_date_specifier.empty())
name_ += "@" + fromqstr(QDate::currentDate().toString(Qt::ISODate));
else
name_ += "@" + saved_date_specifier;
}
}
}
@ -480,18 +619,18 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
return;
BufferParams const & bp = buffer().params();
Language const * lang = it.paragraph().getFontSettings(bp, it.pos()).language();
lang_ = it.paragraph().getFontSettings(bp, it.pos()).language();
Language const * tryguilang = languages.getFromCode(Messages::guiLanguage());
// Some info insets use the language of the GUI (if available)
Language const * guilang = tryguilang ? tryguilang : lang;
Language const * guilang = tryguilang ? tryguilang : lang_;
force_ltr_ = !lang->rightToLeft();
force_ltr_ = !lang_->rightToLeft();
// This is just to get the string into the po files
docstring gui;
switch (type_) {
case UNKNOWN_INFO:
gui = _("Unknown Info!");
info(from_ascii("Unknown Info!"), lang);
info(from_ascii("Unknown Info!"), lang_);
initialized_ = false;
break;
case SHORTCUT_INFO:
@ -500,20 +639,20 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
FuncRequest const func = lyxaction.lookupFunc(name_);
if (func.action() == LFUN_UNKNOWN_ACTION) {
gui = _("Unknown action %1$s");
error(from_ascii("Unknown action %1$s"), lang);
error(from_ascii("Unknown action %1$s"), lang_);
break;
}
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func);
if (bindings.empty()) {
gui = _("undefined");
info(from_ascii("undefined"), lang);
info(from_ascii("undefined"), lang_);
break;
}
if (type_ == SHORTCUT_INFO)
setText(bindings.begin()->print(KeySequence::ForGui), guilang);
else
setText(theTopLevelKeymap().printBindings(func, KeySequence::ForGui), guilang);
force_ltr_ = !guilang->rightToLeft() && !lang->rightToLeft();
force_ltr_ = !guilang->rightToLeft() && !lang_->rightToLeft();
break;
}
case LYXRC_INFO: {
@ -522,7 +661,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
ostringstream oss;
if (name_.empty()) {
gui = _("undefined");
info(from_ascii("undefined"), lang);
info(from_ascii("undefined"), lang_);
break;
}
// FIXME this uses the serialization mechanism to get the info
@ -531,7 +670,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
string result = oss.str();
if (result.size() < 2) {
gui = _("undefined");
info(from_ascii("undefined"), lang);
info(from_ascii("undefined"), lang_);
break;
}
string::size_type loc = result.rfind("\n", result.size() - 2);
@ -539,7 +678,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
if (result.size() < loc + name_.size() + 1
|| result.substr(loc + 1, name_.size()) != name_) {
gui = _("undefined");
info(from_ascii("undefined"), lang);
info(from_ascii("undefined"), lang_);
break;
}
// remove leading comments and \\name and space
@ -548,7 +687,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
// remove \n and ""
result = rtrim(result, "\n");
result = trim(result, "\"");
setText(from_utf8(result), lang);
setText(from_utf8(result), lang_);
break;
}
case PACKAGE_INFO:
@ -558,10 +697,10 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
// check in packages.lst
if (LaTeXFeatures::isAvailable(name_)) {
gui = _("yes");
info(from_ascii("yes"), lang);
info(from_ascii("yes"), lang_);
} else {
gui = _("no");
info(from_ascii("no"), lang);
info(from_ascii("no"), lang_);
}
initialized_ = true;
break;
@ -575,10 +714,10 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
available = list[name_].isTeXClassAvailable();
if (available) {
gui = _("yes");
info(from_ascii("yes"), lang);
info(from_ascii("yes"), lang_);
} else {
gui = _("no");
info(from_ascii("no"), lang);
info(from_ascii("no"), lang_);
}
break;
}
@ -592,18 +731,18 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
FuncRequest const func = lyxaction.lookupFunc(name_);
if (func.action() == LFUN_UNKNOWN_ACTION) {
gui = _("Unknown action %1$s");
error(from_ascii("Unknown action %1$s"), lang);
error(from_ascii("Unknown action %1$s"), lang_);
break;
}
// iterate through the menubackend to find it
if (!theApp()) {
gui = _("Can't determine menu entry for action %1$s in batch mode");
error(from_ascii("Can't determine menu entry for action %1$s in batch mode"), lang);
error(from_ascii("Can't determine menu entry for action %1$s in batch mode"), lang_);
break;
}
if (!theApp()->searchMenu(func, names)) {
gui = _("No menu entry for action %1$s");
error(from_ascii("No menu entry for action %1$s"), lang);
error(from_ascii("No menu entry for action %1$s"), lang_);
break;
}
// if found, return its path.
@ -673,7 +812,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
igp.width = Length(1, Length::EM);
inset->setParams(igp);
clear();
Font const f(inherit_font, lang);
Font const f(inherit_font, lang_);
paragraphs().front().insertInset(0, inset, f,
Change(Change::UNCHANGED));
break;
@ -681,11 +820,11 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
case BUFFER_INFO: {
// this could all change, so we will recalculate each time
if (name_ == "name")
setText(from_utf8(buffer().fileName().onlyFileName()), lang);
setText(from_utf8(buffer().fileName().onlyFileName()), lang_);
else if (name_ == "path")
setText(from_utf8(os::latex_path(buffer().filePath())), lang);
setText(from_utf8(os::latex_path(buffer().filePath())), lang_);
else if (name_ == "class")
setText(from_utf8(bp.documentClass().name()), lang);
setText(from_utf8(bp.documentClass().name()), lang_);
break;
}
case VCS_INFO: {
@ -693,7 +832,7 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
// recalculate each time through
if (!buffer().lyxvc().inUse()) {
gui = _("No version control!");
info(from_ascii("No version control!"), lang);
info(from_ascii("No version control!"), lang_);
break;
}
LyXVC::RevisionInfo itype = LyXVC::Unknown;
@ -710,9 +849,9 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
string binfo = buffer().lyxvc().revisionInfo(itype);
if (binfo.empty()) {
gui = _("%1$s[[vcs data]] unknown");
error(from_ascii("%1$s[[vcs data]] unknown"), lang);
error(from_ascii("%1$s[[vcs data]] unknown"), lang_);
} else
setText(from_utf8(binfo), lang);
setText(from_utf8(binfo), lang_);
break;
}
case LYX_INFO:
@ -720,9 +859,24 @@ void InsetInfo::updateBuffer(ParIterator const & it, UpdateType utype) {
if (initialized_)
break;
if (name_ == "version")
setText(from_ascii(lyx_version), lang);
setText(from_ascii(lyx_version), lang_);
initialized_ = true;
break;
case DATE_INFO:
case MODDATE_INFO:
case FIXDATE_INFO: {
string date_format = name_;
string const date_specifier = (type_ == FIXDATE_INFO && contains(name_, '@'))
? split(name_, date_format, '@') : string();
QDate date;
if (type_ == MODDATE_INFO)
date = QDateTime::fromTime_t(buffer().fileName().lastModified()).date();
else if (type_ == FIXDATE_INFO && !date_specifier.empty())
date = QDate::fromString(toqstr(date_specifier), Qt::ISODate);
else
date = QDate::currentDate();
setText(getDate(date_format, date), lang_);
}
}
// Just to do something with that string
LYXERR(Debug::INFO, "info inset text: " << gui);

View File

@ -13,6 +13,7 @@
#define INSET_INFO_H
#include "InsetCollapsible.h"
#include <QDate>
namespace lyx {
@ -32,10 +33,26 @@ screen and latex output is the content of the information. An InsetInfo can
have type "shortcuts", "shortcut", "lyxrc", "package", "textclass", "menu",
"buffer" or "vcs". Arguments and outputs vary by type.
shortcuts: argument of this type of InsetInfo is the name of the LFUN such as
"math-insert \alpha". The syntax is the same as what is used in the bind
and ui files. The output of this inset is all shortcuts for this LFUN
separated by comma.
date: argument of this type of InsetInfo is either a fixed date type of
"long" (long localized date, with weekday, as provided by QLocale),
"short" (short localized date, with two-digit year, as provided by QLocale),
"loclong" (long localized date, without weekday, defined in languages),
"locmedium" (medium localized date, defined in languages),
"locshort" (short localized date, with four-digit year, defined in languages),
"ISO" (ISO-conforming date)
or a custom date using the QDate syntax.
The output is a localized formatted (current) date.
moddate: Same as date.
The output is a localized formatted date of last file modification (saving).
fixdate: Same as date. A fixed date (in ISO format) is prepended to the argument,
delimited by '@'.
The output is a localized formatted fix date.
shortcuts: argument is the name of the LFUN such as "math-insert \alpha".
The syntax is the same as what is used in the bind and ui files.
The output of this inset is all shortcuts for this LFUN separated by comma.
shortcut: the same as shortcuts, but only output the last shortcut.
@ -83,17 +100,20 @@ the command buffer (view->Toolbar->Command Buffer).
class InsetInfo : public InsetCollapsible {
public:
enum info_type {
BUFFER_INFO, // Buffer related information
DATE_INFO, // Current Date
MODDATE_INFO, // Date of last modification
FIXDATE_INFO, // Fix date
BUFFER_INFO, // Buffer related information
VCS_INFO, // Version control information
PACKAGE_INFO, // Availability of package
TEXTCLASS_INFO, // Availability of textclass
SHORTCUTS_INFO, // Keyboard shortcuts
SHORTCUT_INFO, // Keyboard shortcut
LYXRC_INFO, // RC entry
MENU_INFO, // Which menu item is used for certain function
ICON_INFO, // which toolbar icon is used for certain function
PACKAGE_INFO, // Availability of package
TEXTCLASS_INFO, // Availability of textclass
SHORTCUTS_INFO, // Keyboard shortcuts
SHORTCUT_INFO, // Keyboard shortcut
LYXRC_INFO, // RC entry
MENU_INFO, // Which menu item is used for certain function
ICON_INFO, // which toolbar icon is used for certain function
LYX_INFO, // LyX version information
UNKNOWN_INFO, // Invalid type
UNKNOWN_INFO, // Invalid type
};
///
@ -155,6 +175,8 @@ private:
void info(docstring const & err, Language const *);
///
void setText(docstring const & str, Language const *);
///
docstring getDate(std::string const, QDate const date = QDate::currentDate()) const;
// make sure that the other version of setText is still available.
using InsetCollapsible::setText;
///
@ -165,6 +187,8 @@ private:
std::string name_;
///
bool force_ltr_;
///
Language const * lang_;
};

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 558 // kornel: frontmatter in elsarticle.layout
#define LYX_FORMAT_TEX2LYX 558
#define LYX_FORMAT_LYX 559 // spitz: date info insets
#define LYX_FORMAT_TEX2LYX 559
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER