/// The boolean indicates whether we are preparing for output, e.g.,
/// of XHTML.
virtual void updateBuffer(ParIterator const &, UpdateType, bool const) {}
+ /// Note that \param us is expected to be a DocIterator pointing at this inset.
+ /// We will assert otherwise.
+ virtual void updateMacros(DocIterator const & /* us */, DocIterator const & /* scope */) {}
/// Updates the inset's dialog
virtual Buffer const * updateFrontend() const;
DocIterator it = us;
pit_type const lastpit = it.lastpit();
-
// look for macros in each paragraph
while (it.pit() <= lastpit) {
Paragraph & par = it.paragraph();
for (auto const & insit : par.insetList()) {
it.pos() = insit.pos;
- if (InsetText const * itext = insit.inset->asInsetText()) {
+ if (InsetText * itext = insit.inset->asInsetText()) {
// collect macros in inset
it.push_back(CursorSlice(*insit.inset));
- if (itext->producesOutput()) {
- // the simple case
- updateMacros(it, scope);
- } else {
- // We don't want macros declared in notes, comments, etc,
- // to affect anything outside them.
- // New scope which ends just behind the inset
- DocIterator new_scope = it;
- ++new_scope.pos();
- updateMacros(it, new_scope);
- }
+ itext->updateMacros(it, ourscope);
it.pop_back();
continue;
}
size_t const numcells = slice.nargs();
for (; slice.idx() < numcells; slice.forwardIdx()) {
it.push_back(slice);
- updateMacros(it, scope);
+ updateMacros(it, ourscope);
it.pop_back();
}
continue;
buffer().clearMacroLock();
if (!child)
continue;
- buffer().registerChild(child, it, scope);
+ buffer().registerChild(child, it, ourscope);
continue;
}
continue;
// register macro
- buffer().registerMacro(macroTemplate.name(), it, scope);
+ buffer().registerMacro(macroTemplate.name(), it, ourscope);
}
// next paragraph
/// Update the counters of this inset and of its contents
void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
///
- void updateMacros(DocIterator const & us, DocIterator const & scope);
+ void updateMacros(DocIterator const & us, DocIterator const & scope) override;
///
void setMacrocontextPositionRecursive(DocIterator const & pos);
///