mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
This sorts the index entries and writes each one's tags together, like:
AMS Math 1, 2, 3 where the numbers are links. The only thing left to do here is to parse the index entries so that we can do something with "this ! that" and similar things. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7349e6e29b
commit
2e349ff103
@ -21,6 +21,11 @@ These insets work but still need work:
|
||||
and appropriate img tag. But we don't yet do any sort of scaling, rotating, and
|
||||
so forth. That won't be hard, since we can just call ImageMagick to do this for
|
||||
us, but appropriate routines will need to be written.
|
||||
InsetIndex and InsetPrintIndex: Just need to sort out some ordering issues and the
|
||||
like.
|
||||
InsetNomencl and InsetPrintNomencl: Do not work at all yet, but would be easy to do.
|
||||
First, Nomencl would need to go to the TOC, which it should do anyway. Then just
|
||||
do as for TOC and Index, more or less.
|
||||
InsetRef: At present, we just use the label name as associated text, and put it
|
||||
into square brackets. It'd be nice to be able to do more, but for that we'd need to
|
||||
associate counters with the labels, and we don't have that yet.
|
||||
@ -67,10 +72,6 @@ Other math notes:
|
||||
These insets do not work and are not yet scheduled to work:
|
||||
InsetExternal: It may be that this won't be too hard, but I don't understand
|
||||
these so am not sure what to do. For now, it is disabled.
|
||||
InsetIndex and InsetPrintIndex: An "advanced" case. What really would be cool
|
||||
would be to collect all of these and then write the index as a series of links
|
||||
back to the occurrences. But not now.
|
||||
InsetNomencl and InsetPrintNomencl: Also "advanced".
|
||||
|
||||
May need to make use here of TocWidget::itemInset, which should then be moved
|
||||
to TocBackend.
|
||||
|
@ -605,16 +605,35 @@ docstring InsetPrintIndex::xhtml(XHTMLStream &, OutputParams const & op) const
|
||||
for (; it != en; ++it)
|
||||
entries.push_back(IndexEntry(it->str(), it->dit()));
|
||||
stable_sort(entries.begin(), entries.end());
|
||||
|
||||
vector<IndexEntry>::const_iterator eit = entries.begin();
|
||||
vector<IndexEntry>::const_iterator een = entries.end();
|
||||
vector<IndexEntry>::const_iterator const een = entries.end();
|
||||
vector<IndexEntry>::const_iterator last = een;
|
||||
int entry_number = 0;
|
||||
for (; eit != een; ++eit) {
|
||||
Paragraph const & par = eit->dit.innerParagraph();
|
||||
if (last == een) {
|
||||
// first time through the loop
|
||||
xs << StartTag("div", "class='index_entry'");
|
||||
par.simpleLyXHTMLOnePar(buffer(), xs, op, dummy, true);
|
||||
}
|
||||
else if (last->idx != eit->idx) {
|
||||
// this is a new entry
|
||||
xs << EndTag("div");
|
||||
xs.cr();
|
||||
xs << StartTag("div", "class='index_entry'");
|
||||
par.simpleLyXHTMLOnePar(buffer(), xs, op, dummy, true);
|
||||
entry_number = 0;
|
||||
}
|
||||
if (!entry_number)
|
||||
xs << ",";
|
||||
string const parattr = "href='#" + par.magicLabel() + "'";
|
||||
xs << CompTag("br") << StartTag("a", parattr);
|
||||
par.simpleLyXHTMLOnePar(buffer(), xs, op, dummy, true);
|
||||
xs << " " << StartTag("a", parattr);
|
||||
xs << ++entry_number;
|
||||
xs << EndTag("a");
|
||||
last = eit;
|
||||
}
|
||||
|
||||
xs << EndTag("div"); // last entry
|
||||
xs << EndTag("div");
|
||||
return ods.str();
|
||||
}
|
||||
|
@ -27,8 +27,9 @@
|
||||
#include "Text.h"
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "support/lassert.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/lassert.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <vector>
|
||||
@ -281,6 +282,15 @@ XHTMLStream & XHTMLStream::operator<<(char_type c)
|
||||
}
|
||||
|
||||
|
||||
XHTMLStream & XHTMLStream::operator<<(int i)
|
||||
{
|
||||
clearTagDeque();
|
||||
os_ << i;
|
||||
nextraw_ = false;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
XHTMLStream & XHTMLStream::operator<<(NextRaw const &)
|
||||
{
|
||||
nextraw_ = true;
|
||||
|
@ -60,6 +60,10 @@ struct EndTag {
|
||||
};
|
||||
|
||||
|
||||
// FIXME XHTML
|
||||
// We need to allow these to be deferrable, which means it should
|
||||
// inherit from StartTag. This is probably better, anyway, but we'll
|
||||
// need to re-work a bit of code....
|
||||
/// Tags like <img />
|
||||
/// Attributes will be escaped automatically and so should NOT
|
||||
/// be escaped before passing to the constructor.
|
||||
@ -101,6 +105,8 @@ public:
|
||||
///
|
||||
XHTMLStream & operator<<(char_type);
|
||||
///
|
||||
XHTMLStream & operator<<(int);
|
||||
///
|
||||
XHTMLStream & operator<<(StartTag const &);
|
||||
///
|
||||
XHTMLStream & operator<<(EndTag const &);
|
||||
|
Loading…
Reference in New Issue
Block a user