Skip to content

Commit

Permalink
Merge branch 'main' into feat/servings
Browse files Browse the repository at this point in the history
  • Loading branch information
dubadub committed Jan 26, 2025
2 parents c33cafe + 7fcf655 commit af75c6a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h1>cooklang-rs playground</h1>
<option value="ast">AST</option>
<option value="stdmeta">Standard metadata</option>
</select>
<div hidden id="servingscontainer">
<div id="servingscontainer">
<label for="servings">Servings</label>
<input type="number" name="servings" id="servings" />
</div>
Expand Down
10 changes: 5 additions & 5 deletions playground/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cooklang::ast::build_ast;
use cooklang::error::SourceReport;
use cooklang::metadata::{NameAndUrl, RecipeTime};
use cooklang::metadata::{CooklangValueExt, NameAndUrl, RecipeTime};
use cooklang::{parser::PullParser, Extensions};
use cooklang::{Converter, CooklangParser, IngredientReferenceTarget, Item};
use std::fmt::Write;
Expand Down Expand Up @@ -69,7 +69,7 @@ impl State {
format!("{ast:#?}")
}
}
None => "<no ouput>".to_string(),
None => "<no output>".to_string(),
};
FallibleResult::new(value, report, input)
}
Expand All @@ -84,7 +84,7 @@ impl State {
format!("{r:#?}")
}
}
None => "<no ouput>".to_string(),
None => "<no output>".to_string(),
};
FallibleResult::new(value, report, input)
}
Expand All @@ -100,7 +100,7 @@ impl State {
};
render(r, self.parser.converter())
}
None => "<no ouput>".to_string(),
None => "<no output>".to_string(),
};
FallibleResult::new(value, report, input)
}
Expand Down Expand Up @@ -174,7 +174,7 @@ fn render(r: cooklang::ScaledRecipe, converter: &Converter) -> String {
ul {
@for (key, value) in &r.metadata.map {
li.metadata {
span.key { (key.as_str().unwrap_or("<not string key>")) } ":" (value.as_str().unwrap_or("<not string value>")) // TODO
span.key { (key.as_str_like().unwrap_or_else(|| format!("{key:?}").into())) } ":" (value.as_str_like().unwrap_or_else(|| format!("{value:?}").into()))
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl<T> PassResult<T> {

/// Transform into a common Rust [`Result`]
///
/// If the result is valid, the [`Ok`] variant holds the ouput and a
/// If the result is valid, the [`Ok`] variant holds the output and a
/// report with only warnings. Otherwise [`Err`] holds a report with the
/// errors (and warnings).
pub fn into_result(mut self) -> Result<(T, SourceReport), SourceReport> {
Expand All @@ -400,7 +400,7 @@ impl<T> PassResult<T> {
self.report
}

/// Transform into the ouput discarding errors/warnings
/// Transform into the output discarding errors/warnings
pub fn into_output(self) -> Option<T> {
self.output
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl CooklangParser {

/// Creates a new extended parser
///
/// This enables all extensions and uses the bunlded units.
/// This enables all extensions and uses the bundled units.
/// It is encouraged to reuse the parser and not rebuild it every time.
#[cfg(feature = "bundled_units")]
pub fn extended() -> Self {
Expand Down

0 comments on commit af75c6a

Please sign in to comment.