Fix encoding in aa class, which is preset via class options

Hook into nearby file format change.
This commit is contained in:
Juergen Spitzmueller 2019-08-30 08:09:57 +02:00
parent 9efa348232
commit 54fd0a70f4
3 changed files with 58 additions and 4 deletions

View File

@ -160,12 +160,15 @@ changes happened in particular if possible. A good example would be
This builds on an extension of the natbib CiteEngine by tufte.
2018-05-10 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 552: support for float alignment
Format incremented to 552:
* support for float alignment
- add buffer param \float_alignment [class|left|center|right]
- add buffer param \float_placement class
- add float param alignment [class|document|left|center|right]
- add float param placement class (=> new param)
- add float param placement document(=> like formerly empty param)
* adapt class options in aa class documents to latin9 > utf8 default
encoding change.
2018-05-06 Jürgen Spitzmüller <spitz@lyx.org>
* format incremented to 551: add font info param \nospellcheck that prevents

View File

@ -30,7 +30,7 @@ Provides inputenc 1
Provides natbib 1
ClassOptions
Other latin9
Other utf8
End
Style Standard

View File

@ -792,6 +792,57 @@ def revert_tuftecite(document):
i = j
def convert_aaencoding(document):
" Convert default document option due to encoding change in aa class. "
if document.textclass != "aa":
return
i = 0
i = find_token(document.header, "\\use_default_options true", i)
if i == -1:
return
j = find_token(document.header, "\\inputencoding", 0)
if j == -1:
document.warning("Malformed LyX Document! Missing \\inputencoding header.")
return
val = get_value(document.header, "\\inputencoding", j)
if val == "auto" or val == "latin9":
document.header[i] = "\\use_default_options false"
k = find_token(document.header, "\\options", 0)
if k == -1:
document.header.insert(i, "\\options latin9")
else:
document.header[k] = document.header[k] + ",latin9"
def revert_aaencoding(document):
" Revert default document option due to encoding change in aa class. "
if document.textclass != "aa":
return
i = 0
i = find_token(document.header, "\\use_default_options true", i)
if i == -1:
return
j = find_token(document.header, "\\inputencoding", 0)
if j == -1:
document.warning("Malformed LyX Document! Missing \\inputencoding header.")
return
val = get_value(document.header, "\\inputencoding", j)
if val == "utf8":
document.header[i] = "\\use_default_options false"
k = find_token(document.header, "\\options", 0)
if k == -1:
document.header.insert(i, "\\options utf8")
else:
document.header[k] = document.header[k] + ",utf8"
def revert_stretchcolumn(document):
" We remove the column varwidth flags or everything else will become a mess. "
i = 0
@ -3598,7 +3649,7 @@ convert = [
[549, []],
[550, [convert_fontenc]],
[551, []],
[552, []],
[552, [convert_aaencoding]],
[553, []],
[554, []],
[555, []],
@ -3675,7 +3726,7 @@ revert = [[588, [revert_totalheight]],
[554, [revert_vcolumns]],
[553, [revert_stretchcolumn]],
[552, [revert_tuftecite]],
[551, [revert_floatpclass, revert_floatalignment]],
[551, [revert_floatpclass, revert_floatalignment, revert_aaencoding]],
[550, [revert_nospellcheck]],
[549, [revert_fontenc]],
[548, []],# dummy format change