-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"describe" CLI, TOML-based testing, Turkish i
- Loading branch information
1 parent
457350c
commit d82f8dd
Showing
15 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ read-fonts = "0" | |
skrifa = "0" | ||
itertools = "0.13.0" | ||
google-fonts-languages = "*" | ||
toml = "0.8.19" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use clap::Args; | ||
|
||
#[derive(Args)] | ||
pub struct DescribeArgs { | ||
/// Output check definition as TOML | ||
#[arg(long)] | ||
json: bool, | ||
/// Language name or ID to describe | ||
language: String, | ||
} | ||
|
||
pub fn describe_command(args: &DescribeArgs, language_database: shaperglot::Languages) { | ||
if let Some(language) = language_database.get_language(&args.language) { | ||
if args.json { | ||
let json = serde_json::to_string_pretty(&language.checks).unwrap(); | ||
println!("{}", json); | ||
// } | ||
} else { | ||
for check in language.checks.iter() { | ||
println!("{}", check.description); | ||
} | ||
} | ||
} else { | ||
println!("Language not found"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[[tr_Latn]] | ||
name = "Small caps i should be dotted" | ||
severity = "Warn" | ||
description = "When the letter 'i' is in small caps, it should be dotted" | ||
scoring_strategy = "Continuous" | ||
weight = 10 | ||
|
||
[[tr_Latn.implementations]] | ||
type = "ShapingDiffers" | ||
features_optional = true | ||
pairs = [[ | ||
{ text = "i", features = ["smcp"] }, | ||
{ text = "i", features = ["smcp"], language = "tr" }, | ||
]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// #![deny(missing_docs)] | ||
// #![deny(clippy::missing_docs_in_private_items)] | ||
mod checker; | ||
mod checks; | ||
mod font; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use std::collections::HashMap; | ||
|
||
use crate::{checks::Check, language::Language, Provider}; | ||
|
||
const TOML_PROFILE: &str = include_str!("../../manual_checks.toml"); | ||
|
||
use std::sync::LazyLock; | ||
|
||
static MANUAL_CHECKS: LazyLock<HashMap<String, Vec<Check>>> = | ||
LazyLock::new(|| toml::from_str(TOML_PROFILE).expect("Could not parse manual checks file: ")); | ||
|
||
pub struct TomlProvider; | ||
|
||
impl Provider for TomlProvider { | ||
fn checks_for(&self, language: &Language) -> Vec<Check> { | ||
MANUAL_CHECKS | ||
.get(language.id()) | ||
.cloned() | ||
.unwrap_or_default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters