mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
place one paragraph parameter per line. (file format = 239)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9450 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7ab15b2e0c
commit
953984e3da
@ -1,26 +1,43 @@
|
||||
LyX file-format changes
|
||||
-----------------------
|
||||
|
||||
2005-01-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* format incremented to 239.
|
||||
* the paragraph parameters are displayed in their own line. This
|
||||
change is consistent with the insets behaviour, and corresponds
|
||||
to a more uniform treatment of the paragraphs since some of them
|
||||
had already their own line.
|
||||
|
||||
An example of a single paragraph follows:
|
||||
|
||||
\begin_layout Standard
|
||||
\paragraph_spacing single
|
||||
\align left
|
||||
Paragraph text.
|
||||
\end_layout
|
||||
|
||||
|
||||
2004-12-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* format up to 238.
|
||||
* The compatibility code to read old latex accents from 0.12.x in
|
||||
InsetLatexAccent::checkContents has been removed.
|
||||
The following translations are done:
|
||||
"\i \x" -> "\i \x{}"
|
||||
"\i \xy" -> "\i \x{y}"
|
||||
"\i \x y" -> "\i \x{y}"
|
||||
"\i \x\i" -> "\i \x{\i}"
|
||||
"\i \x\j" -> "\i \x{\j}"
|
||||
x is a latex accent command, y the base character. \, i and j are
|
||||
literal.
|
||||
lyx did these changes already from 0.12.x -> 215, but not lyx2lyx,
|
||||
so formats 215 - 237 can have both versions.
|
||||
* format incremented to 238.
|
||||
* The compatibility code to read old latex accents from 0.12.x in
|
||||
InsetLatexAccent::checkContents has been removed.
|
||||
The following translations are done:
|
||||
"\i \x" -> "\i \x{}"
|
||||
"\i \xy" -> "\i \x{y}"
|
||||
"\i \x y" -> "\i \x{y}"
|
||||
"\i \x\i" -> "\i \x{\i}"
|
||||
"\i \x\j" -> "\i \x{\j}"
|
||||
x is a latex accent command, y the base character. \, i and j are
|
||||
literal.
|
||||
lyx did these changes already from 0.12.x -> 215, but not lyx2lyx,
|
||||
so formats 215 - 237 can have both versions.
|
||||
|
||||
|
||||
2004-10-10 José Matos <jamatos@lyx.org>
|
||||
|
||||
* format up to 237.
|
||||
* format incremented to 237.
|
||||
* In the header, the following statments use now booleans values,
|
||||
instead of 0, 1:
|
||||
- \use_geometry
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-01-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_1_4.py (normalize_paragraph_params): update file format to 239.
|
||||
|
||||
* LyX.py (convert): simplify code and add running times
|
||||
information for higher debug levels.
|
||||
|
||||
2005-01-04 José Matos <jamatos@lyx.org>
|
||||
|
||||
* lyx_0_12.py:
|
||||
|
@ -16,12 +16,14 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
from parser_tools import get_value, check_token, find_token, find_tokens, find_end_of, find_end_of_inset
|
||||
from parser_tools import get_value, check_token, find_token,\
|
||||
find_tokens, find_end_of, find_end_of_inset
|
||||
import os.path
|
||||
import gzip
|
||||
import sys
|
||||
import re
|
||||
import string
|
||||
import time
|
||||
|
||||
version_lyx2lyx = "1.4.0cvs"
|
||||
default_debug_level = 2
|
||||
@ -44,7 +46,7 @@ format_relation = [("0_10", [210], ["0.10.7","0.10"]),
|
||||
("1_1_6fix3", [218], ["1.1.6fix3","1.1.6fix4","1.1"]),
|
||||
("1_2", [220], ["1.2.0","1.2.1","1.2.3","1.2.4","1.2"]),
|
||||
("1_3", [221], ["1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3"]),
|
||||
("1_4", range(223,239), ["1.4.0cvs","1.4"])]
|
||||
("1_4", range(223,240), ["1.4.0cvs","1.4"])]
|
||||
|
||||
|
||||
def formats_list():
|
||||
@ -267,23 +269,23 @@ class LyX_Base:
|
||||
for step in convertion_chain:
|
||||
steps = getattr(__import__("lyx_" + step), mode)
|
||||
|
||||
self.warning("Convertion step: %s - %s" % (step, mode), default_debug_level + 1)
|
||||
if not steps:
|
||||
self.error("The convertion to an older format (%s) is not implemented." % self.format)
|
||||
|
||||
if len(steps) == 1:
|
||||
version, table = steps[0]
|
||||
for conv in table:
|
||||
conv(self)
|
||||
self.format = version
|
||||
continue
|
||||
|
||||
multi_conv = len(steps) != 1
|
||||
for version, table in steps:
|
||||
if self.format >= version and mode == "convert":
|
||||
continue
|
||||
if self.format <= version and mode == "revert":
|
||||
if multi_conv and \
|
||||
(self.format >= version and mode == "convert") or\
|
||||
(self.format <= version and mode == "revert"):
|
||||
continue
|
||||
|
||||
for conv in table:
|
||||
init_t = time.time()
|
||||
conv(self)
|
||||
self.warning("%lf: Elapsed time on %s" % (time.time() - init_t, str(conv)),
|
||||
default_debug_level + 1)
|
||||
|
||||
self.format = version
|
||||
if self.end_format == self.format:
|
||||
return
|
||||
|
@ -1507,6 +1507,32 @@ def use_x_binary(file):
|
||||
decompose = split(file.header[i])
|
||||
file.header[i] = decompose[0] + ' ' + bool2bin[decompose[1]]
|
||||
|
||||
##
|
||||
# Place all the paragraph parameters in their own line
|
||||
#
|
||||
def normalize_paragraph_params(file):
|
||||
body = file.body
|
||||
allowed_parameters = '\\paragraph_spacing', '\\noindent', '\\align', '\\labelwidthstring'
|
||||
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(file.body, '\\begin_layout', i)
|
||||
if i == -1:
|
||||
return
|
||||
|
||||
i = i + 1
|
||||
while 1:
|
||||
if strip(body[i]) and split(body[i])[0] not in allowed_parameters:
|
||||
break
|
||||
|
||||
j = find(body[i],'\\', 1)
|
||||
|
||||
if j != -1:
|
||||
body[i:i+1] = [strip(body[i][:j]), body[i][j:]]
|
||||
|
||||
i = i + 1
|
||||
|
||||
|
||||
##
|
||||
# Convertion hub
|
||||
#
|
||||
@ -1529,9 +1555,11 @@ convert = [[223, [insert_tracking_changes, add_end_header, remove_color_default,
|
||||
[236, [convert_bullets, add_begin_header, add_begin_body,
|
||||
normalize_papersize, strip_end_space]],
|
||||
[237, [use_x_boolean]],
|
||||
[238, [update_latexaccents]]]
|
||||
[238, [update_latexaccents]],
|
||||
[239, [normalize_paragraph_params]]]
|
||||
|
||||
revert = [[237, []],
|
||||
revert = [[238, []],
|
||||
[237, []],
|
||||
[236, [use_x_binary]],
|
||||
[235, [denormalize_papersize, remove_begin_body,remove_begin_header,
|
||||
revert_bullets]],
|
||||
|
@ -1,3 +1,9 @@
|
||||
2005-01-06 José Matos <jamatos@lyx.org>
|
||||
|
||||
* ParagraphParameters.C (write): put every parameter in its own line.
|
||||
* paragraph.C (write): reduce number of consecutive empty lines exported.
|
||||
* buffer.C (LYX_FORMAT): increase file format to 239.
|
||||
|
||||
2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||
|
||||
* everywhere: change support/tostr.h -> support/convert.h
|
||||
@ -184,7 +190,7 @@
|
||||
|
||||
* Makefile.am (BOOST_LIBS): use boost variables
|
||||
|
||||
2004-12-03 José Matos <jamatos@lyx.org>
|
||||
2004-12-03 José Matos <jamatos@lyx.org>
|
||||
|
||||
* buffer.C: format up to 238.
|
||||
|
||||
|
@ -246,28 +246,25 @@ void ParagraphParameters::read(LyXLex & lex)
|
||||
|
||||
void ParagraphParameters::write(ostream & os) const
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
// Maybe the paragraph has special spacing
|
||||
spacing().writeFile(oss, true);
|
||||
spacing().writeFile(os, true);
|
||||
|
||||
// The labelwidth string used in lists.
|
||||
if (!labelWidthString().empty())
|
||||
oss << "\\labelwidthstring "
|
||||
os << "\\labelwidthstring "
|
||||
<< labelWidthString() << '\n';
|
||||
|
||||
// Start of appendix?
|
||||
if (startOfAppendix())
|
||||
oss << "\\start_of_appendix ";
|
||||
os << "\\start_of_appendix\n";
|
||||
|
||||
// Noindent?
|
||||
if (noindent())
|
||||
oss << "\\noindent ";
|
||||
os << "\\noindent\n";
|
||||
|
||||
// Do we have a manual left indent?
|
||||
if (!leftIndent().zero())
|
||||
oss << "\\leftindent " << leftIndent().asString()
|
||||
<< ' ';
|
||||
os << "\\leftindent " << leftIndent().asString() << '\n';
|
||||
|
||||
// Alignment?
|
||||
if (align() != LYX_ALIGN_LAYOUT) {
|
||||
@ -278,9 +275,8 @@ void ParagraphParameters::write(ostream & os) const
|
||||
case LYX_ALIGN_CENTER: h = 3; break;
|
||||
default: h = 0; break;
|
||||
}
|
||||
oss << "\\align " << string_align[h] << ' ';
|
||||
os << "\\align " << string_align[h] << '\n';
|
||||
}
|
||||
os << rtrim(oss.str());
|
||||
}
|
||||
|
||||
|
||||
@ -301,7 +297,7 @@ void params2string(Paragraph const & par, string & data)
|
||||
params.write(os);
|
||||
|
||||
// Is alignment possible
|
||||
os << '\n' << "\\alignpossible " << layout->alignpossible << '\n';
|
||||
os << "\\alignpossible " << layout->alignpossible << '\n';
|
||||
|
||||
/// set default alignment
|
||||
os << "\\aligndefault " << layout->align << '\n';
|
||||
|
@ -136,7 +136,7 @@ extern BufferList bufferlist;
|
||||
|
||||
namespace {
|
||||
|
||||
int const LYX_FORMAT = 238;
|
||||
int const LYX_FORMAT = 239;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
@ -156,10 +156,6 @@ void Paragraph::write(Buffer const & buf, ostream & os,
|
||||
|
||||
int column = 0;
|
||||
for (pos_type i = 0; i < size(); ++i) {
|
||||
if (!i) {
|
||||
os << '\n';
|
||||
column = 0;
|
||||
}
|
||||
|
||||
Change change = pimpl_->lookupChangeFull(i);
|
||||
Changes::lyxMarkChange(os, column, curtime, running_change, change);
|
||||
@ -185,7 +181,9 @@ void Paragraph::write(Buffer const & buf, ostream & os,
|
||||
// the file
|
||||
inset->write(buf, os);
|
||||
} else {
|
||||
os << "\n\\begin_inset ";
|
||||
if (i)
|
||||
os << '\n';
|
||||
os << "\\begin_inset ";
|
||||
inset->write(buf, os);
|
||||
os << "\n\\end_inset\n\n";
|
||||
column = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user