Le 15/10/2014 11:16, Alfredo Braunstein a écrit :
I don't understand: I guess many inset just inherit their ::latex method.
What is the risk exactly.

Advanced Search & replace all [math:x]->[math:y] in a document containing

[disabled branch: blah blah][math:x]

the result is

[math:y]

OK, but what is the link between InsetERT not having a ::latex method ans not outputting anything? The InsetText::latex is sufficiently flexible to handle it. Likewise for many insets derived from InsetCommand (label, bibitem...).

Also, you may want to take in account the following method:

         /// Is the content of this inset part of the output document?
         virtual bool producesOutput() const { return true; }
You could also check whether there have been some output after calling
::latex and add a special marker otherwise.

Where? *::latex gets called recursively... The advanced s&r stuff
seems pretty complicated to me (and, from a quick look, a bit of a
hack if you ask me. No offense to the authors I hope, it is actually
an amazing feature).

It is a complet ehack. But this hack was easier to write than the proper version (especially when one wants to do regex).

Adding a force_output flag could be an easy fix
to the dataloss with no negative consequences that I can think of.
What is your concern?

My concern is that we already have two pices of code where we override the "no output property":

* in Inset::addToToc, because we sometimes want the headings inside notes to be available inthe outline sidebar

* in Buffer::updateStatistics, because some people want to have the words in their notes or inactive branches counted

Before we had yet another thing for yet another use, I was wondering whether we could have a unique mechanism with correct semantics to do that.

One poiibility would be to be able to control what Inset::producesOutput returns (maybe via a Buffer or BufferParams parameter, I don't know). The explicit code in InsetNote should actually rely on producesOutput instead of looking at type of note.

JMarc

Reply via email to