Get InsetBibitem working, and the output for LATEX_BIB_ENVIRONMENT.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30045 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-06-11 20:08:39 +00:00
parent 5742cf9ce6
commit 5e8d08cb9e
7 changed files with 54 additions and 9 deletions

View File

@ -23,6 +23,10 @@ These insets work but still need work:
These insets do not work but should be completely straightforward: These insets do not work but should be completely straightforward:
Caption, Flex (uses collapsable) Caption, Flex (uses collapsable)
May need to make use here of TocWidget::itemInset, which should then be moved
to TocBackend.
These do not yet work and need some attention: These do not yet work and need some attention:
InsetBibitem: Should be fairly straightforward, in itself, actually. InsetBibitem: Should be fairly straightforward, in itself, actually.
InsetBibtex: We should be able to collect the keys of references in InsetBibtex: We should be able to collect the keys of references in

View File

@ -57,4 +57,6 @@ Style Bibliography
Series Bold Series Bold
Size Larger Size Larger
EndFont EndFont
HTMLTag p
HTMLAttr class='bibliography'
End End

View File

@ -24,6 +24,7 @@
#include "InsetIterator.h" #include "InsetIterator.h"
#include "InsetList.h" #include "InsetList.h"
#include "Lexer.h" #include "Lexer.h"
#include "output_xhtml.h"
#include "Paragraph.h" #include "Paragraph.h"
#include "ParagraphList.h" #include "ParagraphList.h"
#include "TextClass.h" #include "TextClass.h"
@ -251,7 +252,7 @@ void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it)
} }
/// Update the counters of this inset and of its contents // Update the counters of this inset and of its contents
void InsetBibitem::updateLabels(ParIterator const &) void InsetBibitem::updateLabels(ParIterator const &)
{ {
Counters & counters = buffer().masterBuffer()->params().documentClass().counters(); Counters & counters = buffer().masterBuffer()->params().documentClass().counters();
@ -265,4 +266,11 @@ void InsetBibitem::updateLabels(ParIterator const &)
} }
int InsetBibitem::xhtml(odocstream & os, OutputParams const &) const
{
os << "<a name='" << html::htmlize(getParam("key")) << "'></a>";
os << "<span class='biblabel'>" << bibLabel() << "</span> ";
}
} // namespace lyx } // namespace lyx

View File

@ -61,6 +61,8 @@ private:
/// ///
int plaintext(odocstream &, OutputParams const &) const; int plaintext(odocstream &, OutputParams const &) const;
/// ///
int xhtml(odocstream &, OutputParams const &) const;
///
virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const; virtual void fillWithBibKeys(BiblioInfo &, InsetIterator const &) const;
/// Update the counter of this inset /// Update the counter of this inset
virtual void updateLabels(ParIterator const &); virtual void updateLabels(ParIterator const &);

View File

@ -547,7 +547,7 @@ void InsetText::addToToc(DocIterator const & cdit)
break; break;
} }
} }
/// now the toc entry for the paragraph // now the toc entry for the paragraph
int const toclevel = par.layout().toclevel; int const toclevel = par.layout().toclevel;
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) { if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
dit.pos() = 0; dit.pos() = 0;

View File

@ -65,6 +65,11 @@ docstring escapeChar(char_type c)
} }
// FIXME do something here.
docstring htmlize(docstring const & str) {
return str;
}
// FIXME This needs to be protected somehow. // FIXME This needs to be protected somehow.
static vector<string> taglist; static vector<string> taglist;
@ -212,6 +217,22 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
} }
ParagraphList::const_iterator makeBibliography(Buffer const & buf,
odocstream & os,
OutputParams const & runparams,
ParagraphList const & paragraphs,
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
os << "<div class='bibliography'>\n"
<< "<h2 class='bibliography'>"
<< pbegin->layout().labelstring()
<< "</h2>\n";
makeParagraphs(buf, os, runparams, paragraphs, pbegin, pend);
return pend;
}
ParagraphList::const_iterator makeEnvironment(Buffer const & buf, ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
odocstream & os, odocstream & os,
OutputParams const & runparams, OutputParams const & runparams,
@ -310,8 +331,13 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
send = searchParagraph(par, pend); send = searchParagraph(par, pend);
par = makeParagraphs(buf, os, runparams, paragraphs, par, send); par = makeParagraphs(buf, os, runparams, paragraphs, par, send);
break; break;
// FIXME // Shouldn't happen
case LATEX_BIB_ENVIRONMENT: case LATEX_BIB_ENVIRONMENT:
send = par;
++send;
par = makeParagraphs(buf, os, runparams, paragraphs, par, send);
break;
// Shouldn't happen
case LATEX_COMMAND: case LATEX_COMMAND:
++par; ++par;
break; break;
@ -385,16 +411,17 @@ void xhtmlParagraphs(ParagraphList const & paragraphs,
case LATEX_LIST_ENVIRONMENT: case LATEX_LIST_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: { case LATEX_ITEM_ENVIRONMENT: {
send = searchEnvironment(par, pend); send = searchEnvironment(par, pend);
par = makeEnvironment(buf, os, runparams, paragraphs, par,send); par = makeEnvironment(buf, os, runparams, paragraphs, par, send);
break;
}
case LATEX_BIB_ENVIRONMENT: {
send = searchEnvironment(par, pend);
par = makeBibliography(buf, os, runparams, paragraphs, par, send);
break; break;
} }
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
send = searchParagraph(par, pend); send = searchParagraph(par, pend);
par = makeParagraphs(buf, os, runparams, paragraphs, par,send); par = makeParagraphs(buf, os, runparams, paragraphs, par, send);
break;
case LATEX_BIB_ENVIRONMENT:
// FIXME
++par;
break; break;
} }
// FIXME?? // FIXME??

View File

@ -29,6 +29,8 @@ void xhtmlParagraphs(ParagraphList const & subset,
namespace html { namespace html {
/// ///
docstring escapeChar(char_type c); docstring escapeChar(char_type c);
/// converts a string to a form safe for links, etc
docstring htmlize(docstring const & str);
/// \return true if tag was opened, false if not /// \return true if tag was opened, false if not
bool openTag(odocstream & os, std::string const & tag, bool openTag(odocstream & os, std::string const & tag,
std::string const & attr); std::string const & attr);