Commit Graph

125 Commits

Author SHA1 Message Date
Georg Baum
79f11f4e7d Fix std::string docstream output error
This was made visible by aab1b145a5, since xhtml export for
lib/doc/Additional.lyx caused an exception. However, the cause for this was
already present earlier: All attempts to output a std::string to an
odocstream resulted in trying to change the encoding of the stream instead,
since there is no operator<<(odocstream &, std::string) defined, and an
implicit conversion to SetEnc happened instead.
This is fixed by making the SetEnc constructor explicit and adjusting all
code parts that did not compile anymore after that. The parts of the code
that did use the wrong output operator were the std::string version of
htmlize() from output_xhtml.cpp and all changed parts in the other .cpp files.
I also removed the std::string versions of html::htmlize() and
html::cleanAttr(), since it was difficult to see which encodings were used
with these. Now we are always explcit when using html::cleanAttr() and
html::htmlize().
2015-10-15 20:52:28 +02:00
Georg Baum
aab1b145a5 Fix missing xhtml output found by cppcheck
Actually I don't know if this operator is used at all, but if it exists then
it must output something.
2015-09-20 20:47:33 +02:00
Georg Baum
b6aed54c45 Fix cppcheck variable scope warnings
These were all flagged by "(style) The scope of the variable 'x' can be reduced."
Narowing the scope improves readability, and if it is in a loop then the
compiler will be clever enough to produce efficient code, we do not need
manual optimization for POD types.
2015-09-20 10:42:35 +02:00
Georg Baum
c479243468 Work around a gcc5 bug
The old code produced crashes with gcc5 caused by calling the copy
constructor (see https://bugzilla.redhat.com/show_bug.cgi?id=1260976).
This has been filed as gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67557
It is currently being marked as invalid (they claim the code is not valid and
produces undefined behaviour), but I don't think that this is correct.
Fortunately i does not matter for us whether the old code was valid or not,
since the new version is easier to understand and works with all compilers.
2015-09-13 10:04:16 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Jean-Marc
93a43742a5 Fix a bunch of small performance issues spotted by cppcheck
Most of these are about passing const strings parameters as references.
2014-07-05 19:13:10 +02:00
Jean-Marc Lasgouttes
5c32dc85d5 Fix various warnings issued by clang++.
* remove unused class TexStream.

* remove unused virtual method Inset::cellXOffset

* remove second argument of FileDialog constructor, which was actually
  not used

* remove some dead local code

* remove some unused private members of classes

* in InsetMathNest::updateBuffer, fix the logic of a test
2014-04-22 00:04:04 +02:00
Richard Heck
a34ce7ca85 Fix crash reported by Scott on the list. The test on latexname() was
obviously wrong. We want to know if we are in the same layout, and
that is not enough.
2013-07-17 11:09:03 -04:00
Richard Heck
8b858d113f Get font sizes working for XHTML. 2013-05-13 12:22:41 -04:00
Richard Heck
c713030edb Get font families working for XHTML. 2013-05-13 11:58:52 -04:00
Richard Heck
b383d04e07 XHTML support for font shapes. 2013-05-13 10:45:12 -04:00
Richard Heck
5cadeed4d7 Rework that way that font tags are handled in XHTML output. We need
to do this in order to handle span tags properly, when they act as
font tags.
2013-05-13 10:45:12 -04:00
Richard Heck
64f0cffbba Rework the way the parsep tag is handled, and introduce comparison
operators for these tags.
2013-05-13 10:45:12 -04:00
Richard Heck
ad56bb7286 Rework how paragraph ids are handled.
Previously, an empty paragraph would always yield something like:
	<div><a id='magicparid-35' /></div>
because we had no way to "defer" the anchor tag. Now this is wrapped
into the div, in effect, and we abandon it all if there's no content.
2013-05-13 10:45:12 -04:00
Richard Heck
c5a707ba74 Reorganize the TagStack objects. 2013-05-13 10:45:12 -04:00
Richard Heck
9c749331a0 Re-rename. The last renaming broke monolithic compilation. 2013-05-02 15:21:19 -04:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Richard Heck
7ade656670 Just a bit of renaming. 2013-04-25 17:08:58 -04:00
Richard Heck
54cff4129f Forgot to include "u" as a font tag. 2013-03-27 15:46:06 -04:00
Richard Heck
82b8723654 Handle other text ranges in XHTML output. 2013-03-27 13:51:26 -04:00
Richard Heck
b3ceb89efc Fix bug #8598. We need to use the masterBuffer's counters in the
XHTML output routines.
2013-03-18 18:45:09 -04:00
Richard Heck
32b0e8cbdb Change LabelType Top_Environment to LabelType Above, and LabelType
Centered_Top_Environment to LabelType Centered.
2013-02-09 13:44:06 -05:00
Lars Gullik Bjønnes
6b2232a29c src/*.cpp: reformatting to increase consistency 2012-10-28 17:42:07 +01:00
Juergen Spitzmueller
f30d6acb04 Compile fix
Richard, please check.
2012-07-22 11:45:39 +02:00
Richard Heck
894569e601 Fix a long-standing FIXME by resetting only the counter for top-level
sectioning when we see an appendix. This fixes bug #8271, whose root
cause was the fact that we were resetting all the counters inside ERT.
2012-07-21 14:19:10 -04:00
Jean-Marc Lasgouttes
a756403301 "Performance" fixes suggested by cppcheck
While cppcheck did not turn out any suspicious error messages, using
the "performance" flag highlighted several nitpicks in three categories
 * do not use it++ for iterators, ++it is better
 * do not use size() to test for emptyness, empty() is here
 * do not use "const T" as a function parameter, "const & T" is better

I doubt that any of these is a real performance problem, but the code is cleaner anyway.
2012-05-28 22:42:44 +02:00
Vincent van Ravesteijn
3c0e3c16c8 Fix bug #8078: Assertions in xhtml output on Windows 2012-04-30 12:58:32 +02:00
Richard Heck
7c5f28ad26 The logic of the endParagraph() routine is wrong. We should first
check if the parsep_tag is pending.
2012-04-08 10:05:44 -04:00
Richard Heck
8dd436b7dc We need to check, in closeFontTags(), for the case where we haven't
had any content.
2012-04-08 10:05:44 -04:00
Richard Heck
29cf7af6d3 The isTagOpen() routine can be const. 2012-04-08 10:05:44 -04:00
Richard Heck
313c9e0e5a Debugging code for the tag stack, disabled by default. 2012-04-08 10:05:43 -04:00
Richard Heck
d78560832a Fix error output for XHTML a bit. 2012-04-03 18:13:59 -04:00
Richard Heck
b3475e9fac Fix bug #7634. Make sure we clear the tag deque if we are keeping
empty paragraphs.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39152 a592a061-630c-0410-9148-cb99ea01b6c8
2011-06-20 15:55:41 +00:00
Richard Heck
7d9b8a464f Fix bug #7463: XHTML View>Source now shows only the paragraph with the
cursor. Fix is fairly simple.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38572 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-03 14:05:42 +00:00
Richard Heck
e0bc4efcff Revert r38431 for now, at least. Thanks to Enrico for pointing out
why that is a good idea.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38451 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-19 00:50:24 +00:00
Richard Heck
5d60eea4ba Now how do you think that happened?
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38433 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-18 02:23:09 +00:00
Richard Heck
c8c5ae29aa Remove pointless variable.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38432 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-18 02:11:24 +00:00
Richard Heck
1cdd1dc0c0 Remove pointless variable.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38431 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-18 01:49:23 +00:00
Pavel Sanda
6df859f35a Fix compilation, Richard please check this.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38222 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-03 08:02:08 +00:00
Richard Heck
a673aa3428 The mechanism for closing font tags at the end of a paragraph was
throwing errors in the case where we are inside a charstyle that itself
uses a font tag, e.g., strong from the logical markup module. This at
least gets rid of most of the errors, and doesn't seem to cause any
other problems.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38220 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-03 01:56:20 +00:00
Richard Heck
8165e63acf More font tags.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38217 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-03 00:03:10 +00:00
Richard Heck
ff782f993a Style.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38186 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-01 19:27:30 +00:00
Richard Heck
461c973d62 Clean up XHTML output a bit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38185 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-01 19:18:25 +00:00
Vincent van Ravesteijn
5846e0eb7b Compile fix for r36670.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36672 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-03 02:42:25 +00:00
Richard Heck
a81bf77314 Change the escaping mechanism for XHTML output and so allow a fix for
bug #7061.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36455 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-24 15:27:36 +00:00
Richard Heck
0940cd77d4 Better way of doing these checks, suggested by Enrico.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36356 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-17 22:17:53 +00:00
Richard Heck
4bf281106b Be more careful here about isalpha and isalnum. Per Enrico's suggestion,
we first do a range test, then check the status. I think this is right
in both cases.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36351 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-17 21:19:01 +00:00
Richard Heck
680b6e78e4 Fix bug #6953.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35673 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-17 18:46:35 +00:00
Pavel Sanda
eaf1e371c7 Revert 35400 for the time being, crashes here.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35402 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-15 20:32:58 +00:00
Richard Heck
c4c210cc6e Minor simplification.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35400 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-15 17:33:15 +00:00