Simplify storage of html_latex_* info.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34491 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-05-24 19:34:43 +00:00
parent 07d0ccfdc7
commit b174e5616e
4 changed files with 51 additions and 7 deletions

View File

@ -7,6 +7,9 @@ The good example would be 2010-01-10 entry.
-----------------------
2010-05-24 Richard Heck <rgheck@comcast.net>
* Format incremented to 389: remove quotes from html_latex_* params.
2010-05-18 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 388: support for page sizes A0-3, A6, B0-3, B6
and JIS B0-6

View File

@ -1540,6 +1540,43 @@ def revert_pagesizes(document):
del document.header[i]
def convert_html_quotes(document):
" Remove quotes around html_latex_start and html_latex_end "
i = find_token(document.header, '\\html_latex_start', 0)
if i != -1:
line = document.header[i]
l = re.compile(r'\\html_latex_start\s+"(.*)"')
m = l.match(line)
if m != None:
document.header[i] = "\\html_latex_start " + m.group(1)
i = find_token(document.header, '\\html_latex_end', 0)
if i != -1:
line = document.header[i]
l = re.compile(r'\\html_latex_end\s+"(.*)"')
m = l.match(line)
if m != None:
document.header[i] = "\\html_latex_end " + m.group(1)
def revert_html_quotes(document):
" Remove quotes around html_latex_start and html_latex_end "
i = find_token(document.header, '\\html_latex_start', 0)
if i != -1:
line = document.header[i]
l = re.compile(r'\\html_latex_start\s+(.*)')
m = l.match(line)
document.header[i] = "\\html_latex_start \"" + m.group(1) + "\""
i = find_token(document.header, '\\html_latex_end', 0)
if i != -1:
line = document.header[i]
l = re.compile(r'\\html_latex_end\s+(.*)')
m = l.match(line)
document.header[i] = "\\html_latex_end \"" + m.group(1) + "\""
##
# Conversion hub
#
@ -1588,9 +1625,11 @@ convert = [[346, []],
[386, []],
[387, []],
[388, []],
]
[389, [convert_html_quotes]]
]
revert = [[387, [revert_pagesizes]],
revert = [[388, [revert_html_quotes]],
[387, [revert_pagesizes]],
[386, [revert_math_scale]],
[385, [revert_lyx_version]],
[384, [revert_shadedboxcolor]],

View File

@ -126,7 +126,7 @@ namespace {
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
int const LYX_FORMAT = 388; // uwestoehr: support for more page sizes
int const LYX_FORMAT = 389; // rgh: change how html_latex_* is stored
typedef map<string, bool> DepClean;
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;

View File

@ -831,9 +831,11 @@ string BufferParams::readToken(Lexer & lex, string const & token,
} else if (token == "\\html_math_img_scale") {
lex >> html_math_img_scale;
} else if (token == "\\html_latex_start") {
lex >> html_latex_start;
lex.eatLine();
html_latex_start = lex.getString();
} else if (token == "\\html_latex_end") {
lex >> html_latex_end;
lex.eatLine();
html_latex_end = lex.getString();
} else {
lyxerr << "BufferParams::readToken(): Unknown token: " <<
token << endl;
@ -1056,8 +1058,8 @@ void BufferParams::writeFile(ostream & os) const
<< "\\html_math_output " << html_math_output << '\n'
<< "\\html_be_strict " << convert<string>(html_be_strict) << '\n'
<< "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n'
<< "\\html_latex_start \"" << html_latex_start << "\"\n"
<< "\\html_latex_end \"" << html_latex_end << "\"\n";
<< "\\html_latex_start " << html_latex_start << "\n"
<< "\\html_latex_end " << html_latex_end << "\n";
os << pimpl_->authorlist;
}