about summary refs log tree commit diff
path: root/markup/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'markup/src/lib.rs')
-rw-r--r--markup/src/lib.rs107
1 files changed, 1 insertions, 106 deletions
diff --git a/markup/src/lib.rs b/markup/src/lib.rs
index 7add951..c224ad7 100644
--- a/markup/src/lib.rs
+++ b/markup/src/lib.rs
@@ -1,107 +1,2 @@
-mod breakdown;
-mod intra;
+pub mod legacy;
 pub mod lineup;
-mod state;
-
-use std::ops::Deref;
-
-use bempline::{Document, Options};
-
-use crate::state::State;
-pub use lineup::InterlinkSolver;
-
-pub fn process(raw: &str) -> Markup {
-	let mut state = State::default();
-
-	for line in raw.lines() {
-		state.process_line(line)
-	}
-
-	state.done()
-}
-
-pub struct Markup {
-	content: String,
-	fill: Vec<Fill>,
-}
-
-impl Markup {
-	pub fn fill(&self) -> &[Fill] {
-		&self.fill
-	}
-
-	pub fn content(&self) -> &str {
-		&self.content
-	}
-
-	pub fn into_content(self) -> String {
-		self.content
-	}
-
-	pub fn into_document(self) -> Result<Document, String> {
-		let Ok(mut doc) = Document::from_str(&self.content, Options::default()) else {
-			return Err(self.content);
-		};
-
-		self.fill_document(&mut doc);
-
-		Ok(doc)
-	}
-
-	pub fn fill_document(&self, doc: &mut Document) {
-		for fill in &self.fill {
-			doc.set(&fill.key, &fill.content);
-		}
-	}
-}
-
-impl Deref for Markup {
-	type Target = String;
-
-	fn deref(&self) -> &Self::Target {
-		&self.content
-	}
-}
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Fill {
-	pub key: String,
-	pub content: String,
-}
-
-#[cfg(test)]
-mod document_test {
-	use crate::process;
-
-	const BASE: &str = "test/markup";
-	fn test_files(test: &str) {
-		let input_path = format!("{BASE}/{test}/input.html");
-		let output_path = format!("{BASE}/{test}/output.html");
-
-		let input = std::fs::read_to_string(input_path).unwrap();
-		let output = std::fs::read_to_string(output_path).unwrap();
-
-		let actual = process(&input).into_document().unwrap().compile();
-
-		assert_eq!(actual, output)
-	}
-
-	#[test]
-	fn inserts_fill() {
-		let input = "[@fill main]\nwords!\n[@fill-end]\n{main}";
-		let expected = "<p>\nwords!\n</p>";
-		let markup = process(input);
-		let doc = markup.into_document().unwrap().compile();
-		assert_eq!(doc, expected)
-	}
-
-	#[test]
-	fn fill_restores_paragraphs() {
-		test_files("fill paragraphs");
-	}
-
-	#[test]
-	fn parses_complicated_fill() {
-		test_files("complicated fill");
-	}
-}