Compare commits

..

No commits in common. "e622d9fa6b81a7051558fa3865ed3cc0968b3928" and "13863a68f7e0187ebeefcae5cd6f0e5165004052" have entirely different histories.

74 changed files with 423 additions and 804 deletions

View File

@ -44,11 +44,6 @@ path = "src/lib.rs"
path = "src/bin_wasm.rs"
required-features = ["wasm"]
[[bin]]
name = "wasm_test"
path = "src/bin_wasm_test.rs"
required-features = ["wasm_test"]
[dependencies]
futures = { version = "0.3.28", optional = true }
nom = "7.1.1"
@ -57,7 +52,6 @@ opentelemetry-otlp = { version = "0.13.0", optional = true }
opentelemetry-semantic-conventions = { version = "0.12.0", optional = true }
serde = { version = "1.0.193", optional = true, features = ["derive"] }
serde-wasm-bindgen = { version = "0.6.3", optional = true }
serde_json = { version = "1.0.108", optional = true }
tokio = { version = "1.30.0", optional = true, default-features = false, features = ["rt", "rt-multi-thread"] }
tracing = { version = "0.1.37", optional = true }
tracing-opentelemetry = { version = "0.20.0", optional = true }
@ -75,7 +69,6 @@ foreign_document_test = ["compare", "dep:futures", "tokio/sync", "dep:walkdir",
tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"]
event_count = []
wasm = ["dep:serde", "dep:wasm-bindgen", "dep:serde-wasm-bindgen"]
wasm_test = ["wasm", "dep:serde_json", "tokio/process", "tokio/macros"]
# Optimized build for any sort of release.
[profile.release-lto]

View File

@ -34,10 +34,6 @@ wasm:
> cargo build --target=wasm32-unknown-unknown --profile wasm --bin wasm --features wasm
> wasm-bindgen --target web --out-dir target/wasm32-unknown-unknown/js target/wasm32-unknown-unknown/wasm/wasm.wasm
.PHONY: run_wasm
run_wasm:
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test | jq
.PHONY: clean
clean:
> cargo clean

View File

@ -1,4 +1,3 @@
#![feature(exit_status_error)]
#![feature(round_char_boundary)]
#![feature(exact_size_is_empty)]
use std::io::Read;
@ -6,8 +5,6 @@ use std::io::Read;
use organic::compare::run_anonymous_compare;
use organic::compare::run_compare_on_file;
mod util;
#[cfg(feature = "tracing")]
use crate::init_tracing::init_telemetry;
#[cfg(feature = "tracing")]

View File

@ -1,6 +1,10 @@
#![no_main]
use wasm::wasm_parse_org;
use organic::parser::parse_with_settings;
use organic::settings::GlobalSettings;
use wasm::ParseResult;
use wasm::ToWasm;
use wasm::ToWasmContext;
use wasm_bindgen::prelude::wasm_bindgen;
mod error;
@ -8,6 +12,16 @@ mod wasm;
#[wasm_bindgen]
pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue {
let rust_parsed = wasm_parse_org(org_contents);
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)),
};
serde_wasm_bindgen::to_value(&rust_parsed).unwrap()
}

View File

@ -1,72 +0,0 @@
#![feature(exact_size_is_empty)]
#![feature(exit_status_error)]
use std::io::Read;
use organic::settings::GlobalSettings;
use wasm::wasm_parse_org;
mod error;
mod util;
mod wasm;
#[cfg(feature = "tracing")]
use crate::init_tracing::init_telemetry;
#[cfg(feature = "tracing")]
use crate::init_tracing::shutdown_telemetry;
use crate::wasm::compare::wasm_run_anonymous_compare_with_settings;
#[cfg(feature = "tracing")]
mod init_tracing;
#[cfg(not(feature = "tracing"))]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async {
let main_body_result = main_body().await;
main_body_result
})
}
#[cfg(feature = "tracing")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async {
init_telemetry()?;
let main_body_result = main_body().await;
shutdown_telemetry()?;
main_body_result
})
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
async fn main_body() -> Result<(), Box<dyn std::error::Error>> {
let args = std::env::args().skip(1);
if args.is_empty() {
let org_contents = read_stdin_to_string()?;
let wasm_result = wasm_parse_org(org_contents.as_str());
println!("{}", serde_json::to_string(&wasm_result)?);
if wasm_run_anonymous_compare_with_settings(org_contents, &GlobalSettings::default(), false)
.await?
{
} else {
Err("Diff results do not match.")?;
}
Ok(())
} else {
todo!()
// for arg in args {
// if run_compare_on_file(arg).await? {
// } else {
// Err("Diff results do not match.")?;
// }
// }
// Ok(())
}
}
fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
let mut stdin_contents = String::new();
std::io::stdin()
.lock()
.read_to_string(&mut stdin_contents)?;
Ok(stdin_contents)
}

View File

@ -4,12 +4,13 @@ use crate::compare::diff::compare_document;
use crate::compare::diff::DiffResult;
use crate::compare::parse::emacs_parse_anonymous_org_document;
use crate::compare::parse::emacs_parse_file_org_document;
use crate::compare::parse::get_emacs_version;
use crate::compare::parse::get_org_mode_version;
use crate::compare::sexp::sexp;
use crate::context::GlobalSettings;
use crate::context::LocalFileAccessInterface;
use crate::parser::parse_file_with_settings;
use crate::parser::parse_with_settings;
use crate::util::print_versions;
pub async fn run_anonymous_compare<P: AsRef<str>>(
org_contents: P,
@ -127,3 +128,12 @@ pub async fn run_compare_on_file_with_settings<'g, 's, P: AsRef<Path>>(
Ok(true)
}
async fn print_versions() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Using emacs version: {}", get_emacs_version().await?.trim());
eprintln!(
"Using org-mode version: {}",
get_org_mode_version().await?.trim()
);
Ok(())
}

View File

@ -143,3 +143,40 @@ where
}
output
}
pub async fn get_emacs_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(message "%s" (version))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}
pub async fn get_org_mode_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(org-mode)
(message "%s" (org-version nil t nil))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}

View File

@ -10,8 +10,6 @@ extern crate test;
#[cfg(feature = "compare")]
pub mod compare;
#[cfg(feature = "compare")]
mod util;
mod context;
mod error;

View File

@ -1,47 +0,0 @@
use tokio::process::Command;
pub(crate) async fn print_versions() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Using emacs version: {}", get_emacs_version().await?.trim());
eprintln!(
"Using org-mode version: {}",
get_org_mode_version().await?.trim()
);
Ok(())
}
pub(crate) async fn get_emacs_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(message "%s" (version))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}
pub(crate) async fn get_org_mode_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(org-mode)
(message "%s" (org-version nil t nil))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::AngleLink;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmAngleLink<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmAngleLink<'s>,
AngleLink<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmAngleLink {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,128 +0,0 @@
use serde::Serialize;
use super::angle_link::WasmAngleLink;
use super::babel_call::WasmBabelCall;
use super::bold::WasmBold;
use super::center_block::WasmCenterBlock;
use super::citation::WasmCitation;
use super::citation_reference::WasmCitationReference;
use super::clock::WasmClock;
use super::code::WasmCode;
use super::comment::WasmComment;
use super::comment_block::WasmCommentBlock;
use super::diary_sexp::WasmDiarySexp;
use super::document::WasmDocument;
use super::drawer::WasmDrawer;
use super::dynamic_block::WasmDynamicBlock;
use super::entity::WasmEntity;
use super::example_block::WasmExampleBlock;
use super::export_block::WasmExportBlock;
use super::export_snippet::WasmExportSnippet;
use super::fixed_width_area::WasmFixedWidthArea;
use super::footnote_definition::WasmFootnoteDefinition;
use super::footnote_reference::WasmFootnoteReference;
use super::headline::WasmHeadline;
use super::horizontal_rule::WasmHorizontalRule;
use super::inline_babel_call::WasmInlineBabelCall;
use super::inline_source_block::WasmInlineSourceBlock;
use super::italic::WasmItalic;
use super::keyword::WasmKeyword;
use super::latex_environment::WasmLatexEnvironment;
use super::latex_fragment::WasmLatexFragment;
use super::line_break::WasmLineBreak;
use super::node_property::WasmNodeProperty;
use super::org_macro::WasmOrgMacro;
use super::paragraph::WasmParagraph;
use super::plain_link::WasmPlainLink;
use super::plain_list::WasmPlainList;
use super::plain_list_item::WasmPlainListItem;
use super::plain_text::WasmPlainText;
use super::planning::WasmPlanning;
use super::property_drawer::WasmPropertyDrawer;
use super::quote_block::WasmQuoteBlock;
use super::radio_link::WasmRadioLink;
use super::radio_target::WasmRadioTarget;
use super::regular_link::WasmRegularLink;
use super::section::WasmSection;
use super::special_block::WasmSpecialBlock;
use super::src_block::WasmSrcBlock;
use super::statistics_cookie::WasmStatisticsCookie;
use super::strike_through::WasmStrikeThrough;
use super::subscript::WasmSubscript;
use super::superscript::WasmSuperscript;
use super::table::WasmTable;
use super::table_cell::WasmTableCell;
use super::table_row::WasmTableRow;
use super::target::WasmTarget;
use super::timestamp::WasmTimestamp;
use super::underline::WasmUnderline;
use super::verbatim::WasmVerbatim;
use super::verse_block::WasmVerseBlock;
#[derive(Debug, Serialize)]
#[serde(untagged)]
pub enum WasmAstNode<'s> {
// Document Nodes
Document(WasmDocument<'s>),
Headline(WasmHeadline<'s>),
Section(WasmSection<'s>),
// Elements
Paragraph(WasmParagraph<'s>),
PlainList(WasmPlainList<'s>),
PlainListItem(WasmPlainListItem<'s>),
CenterBlock(WasmCenterBlock<'s>),
QuoteBlock(WasmQuoteBlock<'s>),
SpecialBlock(WasmSpecialBlock<'s>),
DynamicBlock(WasmDynamicBlock<'s>),
FootnoteDefinition(WasmFootnoteDefinition<'s>),
Comment(WasmComment<'s>),
Drawer(WasmDrawer<'s>),
PropertyDrawer(WasmPropertyDrawer<'s>),
NodeProperty(WasmNodeProperty<'s>),
Table(WasmTable<'s>),
TableRow(WasmTableRow<'s>),
VerseBlock(WasmVerseBlock<'s>),
CommentBlock(WasmCommentBlock<'s>),
ExampleBlock(WasmExampleBlock<'s>),
ExportBlock(WasmExportBlock<'s>),
SrcBlock(WasmSrcBlock<'s>),
Clock(WasmClock<'s>),
DiarySexp(WasmDiarySexp<'s>),
Planning(WasmPlanning<'s>),
FixedWidthArea(WasmFixedWidthArea<'s>),
HorizontalRule(WasmHorizontalRule<'s>),
Keyword(WasmKeyword<'s>),
BabelCall(WasmBabelCall<'s>),
LatexEnvironment(WasmLatexEnvironment<'s>),
// Objects
Bold(WasmBold<'s>),
Italic(WasmItalic<'s>),
Underline(WasmUnderline<'s>),
StrikeThrough(WasmStrikeThrough<'s>),
Code(WasmCode<'s>),
Verbatim(WasmVerbatim<'s>),
PlainText(WasmPlainText<'s>),
RegularLink(WasmRegularLink<'s>),
RadioLink(WasmRadioLink<'s>),
RadioTarget(WasmRadioTarget<'s>),
PlainLink(WasmPlainLink<'s>),
AngleLink(WasmAngleLink<'s>),
OrgMacro(WasmOrgMacro<'s>),
Entity(WasmEntity<'s>),
LatexFragment(WasmLatexFragment<'s>),
ExportSnippet(WasmExportSnippet<'s>),
FootnoteReference(WasmFootnoteReference<'s>),
Citation(WasmCitation<'s>),
CitationReference(WasmCitationReference<'s>),
InlineBabelCall(WasmInlineBabelCall<'s>),
InlineSourceBlock(WasmInlineSourceBlock<'s>),
LineBreak(WasmLineBreak<'s>),
Target(WasmTarget<'s>),
StatisticsCookie(WasmStatisticsCookie<'s>),
Subscript(WasmSubscript<'s>),
Superscript(WasmSuperscript<'s>),
TableCell(WasmTableCell<'s>),
Timestamp(WasmTimestamp<'s>),
}
impl<'s> WasmAstNode<'s> {}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::BabelCall;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmBabelCall<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmBabelCall<'s>,
BabelCall<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmBabelCall {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Bold;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmBold<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmBold<'s>,
Bold<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmBold {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::CenterBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmCenterBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmCenterBlock<'s>,
CenterBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmCenterBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Citation;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmCitation<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmCitation<'s>,
Citation<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmCitation {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::CitationReference;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmCitationReference<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmCitationReference<'s>,
CitationReference<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmCitationReference {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Clock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmClock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmClock<'s>,
Clock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmClock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Code;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmCode<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmCode<'s>,
Code<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmCode {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Comment;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmComment<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmComment<'s>,
Comment<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmComment {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::CommentBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmCommentBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmCommentBlock<'s>,
CommentBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmCommentBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,3 +0,0 @@
mod runner;
pub(crate) use runner::wasm_run_anonymous_compare_with_settings;

View File

@ -1,44 +0,0 @@
use organic::parser::parse_with_settings;
use organic::settings::GlobalSettings;
use crate::util::print_versions;
pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
org_contents: P,
global_settings: &GlobalSettings<'g, 's>,
silent: bool,
) -> Result<bool, Box<dyn std::error::Error>> {
// TODO: This is a work-around to pretend that dos line endings do not exist. It would be better to handle the difference in line endings.
let org_contents = org_contents.as_ref().replace("\r\n", "\n");
let org_contents = org_contents.as_str();
if !silent {
print_versions().await?;
}
let rust_parsed = parse_with_settings(org_contents, global_settings)?;
// let org_sexp = emacs_parse_anonymous_org_document(org_contents, global_settings).await?;
// let (_remaining, parsed_sexp) = sexp(org_sexp.as_str()).map_err(|e| e.to_string())?;
if !silent {
println!("{}\n\n\n", org_contents);
// println!("{}", org_sexp);
println!("{:#?}", rust_parsed);
}
// We do the diffing after printing out both parsed forms in case the diffing panics
// let diff_result = compare_document(&parsed_sexp, &rust_parsed)?;
// if !silent {
// diff_result.print(org_contents)?;
// }
// if diff_result.is_bad() {
// return Ok(false);
// } else if !silent {
// println!(
// "{color}Entire document passes.{reset}",
// color = DiffResult::foreground_color(0, 255, 0),
// reset = DiffResult::reset_color(),
// );
// }
Ok(true)
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::DiarySexp;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmDiarySexp<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmDiarySexp<'s>,
DiarySexp<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmDiarySexp {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,72 +1,33 @@
use std::marker::PhantomData;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
additional_properties: Vec<(String, &'s str)>,
children: Vec<WasmAstNode<'s>>,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmDocument<'s>,
Document<'s>,
original,
wasm_context,
standard_properties,
{
let additional_properties: Vec<(String, &str)> = original
.get_additional_properties()
.map(|node_property| {
(
format!(":{}", node_property.property_name.to_uppercase()),
node_property.value.unwrap_or(""),
)
})
.collect();
let children = original
.zeroth_section
.iter()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode<'_>>::into)
})
.chain(original.children.iter().map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode<'_>>::into)
}))
.collect::<Result<Vec<_>, _>>()?;
// let children = original
// .children
// .iter()
// .map(|child| {
// child
// .to_wasm(wasm_context.clone())
// .map(Into::<WasmAstNode<'_>>::into)
// })
// .collect::<Result<Vec<_>, _>>()?;
Ok(WasmDocument {
standard_properties,
additional_properties,
children,
children: Vec::new(),
phantom: PhantomData,
})
}
);
impl<'s> Into<WasmAstNode<'s>> for WasmDocument<'s> {
fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Document(self)
}
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Drawer;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmDrawer<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmDrawer<'s>,
Drawer<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmDrawer {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::DynamicBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmDynamicBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmDynamicBlock<'s>,
DynamicBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmDynamicBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Entity;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmEntity<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmEntity<'s>,
Entity<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmEntity {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::ExampleBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmExampleBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmExampleBlock<'s>,
ExampleBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmExampleBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::ExportBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmExportBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmExportBlock<'s>,
ExportBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmExportBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::ExportSnippet;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmExportSnippet<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmExportSnippet<'s>,
ExportSnippet<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmExportSnippet {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::FixedWidthArea;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmFixedWidthArea<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmFixedWidthArea<'s>,
FixedWidthArea<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmFixedWidthArea {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::FootnoteDefinition;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmFootnoteDefinition<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmFootnoteDefinition<'s>,
FootnoteDefinition<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmFootnoteDefinition {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::FootnoteReference;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmFootnoteReference<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmFootnoteReference<'s>,
FootnoteReference<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmFootnoteReference {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,40 +1,33 @@
use std::marker::PhantomData;
use organic::types::Heading;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "headline")]
pub(crate) struct WasmHeadline<'s> {
#[serde(rename = "org-data")]
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmHeadline<'s>,
Heading<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmHeadline {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,
})
}
);
impl<'s> Into<WasmAstNode<'s>> for WasmHeadline<'s> {
fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Headline(self)
}
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::HorizontalRule;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmHorizontalRule<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmHorizontalRule<'s>,
HorizontalRule<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmHorizontalRule {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::InlineBabelCall;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmInlineBabelCall<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmInlineBabelCall<'s>,
InlineBabelCall<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmInlineBabelCall {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::InlineSourceBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmInlineSourceBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmInlineSourceBlock<'s>,
InlineSourceBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmInlineSourceBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Italic;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmItalic<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmItalic<'s>,
Italic<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmItalic {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Keyword;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmKeyword<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmKeyword<'s>,
Keyword<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmKeyword {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::LatexEnvironment;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmLatexEnvironment<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmLatexEnvironment<'s>,
LatexEnvironment<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmLatexEnvironment {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::LatexFragment;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmLatexFragment<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmLatexFragment<'s>,
LatexFragment<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmLatexFragment {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::LineBreak;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmLineBreak<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmLineBreak<'s>,
LineBreak<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmLineBreak {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -2,7 +2,7 @@
///
/// 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) => {
($ostruct:ty, $istruct:ty, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
@ -10,9 +10,7 @@ macro_rules! to_wasm {
&self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> {
let $original = self;
let $standard_properties =
self.to_wasm_standard_properties($wasm_context.clone())?;
let $standard_properties = self.to_wasm_standard_properties($wasm_context)?;
$fnbody
}
}

View File

@ -1,5 +1,4 @@
mod angle_link;
mod ast_node;
mod babel_call;
mod bold;
mod center_block;
@ -9,8 +8,6 @@ mod clock;
mod code;
mod comment;
mod comment_block;
#[cfg(feature = "wasm_test")]
pub(crate) mod compare;
mod diary_sexp;
mod document;
mod drawer;
@ -64,7 +61,6 @@ mod underline;
mod verbatim;
mod verse_block;
pub(crate) use parse_result::wasm_parse_org;
pub(crate) use parse_result::ParseResult;
pub(crate) use to_wasm::ToWasm;
pub(crate) use to_wasm::ToWasmContext;

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::NodeProperty;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmNodeProperty<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmNodeProperty<'s>,
NodeProperty<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmNodeProperty {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::OrgMacro;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmOrgMacro<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmOrgMacro<'s>,
OrgMacro<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmOrgMacro {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Paragraph;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmParagraph<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmParagraph<'s>,
Paragraph<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmParagraph {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,12 +1,9 @@
use organic::parser::parse_with_settings;
use organic::settings::GlobalSettings;
use serde::Deserialize;
use serde::Serialize;
use super::document::WasmDocument;
use super::ToWasm;
use super::ToWasmContext;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "status", content = "content")]
pub(crate) enum ParseResult<'s> {
#[serde(rename = "success")]
@ -15,18 +12,3 @@ pub(crate) enum ParseResult<'s> {
#[serde(rename = "error")]
Error(String),
}
pub(crate) 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
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::PlainLink;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPlainLink<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPlainLink<'s>,
PlainLink<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPlainLink {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::PlainList;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPlainList<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPlainList<'s>,
PlainList<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPlainList {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::PlainListItem;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPlainListItem<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPlainListItem<'s>,
PlainListItem<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPlainListItem {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::PlainText;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPlainText<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPlainText<'s>,
PlainText<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPlainText {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Planning;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPlanning<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPlanning<'s>,
Planning<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPlanning {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::PropertyDrawer;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmPropertyDrawer<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmPropertyDrawer<'s>,
PropertyDrawer<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmPropertyDrawer {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::QuoteBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmQuoteBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmQuoteBlock<'s>,
QuoteBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmQuoteBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::RadioLink;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmRadioLink<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmRadioLink<'s>,
RadioLink<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmRadioLink {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::RadioTarget;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmRadioTarget<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmRadioTarget<'s>,
RadioTarget<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmRadioTarget {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::RegularLink;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmRegularLink<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmRegularLink<'s>,
RegularLink<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmRegularLink {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,40 +1,33 @@
use std::marker::PhantomData;
use organic::types::Section;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "section")]
pub(crate) struct WasmSection<'s> {
#[serde(rename = "org-data")]
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmSection<'s>,
Section<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmSection {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,
})
}
);
impl<'s> Into<WasmAstNode<'s>> for WasmSection<'s> {
fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Section(self)
}
}

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::SpecialBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmSpecialBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmSpecialBlock<'s>,
SpecialBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmSpecialBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::SrcBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmSrcBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmSrcBlock<'s>,
SrcBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmSrcBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -6,7 +6,7 @@ use serde::Serialize;
use super::to_wasm::ToWasmContext;
use super::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
pub(crate) struct WasmStandardProperties {
begin: usize,
end: usize,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::StatisticsCookie;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmStatisticsCookie<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmStatisticsCookie<'s>,
StatisticsCookie<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmStatisticsCookie {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::StrikeThrough;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmStrikeThrough<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmStrikeThrough<'s>,
StrikeThrough<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmStrikeThrough {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Subscript;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmSubscript<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmSubscript<'s>,
Subscript<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmSubscript {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Superscript;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmSuperscript<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmSuperscript<'s>,
Superscript<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmSuperscript {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Table;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmTable<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmTable<'s>,
Table<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmTable {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::TableCell;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmTableCell<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmTableCell<'s>,
TableCell<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmTableCell {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::TableRow;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmTableRow<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmTableRow<'s>,
TableRow<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmTableRow {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Target;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmTarget<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmTarget<'s>,
Target<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmTarget {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Timestamp;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmTimestamp<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmTimestamp<'s>,
Timestamp<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmTimestamp {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Underline;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmUnderline<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmUnderline<'s>,
Underline<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmUnderline {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::Verbatim;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmVerbatim<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmVerbatim<'s>,
Verbatim<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmVerbatim {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData;
use organic::types::VerseBlock;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -9,23 +9,22 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmVerseBlock<'s> {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmVerseBlock<'s>,
VerseBlock<'s>,
original,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
{
Ok(WasmVerseBlock {
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,