While it is not necessary to run validate() on insets that do not
produce output (yellow notes and disabled branches), it has to be done
for previewing, since a construct inside the inset may require some
support.
This is done in two steps:
1. in PreviewLoader::dumpPreamble, indicate that a preview is being
prepared. It is not clear why the `for_preview' boolean was not set
before.
2. in Inset(Branch|Note)::validate, always call the parent's validate
method when previewing.
It should have been possible to move the code from 2. to
InsetText::validate, but the weird code in handling
InsetNoteParams::Comment in html makes it difficult.
runparams.moving_arg = true;
runparams.free_spacing = true;
runparams.is_child = buffer_.parent();
+ runparams.for_preview = true;
buffer_.writeLaTeXSource(os, buffer_.filePath(), runparams, Buffer::OnlyPreamble);
// FIXME! This is a HACK! The proper fix is to control the 'true'
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "Inset.h"
+#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "LyX.h"
#include "output_docbook.h"
void InsetBranch::validate(LaTeXFeatures & features) const
{
- if (producesOutput())
+ // Showing previews in a disabled branch may require stuff
+ if (producesOutput() || features.runparams().for_preview)
InsetCollapsible::validate(features);
}
InsetCollapsible::validate(features);
break;
case InsetNoteParams::Note:
+ // Showing previews in this inset may require stuff
+ if (features.runparams().for_preview)
+ InsetCollapsible::validate(features);
break;
}
}