Remove space at end of line, when superfluous.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2004-08-16 11:27:51 +00:00
parent aa48351c52
commit f17505a8fb
25 changed files with 132 additions and 75 deletions

View File

@ -1,3 +1,10 @@
2004-08-16 José Matos <jamatos@lyx.org>
* lyx_1_4.lyx (convert_comment, convert_breaks, convert_frameless_box):
(convert_names, add_begin_body, strip_end_space): use the same policy
of lyx of not using spaces as the last character in a line that starts
with a command token (\xxxxx).
2004-08-15 José Matos <jamatos@lyx.org>
* lyx_1_4.py (normalize_papersize, denormalize_papersize):

View File

@ -1419,10 +1419,10 @@ def add_begin_header(header, opt):
def remove_begin_header(header, opt):
i = find_token(header, "\\begin_header", 0)
i = find_token(header, "\\begin_document", 0)
if i != -1:
del header[i]
i = find_token(header, "\\begin_document", 0)
i = find_token(header, "\\begin_header", 0)
if i != -1:
del header[i]
@ -1432,6 +1432,7 @@ def remove_begin_header(header, opt):
#
def add_begin_body(body, opt):
body.insert(0, '\\begin_body')
body.insert(1, '')
i = find_token(body, "\\end_document", 0)
body.insert(i, '\\end_body')
@ -1439,6 +1440,8 @@ def remove_begin_body(body, opt):
i = find_token(body, "\\begin_body", 0)
if i != -1:
del body[i]
if not body[i]:
del body[i]
i = find_token(body, "\\end_body", 0)
if i != -1:
del body[i]
@ -1470,6 +1473,15 @@ def denormalize_papersize(header):
header[i] = '\\papersize Custom'
##
# Strip spaces at end of command line
#
def strip_end_space(body):
for i in range(len(body)):
if body[i][:1] == '\\':
body[i] = strip(body[i])
##
# Convertion hub
#
@ -1556,6 +1568,7 @@ def convert(file):
add_begin_header(file.header, file)
add_begin_body(file.body, file)
normalize_papersize(file.header)
strip_end_space(file.body)
file.format = 236
def revert(file):
@ -1638,7 +1651,7 @@ def revert(file):
revert_spaces(file.body)
revert_bibtex(file.body)
rm_tracking_changes(file.header)
rm_file.body_changes(file.body)
rm_body_changes(file.body)
file.format = 221

View File

@ -1,3 +1,13 @@
2004-08-16 José Matos <jamatos@lyx.org>
* ParagraphParameters.C (write):
* Spacing.C (writeFile):
* bufferparams.C (writeLaTeX):
* lyx_cb.C (Reconfigure):
* paragraph.C (write):
* tabular.C (write): remove unnecessary space at end of line.
2004-08-16 José Matos <jamatos@lyx.org>
* text.C (readParagraph): remove debug message.

View File

@ -225,25 +225,27 @@ void ParagraphParameters::read(LyXLex & lex)
void ParagraphParameters::write(ostream & os) const
{
ostringstream oss;
// Maybe the paragraph has special spacing
spacing().writeFile(os, true);
spacing().writeFile(oss, true);
// The labelwidth string used in lists.
if (!labelWidthString().empty())
os << "\\labelwidthstring "
oss << "\\labelwidthstring "
<< labelWidthString() << '\n';
// Start of appendix?
if (startOfAppendix())
os << "\\start_of_appendix ";
oss << "\\start_of_appendix ";
// Noindent?
if (noindent())
os << "\\noindent ";
oss << "\\noindent ";
// Do we have a manual left indent?
if (!leftIndent().zero())
os << "\\leftindent " << leftIndent().asString()
oss << "\\leftindent " << leftIndent().asString()
<< ' ';
// Alignment?
@ -255,8 +257,9 @@ void ParagraphParameters::write(ostream & os) const
case LYX_ALIGN_CENTER: h = 3; break;
default: h = 0; break;
}
os << "\\align " << string_align[h] << ' ';
oss << "\\align " << string_align[h] << ' ';
}
os << rtrim(oss.str());
}

View File

@ -792,7 +792,7 @@ bool Buffer::do_writeFile(ostream & ofs) const
<< "\\begin_document\n";
// now write out the buffer parameters.
ofs << "\n\\begin_header\n";
ofs << "\\begin_header\n";
params().writeFile(ofs);
ofs << "\\end_header\n";

View File

@ -1,3 +1,7 @@
2004-08-16 José Matos <jamatos@lyx.org>
* PreviewLoader.C (Impl::startLoading): remove space at end of line.
2004-08-15 Lars Gullik Bjonnes <larsbj@gullik.net>
* pch.h: new file

View File

@ -1,3 +1,10 @@
2004-08-16 José Matos <jamatos@lyx.org>
* insethfill.C (write):
* insetline.C (write):
* insetnewline.C (write):
* insetpagebreak.C (write): remove space at end of line.
2004-08-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* insettabular.C (plaintext): do not use ownerPar to get the

View File

@ -1,3 +1,8 @@
2004-08-16 José Matos <jamatos@lyx.org>
* formulamacro.C (write):
* math_macrotemplate.C (write): remove space at end of line.
2004-08-15 Lars Gullik Bjonnes <larsbj@gullik.net>
* pch.h: new file

View File

@ -69,7 +69,7 @@ auto_ptr<InsetBase> InsetFormulaMacro::clone() const
void InsetFormulaMacro::write(Buffer const &, ostream & os) const
{
os << "FormulaMacro ";
os << "FormulaMacro\n";
WriteStream wi(os, false, false);
tmpl()->write(wi);
}

View File

@ -172,7 +172,7 @@ void MathMacroTemplate::read(Buffer const &, LyXLex & lex)
void MathMacroTemplate::write(Buffer const &, std::ostream & os) const
{
WriteStream wi(os, false, false);
os << "FormulaMacro ";
os << "FormulaMacro\n";
write(wi);
}
@ -180,12 +180,12 @@ void MathMacroTemplate::write(Buffer const &, std::ostream & os) const
void MathMacroTemplate::write(WriteStream & os) const
{
if (type_ == "def") {
os << "\n\\def\\" << name_.c_str();
os << "\\def\\" << name_.c_str();
for (int i = 1; i <= numargs_; ++i)
os << '#' << i;
} else {
// newcommand or renewcommand
os << "\n\\" << type_.c_str() << "{\\" << name_.c_str() << '}';
os << "\\" << type_.c_str() << "{\\" << name_.c_str() << '}';
if (numargs_ > 0)
os << '[' << numargs_ << ']';
}

View File

@ -1,3 +1,11 @@
2008-08-16 José Matos <jamatos@lyx.org>
* context.C (begin_deeper, end_deeper):
* preamble.C (end_preamble):
* table.C (handle_tabular):
* text.C (end_inset, handle_ert, handle_comment):
(parse_text_attributes, parse_text): remove space at end of line.
2004-08-10 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* preamble.C (split_options): new, split package options into vector