config.h
-version.C
+config.h.in
lyx
+lyx-xforms
+lyx-qt
Makefile
Makefile.in
-config.h.in
stamp-h
stamp-h1
+version.C
+version.C-tmp
+stamp-version
*.deps
.libs
a.out
+2003-08-06 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * .cvsignore: add lyx-xforms, lyx-qt, version.C-tmp and stamp-version
+
2003-08-05 Alfredo Braunstein <abraunst@libero.it>
* text2.C (DEPM): fix part of bug 1255 and 1256
.libs
libxforms.la
lyx_forms.h
+lyx_forms.h-tmp
+stamp-forms
lyx_xpm.h
+lyx_xpm.h-tmp
+stamp-xpm
+2003-08-06 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * .cvsignore: add lyx_forms.h-tmp, stamp-forms, lyx_xpm.h-tmp,
+ stamp-xpm.
+
2003-08-06 Martin Vermeer <martin.vermeer@hut.di>
* Color.C: Kayvan's std::setw micropatch.
+2003-08-07 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
+
+ * text.C (parse_text): special handling for \item and \bibitem
+ macros
+
+ * context.C (begin_layout, end_layout, begin_deeper, end_deeper):
+ tiny helper functions
+ (check_layout):
+ (check_end_deeper): add special handling for the case of a normal
+ paragraph inside a list-like environment.
+
+ * test-structure.tex: add more stuff there
+
2003-08-05 Alfredo Braunstein <abraunst@libero.it>
* context.h: compile fix
using std::ostream;
using std::endl;
+namespace {
+
+void begin_layout(ostream & os, LyXLayout_ptr layout)
+{
+ os << "\n\\begin_layout " << layout->name() << "\n\n";
+}
+
+
+void end_layout(ostream & os)
+{
+ os << "\n\\end_layout\n";
+}
+
+
+void begin_deeper(ostream & os)
+{
+ os << "\n\\begin_deeper \n";
+}
+
+
+void end_deeper(ostream & os)
+{
+ os << "\n\\end_deeper \n";
+}
+
+}
+
Context::Context(bool need_layout_,
LyXTextClass const & textclass_,
LyXLayout_ptr layout_, LyXLayout_ptr parent_layout_)
: need_layout(need_layout_),
need_end_layout(false), need_end_deeper(false),
+ has_item(false), deeper_paragraph(false),
textclass(textclass_),
layout(layout_), parent_layout(parent_layout_)
{
{
if (need_layout) {
check_end_layout(os);
-
- os << "\n\\begin_layout " << layout->name() << "\n\n";
- need_layout=false;
- need_end_layout = true;
- if (!extra_stuff.empty()) {
- os << extra_stuff;
- extra_stuff.erase();
+
+ // are we in a list-like environment?
+ if (layout->isEnvironment()
+ && layout->latextype != LATEX_ENVIRONMENT) {
+ if (has_item) {
+ if (deeper_paragraph) {
+ end_deeper(os);
+ deeper_paragraph = false;
+ }
+ begin_layout(os, layout);
+ has_item = false;
+ need_layout=false;
+ need_end_layout = true;
+ } else {
+ // a standard paragraph in an
+ // enumeration. We have to recognize
+ // that this may require a begin_deeper.
+ if (!deeper_paragraph)
+ begin_deeper(os);
+ begin_layout(os, textclass.defaultLayout());
+ need_layout=false;
+ need_end_layout = true;
+ deeper_paragraph = true;
+ }
+ } else {
+ begin_layout(os, layout);
+ need_layout=false;
+ need_end_layout = true;
+ if (!extra_stuff.empty()) {
+ os << extra_stuff;
+ extra_stuff.erase();
+ }
}
}
}
void Context::check_end_layout(ostream & os)
{
- if (need_end_layout) {
- os << "\n\\end_layout\n";
+ if (need_end_layout) {
+ end_layout(os);
need_end_layout = false;
}
}
{
if (parent_layout->isEnvironment()) {
if (need_end_deeper) {
- // no need to have \end_deeper \begin_deeper
-// FIXME: This does not work because \par already calls check_end_layout
+ // no need to have \end_deeper \begin_deeper
need_end_deeper = false;
} else {
- os << "\n\\begin_deeper \n";
+ begin_deeper(os);
need_end_deeper = true;
}
} else
void Context::check_end_deeper(ostream & os)
{
if (need_end_deeper) {
- os << "\n\\end_deeper \n";
+ end_deeper(os);
need_end_deeper = false;
}
+ if (deeper_paragraph) {
+ end_deeper(os);
+ deeper_paragraph = false;
+ }
}
// If there has been an \begin_deeper, we'll need a matching
// \end_deeper
bool need_end_deeper;
-
+ // If we are in an itemize-like environment, we need an \item
+ // for each paragraph, otherwise this has to be a deeper
+ // paragraph.
+ bool has_item;
+ // we are handling a standard paragraph in an itemize-like
+ // environment
+ bool deeper_paragraph;
+
// The textclass of the document. Could actually be a global variable
LyXTextClass const & textclass;
// The layout of the current paragraph
\documentclass{article}
+\newenvironment{foo}{==[}{]==}
+
\begin{document}
This document contains all sorts of layouts we are supposed to
support, along with weird nestings.
+At time you will see that I use subsubsections in weird places. The
+intent is just to make sure that I can include a macro-type layout
+everyzhere it makes sense.
A normal paragraph
-
-Another one
\begin{equation}
x = \sin y
\end{equation}
-with maths inside
+with maths inside it.
\begin{quote}
An environment...
\begin{quotation}
An environment
-\section*{with a command inside it}
+\subsubsection*{with a command inside it}
\end{quotation}
\begin{quotation}
\item Item2
\end{enumerate}
+Let's see what happens when normal paragraphs are inserted in lists:
+
+\begin{itemize}
+\item the first item
+
+with some explanatory text under it
+
+and a second paragraph for good measure
+
+\subsubsection*{we can even have one as a subsubsection}
+
+\item the second item
+
+\item the third item
+
+\subsubsection*{and a sssection heading inside it (why not?)}
+\end{itemize}
+
+What else? Well, we have descriptions:
+\begin{description}
+\item[A] first item
+\item[B] second one
+\end{description}
+
+or even bibliography
+\begin{thebibliography}{9}
+\bibitem{FOO} Edward Bar. \emph{The Foo Book}. (1999)
+\end{thebibliography}
+
\end{document}
s = parse_text(p, FLAG_BRACK_LAST, outer, newcontext);
}
context.need_layout = true;
+ context.has_item = true;
context.check_layout(os);
if (s.size())
os << s << ' ';
}
+ else if (t.cs() == "bibitem") {
+ context.need_layout = true;
+ context.has_item = true;
+ context.check_layout(os);
+ os << "\\bibitem ";
+ os << p.getOpt();
+ os << '{' << p.verbatim_item() << '}' << "\n";
+ }
+
else if (t.cs() == "def") {
string name = p.get_token().cs();
while (p.next_token().cat() != catBegin)
os << "\n\\" << t.cs() << " default \n";
}
- else if (t.cs() == "bibitem") {
- context.check_layout(os);
- os << "\\bibitem ";
- os << p.getOpt();
- os << '{' << p.verbatim_item() << '}' << "\n";
- }
-
else if (is_known(t.cs(), known_latex_commands)) {
context.check_layout(os);
begin_inset(os, "LatexCommand ");