Skip to content
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

Parsing "slots" in templates #26

Closed
antononcube opened this issue Aug 27, 2023 · 2 comments
Closed

Parsing "slots" in templates #26

antononcube opened this issue Aug 27, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@antononcube
Copy link

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)

M2MD-export-of-template-objects.nb.txt

@kubaPod
Copy link
Owner

kubaPod commented Aug 28, 2023

@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
Copy link
Author

Yes, it does work. (And it is easy to incorporate in my workflows.)

@kubaPod kubaPod added the wontfix This will not be worked on label Aug 29, 2023
@kubaPod kubaPod closed this as completed Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants