Skip to content

Commit

Permalink
chore: fix some typos (#111)
Browse files Browse the repository at this point in the history
Co-authored-by: Claas Augner <[email protected]>
Co-authored-by: Brian Smith <[email protected]>
  • Loading branch information
caugner and bsmth authored Jan 29, 2025
1 parent 197dde3 commit a2712cb
Show file tree
Hide file tree
Showing 30 changed files with 51 additions and 51 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Welcome to `rari`

> [!Warning]
> This project is work in progress and lacking most of its documentation.
> Anything might change and code will move a lot. We do not encourage using it yet.
> We'll have an official announcement before we migrate, so stay tuned.

# Welcome to `rari`

`rari` is the build system for [MDN](https://developer.mozilla.org).

`rari` is hosted by [MDN](https://github.com/mdn).
Expand All @@ -17,11 +16,12 @@ To get up and running, follow these steps:
Make sure you have [Rust](https://www.rust-lang.org/) installed, otherwise go to [https://rustup.rs/](https://rustup.rs/).

Clone this repository and run:

```plain
cargo run -- --help
```

### Configuation
### Configuration

Create a `.config.toml` in the current working directory.
Add the following:
Expand All @@ -41,6 +41,7 @@ Our project welcomes contributions from any member of our community.
To get started contributing, please see our [Contributor Guide](CONTRIBUTING.md).
-->

By participating in and contributing to our projects and discussions, you acknowledge that you have read and agree to our [Code of Conduct](CODE_OF_CONDUCT.md).

## Resources
Expand All @@ -55,7 +56,6 @@ To be updated...

If you have any questions, please reach out to us on [Discord](https://developer.mozilla.org/discord)


## License

This project is licensed under the [Mozilla Public License 2.0](LICENSE.md).
4 changes: 2 additions & 2 deletions crates/css-definition-syntax/src/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub fn walk<T>(
Node::Multiplier(multiplier) => {
walk(&multiplier.term, options, context)?;
}
Node::BooleanExpr(booleann_exp) => {
walk(&booleann_exp.term, options, context)?;
Node::BooleanExpr(boolean_exp) => {
walk(&boolean_exp.term, options, context)?;
}
Node::Token(_)
| Node::Property(_)
Expand Down
10 changes: 5 additions & 5 deletions crates/rari-cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ enum Commands {
Serve(ServeArgs),
/// Collect the git history.
GitHistory,
/// Self-update rari (caution if istalled from npm)
/// Self-update rari (caution if installed from npm)
Update(UpdateArgs),
/// Export json schema.
ExportSchema(ExportSchemaArgs),
Expand Down Expand Up @@ -388,9 +388,9 @@ fn main() -> Result<(), Error> {
}
if args.all || args.curriculum {
let start = std::time::Instant::now();
let curriclum_pages = build_curriculum_pages()?;
let num = curriclum_pages.len();
urls.extend(curriclum_pages);
let curriculum_pages = build_curriculum_pages()?;
let num = curriculum_pages.len();
urls.extend(curriculum_pages);
info!(
"Took: {: >10.3?} to build curriculum pages ({num})",
start.elapsed()
Expand Down Expand Up @@ -537,7 +537,7 @@ fn update(version: Option<String>) -> Result<(), Error> {
let latest = update.get_latest_release().ok();

let target_version = match (&latest, &target_release) {
(None, None) => return Err(anyhow!("No latest release, specigy a version!")),
(None, None) => return Err(anyhow!("No latest release, specify a version!")),
(None, Some(target)) => {
info!("Updating rari to {}", target.version);
&target.version
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # Build Module
//!
//! The `build` module provides functionality for building pages. The module leverages parallel
//! processing for documentzation pages to improve the efficiency of building large sets files.
//! processing for documentation pages to improve the efficiency of building large sets files.
use std::borrow::Cow;
use std::collections::HashMap;
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/cached_readers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn read_sidebar(name: &str, locale: Locale, slug: &str) -> Result<Arc<MetaSi
///
/// If the page is found in the cache, it returns `Ok(page)`.
/// If the page is not found, it returns a `DocError::NotFoundInStaticCache` error.
/// If there is aproblem with the cache, it returns a `DocError::FileCacheBroken` error.
/// If there is a problem with the cache, it returns a `DocError::FileCacheBroken` error.
///
/// # Arguments
///
Expand Down Expand Up @@ -618,7 +618,7 @@ pub fn generic_content_files() -> Cow<'static, UrlToPageMap> {
}
}

/// Retrieves the contributor spotlight pages, using the cacche if it is enabled.
/// Retrieves the contributor spotlight pages, using the cache if it is enabled.
///
/// This function returns a `Cow<'static, UrlToPageMap>` containing the contributor spotlight pages.
/// If caching is enabled (as determined by `cache_content()`), it attempts to get the cached
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum DocError {
NoParent(PathBuf),
#[error(transparent)]
NoSuchPrefix(#[from] StripPrefixError),
#[error("No curricm root set")]
#[error("No curriculum root set")]
NoCurriculumRoot,
#[error("No generic content root set")]
NoGenericContentRoot,
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/helpers/css_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub fn css_info_properties(
));
}

out.push(("initial", Cow::Owned(css_inital(locale)?)));
out.push(("initial", Cow::Owned(css_initial(locale)?)));

if at_rule.is_none() {
out.push((
Expand Down Expand Up @@ -326,7 +326,7 @@ pub fn css_inherited(locale: Locale) -> Result<String, DocError> {
)
}

pub fn css_inital(locale: Locale) -> Result<String, DocError> {
pub fn css_initial(locale: Locale) -> Result<String, DocError> {
let copy = l10n_json_data("Template", "xref_cssinitial", locale)?;
RariApi::link(
"/Web/CSS/initial_value",
Expand Down
6 changes: 3 additions & 3 deletions crates/rari-doc/src/helpers/summary_hack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::error::DocError;
use crate::pages::page::{Page, PageLike};
use crate::templ::render::render_for_summary;

/// There's a few places were we still tansplant content.
/// There's a few places were we still transplant content.
/// Yari had a hidden hacky way to do this and we have to mimic this for now.
pub fn get_hacky_summary_md(page: &Page) -> Result<String, DocError> {
let summary_md = page
Expand All @@ -22,7 +22,7 @@ pub fn get_hacky_summary_md(page: &Page) -> Result<String, DocError> {
})
.join("\n");
if summary_md.is_empty() {
Ok(String::from("No summray found."))
Ok(String::from("No summary found."))
} else {
render_for_summary(&summary_md).and_then(|md| {
Ok(m2h_internal(
Expand All @@ -40,7 +40,7 @@ pub fn get_hacky_summary_md(page: &Page) -> Result<String, DocError> {
/// ```html
/// <p>foo</p>bar
/// ```
pub fn strip_paragraph_unckecked(input: &str) -> &str {
pub fn strip_paragraph_unchecked(input: &str) -> &str {
let out = input.trim().strip_prefix("<p>").unwrap_or(input);
let out = out.trim().strip_suffix("</p>").unwrap_or(out);

Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/html/rewriter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub fn post_process_html<T: PageLike>(
let mut curriculum_links = vec![element!("a[href^=\".\"]", |el| {
let href = el.get_attribute("href").unwrap_or_default();
let split_href = href.split_once('#');
if let Ok(page) = CurriculumPage::page_from_realitve_file(
if let Ok(page) = CurriculumPage::page_from_relative_file(
page.full_path(),
split_href.map(|s| s.0).unwrap_or(&href),
) {
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! # Rari Documentation System
//!
//! The `rari_doc` crate is the central crate of the `rari` build system. It provides a robust build pipeline
//! and various utilities to handle different aspects of the documentation pipline, including reading,
//! and various utilities to handle different aspects of the documentation pipeline, including reading,
//! parsing, and rendering pages.
//!
//! ## Modules
Expand Down
6 changes: 3 additions & 3 deletions crates/rari-doc/src/pages/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct TocEntry {
/// # Fields
///
/// * `folder` - A `PathBuf` that specifies the directory where the source file is located.
/// * `github_url` - A `String` that holds the GitHUb URL to the spource file.
/// * `github_url` - A `String` that holds the GitHUb URL to the source file.
/// * `last_commit_url` - A `String` that holds the URL to the last commit in the GitHub repository.
/// * `filename` - A `String` that specifies the name of the source file.
#[derive(Debug, Clone, Serialize, Default, JsonSchema)]
Expand Down Expand Up @@ -151,7 +151,7 @@ pub struct Compat {
///
/// * `id` - An `Option<String>` that holds an optional `id` element attribute for the specification section.
/// * `title` - An `Option<String>` that holds an optional title for the specification section.
/// * `is_h3` - A `bool` that indicates whether the specificaytion section's `title` will be rendered as a &lt;H3&gt;
/// * `is_h3` - A `bool` that indicates whether the specification section's `title` will be rendered as a &lt;H3&gt;
/// * `specifications` - A `Vec<Specification>` that holds the list of `Specification` items within the section.
/// * `query` - A `String` that holds the BCD query string associated with the specification section.
/// * `content` - An `Option<String>` that holds the optional content of the specification section. This field is
Expand Down Expand Up @@ -220,7 +220,7 @@ pub enum Section {
/// during serialization if it is `None`.
/// * `sidebar_macro` - An `Option<String>` that holds the macro content for the sidebar. Serialized as `sidebarMacro` and
/// skipped during serialization if it is `None`.
/// * `source` - A `Source` that holds the git source countrol information of the document.
/// * `source` - A `Source` that holds the git source control information of the document.
/// * `summary` - An `Option<String>` that holds the summary of the document. This field is skipped during serialization if it is `None`.
/// * `title` - A `String` that holds the title of the document.
/// * `toc` - A `Vec<TocEntry>` that holds the table of contents entries for the document.
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/pages/types/curriculum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl CurriculumPage {
curriculum_files().by_path.get(path).cloned()
}

pub fn page_from_realitve_file(
pub fn page_from_relative_file(
base_file: &Path,
relative_file: &str,
) -> Result<Page, DocError> {
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/pages/types/spa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rari_types::RariEnv;
use rari_utils::concat_strs;

use super::spa_homepage::{
featured_articles, featured_contributor, lastet_news, recent_contributions,
featured_articles, featured_contributor, latest_news, recent_contributions,
};
use crate::cached_readers::{blog_files, generic_content_config, BasicSPA, BuildSPA, SPAData};
use crate::error::DocError;
Expand Down Expand Up @@ -157,7 +157,7 @@ impl SPA {
)?,
featured_contributor: featured_contributor(self.locale)?,
latest_news: ItemContainer {
items: lastet_news(&[
items: latest_news(&[
"/en-US/blog/mdn-scrimba-partnership/",
"/en-US/blog/mdn-http-observatory-launch/",
"/en-US/blog/mdn-curriculum-launch/",
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/pages/types/spa_homepage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::pages::json::{
};
use crate::pages::page::{Page, PageLike};

pub fn lastet_news(urls: &[&str]) -> Result<Vec<HomePageLatestNewsItem>, DocError> {
pub fn latest_news(urls: &[&str]) -> Result<Vec<HomePageLatestNewsItem>, DocError> {
urls.iter()
.filter_map(|url| match Page::from_url_with_fallback(url) {
Ok(Page::BlogPost(post)) => Some(Ok(HomePageLatestNewsItem {
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/banners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::helpers::l10n::l10n_json_data;
#[rari_f]
pub fn deprecated_header(version: Option<AnyArg>) -> Result<String, DocError> {
if version.is_some() {
warn!("Do not use deprectaed header with parameter!")
warn!("Do not use deprecated header with parameter!")
}
let title = l10n_json_data("Template", "deprecated_badge_abbreviation", env.locale)?;
let copy = l10n_json_data("Template", "deprecated_header_copy", env.locale)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/csssyntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static TOOLTIPS: LazyLock<HashMap<LinkedToken, String>> = LazyLock::new(|| {
(LinkedToken::Plus, "Plus: the entity may occur one or several times".to_string()),
(LinkedToken::QuestionMark, "Question mark: the entity is optional".to_string()),
(LinkedToken::CurlyBraces, "Curly braces: encloses two integers defining the minimal and maximal numbers of occurrences of the entity, or a single integer defining the exact number required".to_string()),
(LinkedToken::HashMark, "Hash mark: the entity is repeated one or several times, each occurence separated by a comma".to_string()),
(LinkedToken::HashMark, "Hash mark: the entity is repeated one or several times, each occurrence separated by a comma".to_string()),
(LinkedToken::ExclamationPoint,"Exclamation point: the group must produce at least one value".to_string()),
(LinkedToken::Brackets, "Brackets: enclose several entities, combinators, and multipliers to transform them as a single component".to_string()),
(LinkedToken::SingleBar, "Single bar: exactly one of the entities must be present".to_string()),
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/embeds/jsfiddle_embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rari_types::AnyArg;
use crate::error::DocError;

#[rari_f]
pub fn embded_jsfiddle(
pub fn embed_jsfiddle(
url: String,
options: Option<String>,
height: Option<AnyArg>,
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/templ/templs/glossarydisambiguation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rari_templ_func::rari_f;

use crate::error::DocError;
use crate::helpers::subpages::get_sub_pages;
use crate::helpers::summary_hack::{get_hacky_summary_md, strip_paragraph_unckecked};
use crate::helpers::summary_hack::{get_hacky_summary_md, strip_paragraph_unchecked};
use crate::pages::page::PageLike;

#[rari_f]
Expand All @@ -23,7 +23,7 @@ pub fn glossarydisambiguation() -> Result<String, DocError> {
r#"">"#,
page.title(),
r#"</a></dt><dd>"#,
strip_paragraph_unckecked(summary.as_str()),
strip_paragraph_unchecked(summary.as_str()),
r#"</dd>"#,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/inheritance_diagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn inheritance_diagram(interface: Option<String>) -> Result<String, DocError
};
let rect_width = calculate_rect_width(interface);

// Minumum space required to continue the current row
// Minimum space required to continue the current row
let req_space = match i {
0 => rect_width,
_ if i == iter_len => rect_width + 47,
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/templ/templs/list_subpages_for_sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::error::DocError;
use crate::helpers::subpages::{get_sub_pages, SubPagesSorter};
use crate::html::links::{render_internal_link, LinkModifier};
use crate::pages::page::{Page, PageLike};
use crate::utils::{trim_after, trim_fefore};
use crate::utils::{trim_after, trim_before};

/// List sub pages for sidebar
#[rari_f]
Expand Down Expand Up @@ -36,7 +36,7 @@ pub fn list_subpages_for_sidebar(
&page
};
let title = locale_page.short_title().unwrap_or(locale_page.title());
let title = trim_fefore(title, title_only_after.as_deref());
let title = trim_before(title, title_only_after.as_deref());
let title = trim_after(title, title_only_before.as_deref());
render_internal_link(
&mut out,
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn invoke(
"embedghlivesample" => embeds::embed_gh_live_sample::embed_gh_live_sample_any,
"embedlivesample" => embeds::embed_live_sample::embed_live_sample_any,
"embedyoutube" => embeds::embed_youtube::embed_youtube_any,
"jsfiddleembed" => embeds::jsfiddle_embed::embded_jsfiddle_any,
"jsfiddleembed" => embeds::jsfiddle_embed::embed_jsfiddle_any,

// live sample link
"livesamplelink" => embeds::live_sample_link::live_sample_link_any,
Expand Down
4 changes: 2 additions & 2 deletions crates/rari-doc/src/templ/templs/subpages_with_summaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use rari_templ_func::rari_f;

use crate::error::DocError;
use crate::helpers::subpages::{get_sub_pages, SubPagesSorter};
use crate::helpers::summary_hack::{get_hacky_summary_md, strip_paragraph_unckecked};
use crate::helpers::summary_hack::{get_hacky_summary_md, strip_paragraph_unchecked};
use crate::pages::page::PageLike;

#[rari_f]
Expand All @@ -18,7 +18,7 @@ pub fn subpages_with_summaries() -> Result<String, DocError> {
r#"">"#,
page.title(),
r#"</a></dt><dd class="landingPageList"><p>"#,
strip_paragraph_unckecked(get_hacky_summary_md(&page)?.as_str()),
strip_paragraph_unchecked(get_hacky_summary_md(&page)?.as_str()),
r#"</p></dd>"#,
]);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/svginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn svginfo() -> Result<String, DocError> {

out.push_str(r#"</td></tr></tbody></table>"#);
} else {
return Err(DocError::InvalidTempl(format!("No svginfor for {name}")));
return Err(DocError::InvalidTempl(format!("No svginfo for {name}")));
}

Ok(out)
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/templ/templs/webext_all_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn web_ext_all_examples() -> Result<String, DocError> {

out.extend([
r#"<table class="standard-table fullwidth-table">"#,
r#"<tr><th>Name</th><th>Description</th><th style="wdith: 40%">JavaScript APIs</th></tr>"#,
r#"<tr><th>Name</th><th>Description</th><th style="width: 40%">JavaScript APIs</th></tr>"#,
]);

for example in all_examples {
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-doc/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ pub fn trim_after<'a>(input: &'a str, pat: Option<&str>) -> &'a str {
input
}

pub fn trim_fefore<'a>(input: &'a str, pat: Option<&str>) -> &'a str {
pub fn trim_before<'a>(input: &'a str, pat: Option<&str>) -> &'a str {
if let Some(pat) = pat {
if let Some(i) = input.find(pat) {
return &input[i..];
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-sitemap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use ser::prefix_base_url;
pub enum SitemapError {
#[error("Error writing xml: {0}")]
XmlSeError(#[from] quick_xml::SeError),
#[error("Error swriting xml: {0}")]
#[error("Error writing xml: {0}")]
XmlFmtError(#[from] std::fmt::Error),
#[error("io error: {0}")]
IoError(#[from] std::io::Error),
Expand Down
2 changes: 1 addition & 1 deletion crates/rari-tools/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub enum ToolError {
#[error("Page has subpages: {0}")]
HasSubpagesError(Cow<'static, str>),

#[error("Unknonwn error")]
#[error("Unknown error")]
Unknown(&'static str),
}

Expand Down
Loading

0 comments on commit a2712cb

Please sign in to comment.