I have a macro that ultimately transclude the content of a tiddlers.
If that tiddler is complex, and contains wikicode, it may fails. For instance, it does not produce a dotted liste with content such as
shoping list:
* sugar
* apple
* flour
A working but slow solution is to use the wikify widget. But this is slow. Although I’m sure I was already told about a similar problem, I don’t remember any solution and I can’t find a topic aout just that kind of need within this site.
Notice than even with wikify, I have a problem: To get the dotted list, I have to be in block mode, but when I only have a few words, it should be in inline mode. This issue can be fixed by different solutions. But if there was a method where I would not have to elaborate such a solution, then it would be great!
thank you @TW_Tones . I I grasp your explication clearly, the context cannot be set FROM the transcluded content, but can only be determined by the transcluding content (one way or another).
For my use case, this mean the transcluding must examine the to-be-transcluded content to set the mode for the transclusion. So far, I’ve decided that a content with one logical line should be treated as inline and any other content as block. Would you agree with that?
Not nesasarily, the transcluded content could start with an empty line, or contain a html “div” which is a block and you can add . There are quite a few options here.
Add a css style=“display: block;”
Create a class .myclass {display: block;}
If you had a minimal example eg a transclude statement and a “simple” tiddler it is transcluding, that is not working for you, it would be helpful.
I suppose this points out that exploring the issues with block and inline cant be avoided with tiddlywiki because it depends on HTML, and tiddlywiki’s parsing trys to guess.
The first change I would make is to move all the html you are including in your filter into variables or macros so there is no risk of unwanted outcomes due to the content of the html. It would also make it easier to read the filters.
In your example I don’t see a transclusion, is this your attempt at using wikify because you could not use a transclusion?
This forces me/us to reverse engineer to help you, which is hard work and prone to errors.
I really would encourage you to stop working on the specific code and try and create a minimal example of “Transclusion context or avoiding wikify” that demonstrates the problem.
When I do this I often find my own answer just trying to prepare the question.
If I don’t, it is much easier for people to help, and the answer less likely to confuse me and future readers.
@TW_Tones I shall try what you tell me to do. And report there what I’ll found out. The idea of using variables or function for html bits is a very nice one indeed.