diff --git a/src/bin_wasm.rs b/src/bin_wasm.rs index 0791cca..a138464 100644 --- a/src/bin_wasm.rs +++ b/src/bin_wasm.rs @@ -1,10 +1,28 @@ -use organic::wasm::wasm_parse_org; +use organic::parser::parse_with_settings; +use organic::settings::GlobalSettings; +use organic::wasm::ParseResult; +use organic::wasm::ToWasm; +use organic::wasm::ToWasmContext; use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen] pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue { - let rust_parsed = wasm_parse_org(org_contents); - serde_wasm_bindgen::to_value(&rust_parsed).unwrap() + let rust_parsed = match parse_with_settings(org_contents, &GlobalSettings::default()) { + Ok(document) => document, + Err(err) => { + return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err))) + .unwrap(); + } + }; + let to_wasm_context = ToWasmContext::new(org_contents); + let wasm_document = match rust_parsed.to_wasm(to_wasm_context) { + Ok(document) => document, + Err(err) => { + return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err))) + .unwrap(); + } + }; + serde_wasm_bindgen::to_value(&ParseResult::Success(wasm_document)).unwrap() } fn main() -> Result<(), Box> { diff --git a/src/wasm/angle_link.rs b/src/wasm/angle_link.rs index 6dfa2c7..0f95252 100644 --- a/src/wasm/angle_link.rs +++ b/src/wasm/angle_link.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmAngleLink<'s, 'p> { +pub struct WasmAngleLink<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/babel_call.rs b/src/wasm/babel_call.rs index b1b2b54..071e0d5 100644 --- a/src/wasm/babel_call.rs +++ b/src/wasm/babel_call.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmBabelCall<'s, 'p> { +pub struct WasmBabelCall<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/bold.rs b/src/wasm/bold.rs index c306580..678140f 100644 --- a/src/wasm/bold.rs +++ b/src/wasm/bold.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmBold<'s, 'p> { +pub struct WasmBold<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/center_block.rs b/src/wasm/center_block.rs index bddcd4e..f77e799 100644 --- a/src/wasm/center_block.rs +++ b/src/wasm/center_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmCenterBlock<'s, 'p> { +pub struct WasmCenterBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/citation.rs b/src/wasm/citation.rs index 01dac3a..5911976 100644 --- a/src/wasm/citation.rs +++ b/src/wasm/citation.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmCitation<'s, 'p> { +pub struct WasmCitation<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/citation_reference.rs b/src/wasm/citation_reference.rs index c450dcc..36851f9 100644 --- a/src/wasm/citation_reference.rs +++ b/src/wasm/citation_reference.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmCitationReference<'s, 'p> { +pub struct WasmCitationReference<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/clock.rs b/src/wasm/clock.rs index 80d6527..1170747 100644 --- a/src/wasm/clock.rs +++ b/src/wasm/clock.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmClock<'s, 'p> { +pub struct WasmClock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/code.rs b/src/wasm/code.rs index afdf975..b4511ee 100644 --- a/src/wasm/code.rs +++ b/src/wasm/code.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmCode<'s, 'p> { +pub struct WasmCode<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/comment.rs b/src/wasm/comment.rs index 27bc0ef..9c69a90 100644 --- a/src/wasm/comment.rs +++ b/src/wasm/comment.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmComment<'s, 'p> { +pub struct WasmComment<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/comment_block.rs b/src/wasm/comment_block.rs index 575af25..430e460 100644 --- a/src/wasm/comment_block.rs +++ b/src/wasm/comment_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmCommentBlock<'s, 'p> { +pub struct WasmCommentBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/diary_sexp.rs b/src/wasm/diary_sexp.rs index 8f53d5f..0c0dffb 100644 --- a/src/wasm/diary_sexp.rs +++ b/src/wasm/diary_sexp.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmDiarySexp<'s, 'p> { +pub struct WasmDiarySexp<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/document.rs b/src/wasm/document.rs index fbdd08f..ddcee77 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -46,12 +46,12 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::>::into) }) .chain(original.children.iter().map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::>::into) })) .collect::, _>>()?; diff --git a/src/wasm/drawer.rs b/src/wasm/drawer.rs index 29345d6..7fe3ee2 100644 --- a/src/wasm/drawer.rs +++ b/src/wasm/drawer.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmDrawer<'s, 'p> { +pub struct WasmDrawer<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/dynamic_block.rs b/src/wasm/dynamic_block.rs index eb2d9f0..7947ed6 100644 --- a/src/wasm/dynamic_block.rs +++ b/src/wasm/dynamic_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmDynamicBlock<'s, 'p> { +pub struct WasmDynamicBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/entity.rs b/src/wasm/entity.rs index 8f0fa48..14f952d 100644 --- a/src/wasm/entity.rs +++ b/src/wasm/entity.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmEntity<'s, 'p> { +pub struct WasmEntity<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/example_block.rs b/src/wasm/example_block.rs index 616faa7..4cd403c 100644 --- a/src/wasm/example_block.rs +++ b/src/wasm/example_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmExampleBlock<'s, 'p> { +pub struct WasmExampleBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/export_block.rs b/src/wasm/export_block.rs index cb6fda7..0cb9d6d 100644 --- a/src/wasm/export_block.rs +++ b/src/wasm/export_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmExportBlock<'s, 'p> { +pub struct WasmExportBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/export_snippet.rs b/src/wasm/export_snippet.rs index 0198ae0..49baa08 100644 --- a/src/wasm/export_snippet.rs +++ b/src/wasm/export_snippet.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmExportSnippet<'s, 'p> { +pub struct WasmExportSnippet<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/fixed_width_area.rs b/src/wasm/fixed_width_area.rs index b746f8d..d67db36 100644 --- a/src/wasm/fixed_width_area.rs +++ b/src/wasm/fixed_width_area.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmFixedWidthArea<'s, 'p> { +pub struct WasmFixedWidthArea<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/footnote_definition.rs b/src/wasm/footnote_definition.rs index a8bd9c7..84ba5d9 100644 --- a/src/wasm/footnote_definition.rs +++ b/src/wasm/footnote_definition.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmFootnoteDefinition<'s, 'p> { +pub struct WasmFootnoteDefinition<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/footnote_reference.rs b/src/wasm/footnote_reference.rs index 8ae0381..9df8924 100644 --- a/src/wasm/footnote_reference.rs +++ b/src/wasm/footnote_reference.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmFootnoteReference<'s, 'p> { +pub struct WasmFootnoteReference<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/headline.rs b/src/wasm/headline.rs index dbaab62..56da464 100644 --- a/src/wasm/headline.rs +++ b/src/wasm/headline.rs @@ -10,7 +10,7 @@ use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "headline")] -pub(crate) struct WasmHeadline<'s, 'p> { +pub struct WasmHeadline<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/horizontal_rule.rs b/src/wasm/horizontal_rule.rs index bb2b0d8..f16866d 100644 --- a/src/wasm/horizontal_rule.rs +++ b/src/wasm/horizontal_rule.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmHorizontalRule<'s, 'p> { +pub struct WasmHorizontalRule<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/inline_babel_call.rs b/src/wasm/inline_babel_call.rs index 84f75a6..555f68a 100644 --- a/src/wasm/inline_babel_call.rs +++ b/src/wasm/inline_babel_call.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmInlineBabelCall<'s, 'p> { +pub struct WasmInlineBabelCall<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/inline_source_block.rs b/src/wasm/inline_source_block.rs index 49f2594..9a861e3 100644 --- a/src/wasm/inline_source_block.rs +++ b/src/wasm/inline_source_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmInlineSourceBlock<'s, 'p> { +pub struct WasmInlineSourceBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/italic.rs b/src/wasm/italic.rs index 40fd465..b91d4bd 100644 --- a/src/wasm/italic.rs +++ b/src/wasm/italic.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmItalic<'s, 'p> { +pub struct WasmItalic<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/keyword.rs b/src/wasm/keyword.rs index 7b9003e..6002505 100644 --- a/src/wasm/keyword.rs +++ b/src/wasm/keyword.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmKeyword<'s, 'p> { +pub struct WasmKeyword<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/latex_environment.rs b/src/wasm/latex_environment.rs index 7a65390..239de21 100644 --- a/src/wasm/latex_environment.rs +++ b/src/wasm/latex_environment.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmLatexEnvironment<'s, 'p> { +pub struct WasmLatexEnvironment<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/latex_fragment.rs b/src/wasm/latex_fragment.rs index 98416fa..f7e792e 100644 --- a/src/wasm/latex_fragment.rs +++ b/src/wasm/latex_fragment.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmLatexFragment<'s, 'p> { +pub struct WasmLatexFragment<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/line_break.rs b/src/wasm/line_break.rs index 949770d..8a78a00 100644 --- a/src/wasm/line_break.rs +++ b/src/wasm/line_break.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmLineBreak<'s, 'p> { +pub struct WasmLineBreak<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/macros.rs b/src/wasm/macros.rs index 2323dc7..e813f6a 100644 --- a/src/wasm/macros.rs +++ b/src/wasm/macros.rs @@ -3,11 +3,11 @@ /// This exists to make changing the type signature easier. macro_rules! to_wasm { ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => { - impl<'s, 'p> ToWasm for $istruct { + impl<'s, 'p> ToWasm<'p> for $istruct { type Output = $ostruct; fn to_wasm( - &self, + &'p self, $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, ) -> Result { let $original = self; diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 6690765..1046b44 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -64,7 +64,6 @@ mod verse_block; pub use ast_node::WasmAstNode; pub use document::WasmDocument; -pub use parse_result::wasm_parse_org; pub use parse_result::ParseResult; -pub(crate) use to_wasm::ToWasm; -pub(crate) use to_wasm::ToWasmContext; +pub use to_wasm::ToWasm; +pub use to_wasm::ToWasmContext; diff --git a/src/wasm/node_property.rs b/src/wasm/node_property.rs index 9b06b93..710409c 100644 --- a/src/wasm/node_property.rs +++ b/src/wasm/node_property.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmNodeProperty<'s, 'p> { +pub struct WasmNodeProperty<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/org_macro.rs b/src/wasm/org_macro.rs index 7bdff9f..49e4ee7 100644 --- a/src/wasm/org_macro.rs +++ b/src/wasm/org_macro.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmOrgMacro<'s, 'p> { +pub struct WasmOrgMacro<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/paragraph.rs b/src/wasm/paragraph.rs index 96610c7..bd139f6 100644 --- a/src/wasm/paragraph.rs +++ b/src/wasm/paragraph.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmParagraph<'s, 'p> { +pub struct WasmParagraph<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/parse_result.rs b/src/wasm/parse_result.rs index 884a26d..9d88fb2 100644 --- a/src/wasm/parse_result.rs +++ b/src/wasm/parse_result.rs @@ -1,10 +1,6 @@ use serde::Serialize; use super::document::WasmDocument; -use super::ToWasm; -use super::ToWasmContext; -use crate::parser::parse_with_settings; -use crate::settings::GlobalSettings; #[derive(Debug, Serialize)] #[serde(tag = "status", content = "content")] @@ -15,18 +11,3 @@ pub enum ParseResult<'s, 'p> { #[serde(rename = "error")] Error(String), } - -pub fn wasm_parse_org(org_contents: &str) -> ParseResult<'_, '_> { - let global_settings = GlobalSettings::default(); - let to_wasm_context = ToWasmContext::new(org_contents); - let rust_parsed = match parse_with_settings(org_contents, &global_settings) - .map(|document| document.to_wasm(to_wasm_context)) - .map(|wasm_document| match wasm_document { - Ok(wasm_document) => ParseResult::Success(wasm_document), - Err(err) => ParseResult::Error(format!("{:?}", err)), - }) { - Ok(wasm_document) => wasm_document, - Err(err) => ParseResult::Error(format!("{:?}", err)), - }; - rust_parsed -} diff --git a/src/wasm/plain_link.rs b/src/wasm/plain_link.rs index 93359dd..3f2c63f 100644 --- a/src/wasm/plain_link.rs +++ b/src/wasm/plain_link.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPlainLink<'s, 'p> { +pub struct WasmPlainLink<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/plain_list.rs b/src/wasm/plain_list.rs index 48ec401..89eed37 100644 --- a/src/wasm/plain_list.rs +++ b/src/wasm/plain_list.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPlainList<'s, 'p> { +pub struct WasmPlainList<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/plain_list_item.rs b/src/wasm/plain_list_item.rs index 6c9b8cc..af237ea 100644 --- a/src/wasm/plain_list_item.rs +++ b/src/wasm/plain_list_item.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPlainListItem<'s, 'p> { +pub struct WasmPlainListItem<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/plain_text.rs b/src/wasm/plain_text.rs index c715a1e..d4848e4 100644 --- a/src/wasm/plain_text.rs +++ b/src/wasm/plain_text.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPlainText<'s, 'p> { +pub struct WasmPlainText<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/planning.rs b/src/wasm/planning.rs index 73eb862..3a3f325 100644 --- a/src/wasm/planning.rs +++ b/src/wasm/planning.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPlanning<'s, 'p> { +pub struct WasmPlanning<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/property_drawer.rs b/src/wasm/property_drawer.rs index 0a84aa3..7655762 100644 --- a/src/wasm/property_drawer.rs +++ b/src/wasm/property_drawer.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmPropertyDrawer<'s, 'p> { +pub struct WasmPropertyDrawer<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/quote_block.rs b/src/wasm/quote_block.rs index 82b7e72..24a19f9 100644 --- a/src/wasm/quote_block.rs +++ b/src/wasm/quote_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmQuoteBlock<'s, 'p> { +pub struct WasmQuoteBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/radio_link.rs b/src/wasm/radio_link.rs index 8335ef5..af8fe56 100644 --- a/src/wasm/radio_link.rs +++ b/src/wasm/radio_link.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmRadioLink<'s, 'p> { +pub struct WasmRadioLink<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/radio_target.rs b/src/wasm/radio_target.rs index 32dbe42..f816c50 100644 --- a/src/wasm/radio_target.rs +++ b/src/wasm/radio_target.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmRadioTarget<'s, 'p> { +pub struct WasmRadioTarget<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/regular_link.rs b/src/wasm/regular_link.rs index b26043a..85ba05c 100644 --- a/src/wasm/regular_link.rs +++ b/src/wasm/regular_link.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmRegularLink<'s, 'p> { +pub struct WasmRegularLink<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/section.rs b/src/wasm/section.rs index c9739e5..3e9e8d8 100644 --- a/src/wasm/section.rs +++ b/src/wasm/section.rs @@ -10,7 +10,7 @@ use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "section")] -pub(crate) struct WasmSection<'s, 'p> { +pub struct WasmSection<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/special_block.rs b/src/wasm/special_block.rs index 9b5346a..124c107 100644 --- a/src/wasm/special_block.rs +++ b/src/wasm/special_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmSpecialBlock<'s, 'p> { +pub struct WasmSpecialBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/src_block.rs b/src/wasm/src_block.rs index 237a363..a8d8a53 100644 --- a/src/wasm/src_block.rs +++ b/src/wasm/src_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmSrcBlock<'s, 'p> { +pub struct WasmSrcBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/statistics_cookie.rs b/src/wasm/statistics_cookie.rs index 339663a..36d4adf 100644 --- a/src/wasm/statistics_cookie.rs +++ b/src/wasm/statistics_cookie.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmStatisticsCookie<'s, 'p> { +pub struct WasmStatisticsCookie<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/strike_through.rs b/src/wasm/strike_through.rs index efcf63f..1f10978 100644 --- a/src/wasm/strike_through.rs +++ b/src/wasm/strike_through.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmStrikeThrough<'s, 'p> { +pub struct WasmStrikeThrough<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/subscript.rs b/src/wasm/subscript.rs index 80b6e05..5c382a1 100644 --- a/src/wasm/subscript.rs +++ b/src/wasm/subscript.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmSubscript<'s, 'p> { +pub struct WasmSubscript<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/superscript.rs b/src/wasm/superscript.rs index a3f6899..2b42685 100644 --- a/src/wasm/superscript.rs +++ b/src/wasm/superscript.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmSuperscript<'s, 'p> { +pub struct WasmSuperscript<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/table.rs b/src/wasm/table.rs index 3a6ef16..4ce9135 100644 --- a/src/wasm/table.rs +++ b/src/wasm/table.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmTable<'s, 'p> { +pub struct WasmTable<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/table_cell.rs b/src/wasm/table_cell.rs index f775109..c26d1b6 100644 --- a/src/wasm/table_cell.rs +++ b/src/wasm/table_cell.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmTableCell<'s, 'p> { +pub struct WasmTableCell<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/table_row.rs b/src/wasm/table_row.rs index 99bf523..d4237d4 100644 --- a/src/wasm/table_row.rs +++ b/src/wasm/table_row.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmTableRow<'s, 'p> { +pub struct WasmTableRow<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/target.rs b/src/wasm/target.rs index 3472a8b..eafeaa0 100644 --- a/src/wasm/target.rs +++ b/src/wasm/target.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmTarget<'s, 'p> { +pub struct WasmTarget<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/timestamp.rs b/src/wasm/timestamp.rs index f8e1182..ccaa89e 100644 --- a/src/wasm/timestamp.rs +++ b/src/wasm/timestamp.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmTimestamp<'s, 'p> { +pub struct WasmTimestamp<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/to_wasm.rs b/src/wasm/to_wasm.rs index cd3f692..9e5dc0d 100644 --- a/src/wasm/to_wasm.rs +++ b/src/wasm/to_wasm.rs @@ -1,9 +1,9 @@ use crate::error::CustomError; -pub(crate) trait ToWasm { +pub trait ToWasm<'p> { type Output; - fn to_wasm(&self, full_document: ToWasmContext<'_>) -> Result; + fn to_wasm(&'p self, full_document: ToWasmContext<'_>) -> Result; } pub(crate) trait ToWasmStandardProperties { @@ -16,12 +16,12 @@ pub(crate) trait ToWasmStandardProperties { } #[derive(Debug, Clone)] -pub(crate) struct ToWasmContext<'s> { +pub struct ToWasmContext<'s> { pub(crate) full_document: &'s str, } impl<'s> ToWasmContext<'s> { - pub(crate) fn new(full_document: &'s str) -> ToWasmContext<'s> { + pub fn new(full_document: &'s str) -> ToWasmContext<'s> { ToWasmContext { full_document } } } diff --git a/src/wasm/underline.rs b/src/wasm/underline.rs index ec94c13..3932df6 100644 --- a/src/wasm/underline.rs +++ b/src/wasm/underline.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmUnderline<'s, 'p> { +pub struct WasmUnderline<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/verbatim.rs b/src/wasm/verbatim.rs index adb3bef..17a2a8a 100644 --- a/src/wasm/verbatim.rs +++ b/src/wasm/verbatim.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmVerbatim<'s, 'p> { +pub struct WasmVerbatim<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, } diff --git a/src/wasm/verse_block.rs b/src/wasm/verse_block.rs index 8731bf6..7314361 100644 --- a/src/wasm/verse_block.rs +++ b/src/wasm/verse_block.rs @@ -10,7 +10,7 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub(crate) struct WasmVerseBlock<'s, 'p> { +pub struct WasmVerseBlock<'s, 'p> { standard_properties: WasmStandardProperties, children: Vec>, }