mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
Update file format for unicode
* src/buffer.C (LYX_FORMAT): update * src/bufferparams.h (inputenc): document * lib/lyx2lyx/LyX.py (format_relation): last format is now 249 (get_encoding): return utf8 for formats > 248 * lib/lyx2lyx/lyx_1_5.py (convert_utf8): don't change \inputencoding anymore (revert_utf8): new, revert encoding if possible * development/FORMAT: describe format 249 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14684 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
575ae4a8d7
commit
9245b426b3
@ -1,6 +1,21 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2006-08-14 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* format incremented to 249: Unicode
|
||||
|
||||
LyX documents are now always encoded in utf8. The value of
|
||||
\inputencoding does now only determine the encoding of the created
|
||||
LaTeX file.
|
||||
Up to format 248 the value of \inputencoding did also determine the
|
||||
encoding of the LyX file:
|
||||
|
||||
\inputencoding LyX file encoding
|
||||
auto as determined by the document language
|
||||
default latin1
|
||||
everything else as determined by \inputencoding
|
||||
|
||||
2006-07-03 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* format incremented to 248: Basic booktabs support
|
||||
|
@ -73,7 +73,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)),
|
||||
("1_2", [220], generate_minor_versions("1.2" , 4)),
|
||||
("1_3", [221], generate_minor_versions("1.3" , 7)),
|
||||
("1_4", range(222,246), generate_minor_versions("1.4" , 3)),
|
||||
("1_5", range(246,249), generate_minor_versions("1.5" , 0))]
|
||||
("1_5", range(246,250), generate_minor_versions("1.5" , 0))]
|
||||
|
||||
|
||||
def formats_list():
|
||||
@ -108,7 +108,9 @@ def trim_eol(line):
|
||||
return line[:-1]
|
||||
|
||||
|
||||
def get_encoding(language, inputencoding):
|
||||
def get_encoding(language, inputencoding, format):
|
||||
if format > 248:
|
||||
return "utf8"
|
||||
from lyx2lyx_lang import lang
|
||||
if inputencoding == "auto":
|
||||
return lang[language][3]
|
||||
@ -224,7 +226,7 @@ class LyX_Base:
|
||||
self.format = self.read_format()
|
||||
self.language = get_value(self.header, "\\language", 0, default = "english")
|
||||
self.inputencoding = get_value(self.header, "\\inputencoding", 0, default = "auto")
|
||||
self.encoding = get_encoding(self.language, self.inputencoding)
|
||||
self.encoding = get_encoding(self.language, self.inputencoding, self.format)
|
||||
self.initial_version = self.read_version()
|
||||
|
||||
# Second pass over header and preamble, now we know the file encoding
|
||||
@ -246,7 +248,7 @@ class LyX_Base:
|
||||
self.set_version()
|
||||
self.set_format()
|
||||
if self.encoding == "auto":
|
||||
self.encoding = get_encoding(self.language, self.encoding)
|
||||
self.encoding = get_encoding(self.language, self.encoding, self.format)
|
||||
|
||||
if self.preamble:
|
||||
i = find_token(self.header, '\\textclass', 0) + 1
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
import re
|
||||
from parser_tools import find_token, find_token_exact, find_tokens, find_end_of, get_value
|
||||
from LyX import get_encoding
|
||||
|
||||
|
||||
####################################################################
|
||||
@ -217,13 +218,18 @@ def revert_booktabs(document):
|
||||
|
||||
|
||||
def convert_utf8(document):
|
||||
document.encoding = "utf8"
|
||||
|
||||
|
||||
def revert_utf8(document):
|
||||
i = find_token(document.header, "\\inputencoding", 0)
|
||||
if i == -1:
|
||||
document.header.append("\\inputencoding utf-8")
|
||||
else:
|
||||
document.header[i] = "\\inputencoding utf-8"
|
||||
document.inputencoding = "utf-8"
|
||||
document.encoding = "utf-8"
|
||||
document.header.append("\\inputencoding auto")
|
||||
elif get_value(document.header, "\\inputencoding", i) == "utf8":
|
||||
document.header[i] = "\\inputencoding auto"
|
||||
document.inputencoding = get_value(document.header, "\\inputencoding", 0)
|
||||
document.encoding = get_encoding(document.language, document.inputencoding, 248)
|
||||
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
@ -232,11 +238,11 @@ def convert_utf8(document):
|
||||
supported_versions = ["1.5.0","1.5"]
|
||||
convert = [[246, []],
|
||||
[247, [convert_font_settings]],
|
||||
[248, []]
|
||||
# ,[xxx, [convert_utf8]] uncomment to support convertion to utf-8
|
||||
]
|
||||
[248, []],
|
||||
[249, [convert_utf8]]]
|
||||
|
||||
revert = [[247, [revert_booktabs]],
|
||||
revert = [[248, [revert_utf8]],
|
||||
[247, [revert_booktabs]],
|
||||
[246, [revert_font_settings]],
|
||||
[245, [revert_framed]]]
|
||||
|
||||
|
@ -146,7 +146,7 @@ extern BufferList bufferlist;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 248;
|
||||
int const LYX_FORMAT = 249;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
@ -175,7 +175,15 @@ public:
|
||||
/// BranchList:
|
||||
BranchList & branchlist();
|
||||
BranchList const & branchlist() const;
|
||||
///
|
||||
/**
|
||||
* The input encoding for LaTeX. This can be one of
|
||||
* - auto: find out the input encoding from the used languages
|
||||
* - default: Don't load the inputenc package and hope that it will
|
||||
* work (unlikely)
|
||||
* - any encoding supported by the inputenc package
|
||||
* The encoding of the LyX file is always utf8 and has nothing to
|
||||
* do with this setting.
|
||||
*/
|
||||
std::string inputenc;
|
||||
///
|
||||
std::string preamble;
|
||||
|
Loading…
Reference in New Issue
Block a user