PoiScript / orgize

A Rust library for parsing org-mode files.
https://poiscript.github.io/orgize/
MIT License
277 stars 34 forks source link

accessing ExportBlock content #80

Closed rrix closed 1 month ago

rrix commented 1 month ago

it would be nice if impl ExportBlock had a value() like SourceBlock, and if that was included in the html exporter:

            Event::Enter(Container::ExportBlock(the_block)) => {
                let val = the_block
                    .syntax()
                    .children()
                    .find(|e| e.kind() == orgize::SyntaxKind::BLOCK_CONTENT)
                    .into_iter()
                    .flat_map(|n| n.children_with_tokens())
                    .filter_map(orgize::ast::filter_token(orgize::SyntaxKind::TEXT))
                    .fold(String::new(), |acc, value| acc + &value);

                html_export.push_str(format!(r#"{}"#, val));
                ctx.skip();
            }
PoiScript commented 1 month ago

just implemented in commit 0b70cf04157ba57d26fbff6c096899ecef7e1e80, but not released yet.

rrix commented 1 month ago

Yay :)