-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering a custom block with contents that should not be displayed #52
Comments
As far as I can tell, there are actually four possible responses
In other words, there are actually two orthogonal boolean metaflags
(Note: I’m not wed to those particular names, but you get the idea). We define the default behaviour on encountering an unknown block type to be: |
That seems like good behavior when For example, the base64 image could be replaced with ASCII-art (especially if it depicted a flow chart or similar, which seems reasonable in the doc context) |
@codesections I think the specification should be the simplest possible, and actions that can be unabiguously enabled. |
Agreed. But rendering replacement text instead of the contents is equally unambiguous for the same reason. |
In order to enter the meaningless data
together with a warning message If, however, There is no replacement text, just the text version of the source. |
Right, but I'm suggesting that we allow replacement text with =begin MyUnsupportedBlock :fallback('[The "Password Strength xkcd webcomic, available at https://xkcd.com/936]') :!warning
9203u42j3nde)U**UHUIHA
=end MyUnsupportedBlock Which would render
My point is that letting (That wouldn't be true if |
First of all, whichever solution is eventually chosen it has to be globally configurable for cases when potentially unrenderable blocks are rather common within document body. Remembering to always add The For less common cases where block content could be replaced with meaningful textual representation I was having in mind something like this: =begin MyCustom
....
=else
If you see this message then check out L<this link|https://...> or refer to L<#Rendering> section.
=end If the =begin SVG
...
=else Img
....
=else
...
=end So that if |
^^^ seems like a good approach, but I'm not sure about the
That draws on |
Note that we already provide an Of course, that isn't as powerful as the "control structure" approaches @vrurg and @codesections have suggested. |
If there is a consensus that a more powerful control structure needs to be added, then I think this should be a part of the next specification (RakuDoc v3). It will considerably change the specification as it stands now. Implementing such a change will not be simple. What needs to be considered is the consequence of these conditional structures when embedded in other RakuDoc blocks. Futhermore, we are only discussing custom blocks at present. They are not yet widely used because only my I would also suggest looking at issue #51 about DOC use. I have outlined some of the existing complexity of rendering custom blocks. A simple We would only need to decide which value of |
I agree that further discussion of these proposed more-powerful features should be tabled for now However, as an interim measure, I think we should allow user-defined blocks to optionally specify I also agree that the defaults for the two new boolean metaoptions should both be True. However, I still think that |
@codesections The |
I will raise a PR to introduce explicit text about |
closing as resolved. for the time being |
closing as resolved |
@thoughtstream Your thoughts? @lizmat @codesections @vrurg please clarify if I have not got this right.
Suppose there is a custom block which has contents in the RakuDoc source which should only be shown if the custom block is correctly executed. But if the renderer does not recognise the Custom block, or the output format does not support the intended custom output, there should be a defined mechanism for not displaying the content.
For example,
Alternatively the contents might include some SQL the author would prefer is not displayed
The suggestion is to have a metadata option available for all custom blocks, eg.
:not-rendered<ignore>
If a custom block has
:not-rendered<ignore>
AND the renderer does not recognise the custom block, then instead of rendering the contents of the custom block as text (the current fallback), the contents would be ignored, with perhaps a message that the contents are ignored.The text was updated successfully, but these errors were encountered: