-
Notifications
You must be signed in to change notification settings - Fork 34
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
optional support for org-fc cloze markup #79
Comments
initial support for you can give it a try now by editing you cargo.toml to orgize = { git = "https://github.com/PoiScript/orgize", branch = "v0.10", features = [
"syntax-org-fc",
] } one thing that I'm not sure about is the method naming: |
thanks poi, this is quite promising, i appreciate it. I'm having trouble using it within an traverse fn; I don't ever see any
I think I'm using the W.R.T. the naming, I don't have much advice here. You could call it |
hello, sorry for the late response. the traverser now emits cloze events properly: let org = Org::parse("{{cloze1}{hint1}}");
let mut cloze = None;
let mut t = from_fn(|event| {
if let Event::Cloze(cloze_) = event {
cloze = Some(cloze_);
}
});
org.traverse(&mut t);
let cloze = cloze.unwrap();
assert_eq!(cloze.text_raw(), "cloze1");
assert_eq!(cloze.hint().unwrap(), "hint1"); |
and I just checked the anki docs, and it also labels this field as "Text". so I think we're good to go. |
I use https://github.com/l3kn/org-fc, an anki-style flashcarding system that has a few "card types"; most of them are based on the shape of a heading (one side of the card is the heading, one is the text therein), a text-input, etc, but it also introduces a custom markup for what it calls "cloze" cards:
These introduce a markup that interacts poorly with orgize's parser, especially if you put non-text syntax inside of the "holes". With the 0.9 parser, I just used a regex match on a Text block to transform these clozes in to
<span>
elements on export, but if a link or so is in there it breaks up the text block.It would be nice to have a (perhaps feature gated) extension to the rowan syntax to parse these and have access to the underlying tokens in the text and hint for more robust export.
The text was updated successfully, but these errors were encountered: