Parsing "slots" in templates
Closed this issue · 2 comments
antononcube commented
It would be nice if M2MD knows how to export "slots" of template boxes and objects. (TemplateBox
, TemplateObject
.)
See the attached notebook. (Remove the 2nd extension ".txt".)
To be more specific, I would like the prompt cell in notebook's section "Prompt Text" :
Cell[TextData[{
"Rewrite the following text and convert some of it into emojis.\nThe emojis are all related to \
whatever is in the text.\n\n",
Cell[BoxData[
TemplateBox[{1, "\"\"", "Positional", TextData},
"NotebookTemplateSlot"]]]
}], "Text",
TaggingRules->{},
CellChangeTimes->{},
Background->GrayLevel[0.97],
CellTags->"DefaultContent",
CellID->439264869]
to be translated to Markdown as:
## Prompt Text
Rewrite the following text and convert some of it into emojis.
The emojis are all related to whatever is in the text.
`1`
instead of:
## Prompt Text
Rewrite the following text and convert some of it into emojis.
The emojis are all related to whatever is in the text.
![1qcf1uz1cr9wn](img/1qcf1uz1cr9wn.png)
kubaPod commented
@antononcube Don't really have time for M2MD right now and covering notebook templates well is not a short task but for your example you can try to do:
M2MD`Private`parseData[ TemplateBox[{n_, def_, "Positional", fmt_}, "NotebookTemplateSlot"]] :=
"`" <> ToString[n] <> "`"
Let me know if it works :)
antononcube commented
Yes, it does work. (And it is easy to incorporate in my workflows.)