chore: Fix spelling errors

This commit is contained in:
Ed Page 2021-08-02 09:31:12 -05:00
parent 946ffb410b
commit fd9221c551
4 changed files with 14 additions and 11 deletions

View file

@ -49,7 +49,7 @@ and `right` of STAGE-DIR to check out the contents of the current
master branch of the bare git repository, which must exist in the
current working directory. It will then build the site in one of these
directories using cobalt. If successful, DEPLOY-DIR will be updated
with a symblic link pointing to generated `_site` directory.
with a symbolic link pointing to generated `_site` directory.
EOF
}

View file

@ -12,7 +12,7 @@ use crate::cobalt_model::files;
use crate::cobalt_model::permalink;
use crate::cobalt_model::Collection;
use crate::cobalt_model::{Config, Minify, SortOrder};
use crate::document::{Document, RenderContex};
use crate::document::{Document, RenderContext};
use crate::error::*;
use crate::pagination;
@ -221,7 +221,7 @@ fn generate_doc(
liquid::model::Value::Object(doc.attributes.clone()),
);
{
let render_context = RenderContex {
let render_context = RenderContext {
parser: &context.liquid,
markdown: &context.markdown,
vimwiki: &context.vimwiki,
@ -242,7 +242,7 @@ fn generate_doc(
"page".into(),
liquid::model::Value::Object(doc.attributes.clone()),
);
let render_context = RenderContex {
let render_context = RenderContext {
parser: &context.liquid,
markdown: &context.markdown,
vimwiki: &context.vimwiki,

View file

@ -17,7 +17,7 @@ use crate::cobalt_model::slug;
use crate::cobalt_model::Minify;
use crate::error::*;
pub struct RenderContex<'a> {
pub struct RenderContext<'a> {
pub parser: &'a cobalt_model::Liquid,
pub markdown: &'a cobalt_model::Markdown,
pub vimwiki: &'a cobalt_model::Vimwiki,
@ -26,12 +26,12 @@ pub struct RenderContex<'a> {
}
#[cfg(not(feature = "html-minifier"))]
fn minify_if_enabled(html: String, _context: &RenderContex, _file_path: &Path) -> Result<String> {
fn minify_if_enabled(html: String, _context: &RenderContext, _file_path: &Path) -> Result<String> {
Ok(html)
}
#[cfg(feature = "html-minifier")]
fn minify_if_enabled(html: String, context: &RenderContex, file_path: &Path) -> Result<String> {
fn minify_if_enabled(html: String, context: &RenderContext, file_path: &Path) -> Result<String> {
let extension = file_path.extension().unwrap_or_else(Default::default);
if context.minify.html && (extension == "html" || extension == "htm") {
Ok(html_minifier::minify(html)?)
@ -299,7 +299,7 @@ impl Document {
/// Takes `content` string and returns rendered HTML. This function doesn't
/// take `"extends"` attribute into account. This function can be used for
/// rendering content or excerpt.
fn render_html(&self, content: &str, context: &RenderContex) -> Result<String> {
fn render_html(&self, content: &str, context: &RenderContext) -> Result<String> {
let html = if self.front.templated {
let template = context.parser.parse(content)?;
template.render(context.globals)?
@ -322,7 +322,7 @@ impl Document {
/// given, or extracted from the content, if `excerpt_separator` is not
/// empty. When neither condition applies, the excerpt is set to the `Nil`
/// value.
pub fn render_excerpt(&mut self, context: &RenderContex) -> Result<()> {
pub fn render_excerpt(&mut self, context: &RenderContext) -> Result<()> {
let value = if let Some(excerpt_str) = self.front.excerpt.as_ref() {
let excerpt = self.render_html(excerpt_str, context)?;
Value::scalar(excerpt)
@ -345,7 +345,7 @@ impl Document {
/// Renders the content and adds it to attributes of the document.
///
/// When we say "content" we mean only this document without extended layout.
pub fn render_content(&mut self, context: &RenderContex) -> Result<()> {
pub fn render_content(&mut self, context: &RenderContext) -> Result<()> {
let content_html = self.render_html(&self.content, context)?;
self.attributes
.insert("content".into(), Value::scalar(content_html));
@ -359,7 +359,7 @@ impl Document {
/// * layout may be inserted to layouts cache
pub fn render(
&mut self,
context: &RenderContex,
context: &RenderContext,
layouts: &HashMap<String, String>,
) -> Result<String> {
if let Some(ref layout) = self.front.layout {

3
typos.toml Normal file
View file

@ -0,0 +1,3 @@
[default.extend-words]
# flate crate
flate = "flate"