Skip to content

Commit

Permalink
Refactor repository to use workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sakex committed Sep 25, 2023
1 parent 057547e commit 45e610d
Show file tree
Hide file tree
Showing 13 changed files with 610 additions and 24 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,19 @@ jobs:
- name: Run fuzz test
run: cargo fuzz run group_events -- -only_ascii=1 -max_total_time=30
- name: Run group_events fuzzer and minimize corpus
run: |
cd i18n-helpers
cargo fuzz run group_events -- -only_ascii=1 -max_total_time=30
cargo fuzz cmin group_events
- name: Minimize fuzz corpus
run: cargo fuzz cmin group_events
- name: Run normalize fuzzer and minimize corpus
run: |
cd i18n-helpers
cargo fuzz run normalize -- -only_ascii=1 -max_total_time=30
cargo fuzz cmin normalize
clippy:
name: Clippy
Expand Down
27 changes: 3 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
[package]
name = "mdbook-i18n-helpers"
version = "0.2.2"
authors = ["Martin Geisler <mgeisler@google.com>"]
categories = ["command-line-utilities", "localization"]
edition = "2021"
keywords = ["mdbook", "i18n", "translation", "gettext"]
license = "Apache-2.0"
repository = "https://github.com/google/mdbook-i18n-helpers"
description = "Plugins for a mdbook translation workflow based on Gettext."

[dependencies]
anyhow = "1.0.68"
mdbook = { version = "0.4.25", default-features = false }
polib = "0.2.0"
pulldown-cmark = { version = "0.9.2", default-features = false }
pulldown-cmark-to-cmark = "10.0.4"
regex = "1.9.4"
semver = "1.0.16"
serde_json = "1.0.91"

[dev-dependencies]
pretty_assertions = "1.3.0"
tempfile = "3.5.0"
[workspace]
members = ["i18n-helpers"]
default-members = ["i18n-helpers"]
24 changes: 24 additions & 0 deletions i18n-helpers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "mdbook-i18n-helpers"
version = "0.2.3"
authors = ["Martin Geisler <mgeisler@google.com>"]
categories = ["command-line-utilities", "localization"]
edition = "2021"
keywords = ["mdbook", "i18n", "translation", "gettext"]
license = "Apache-2.0"
repository = "https://github.com/google/mdbook-i18n-helpers"
description = "Plugins for a mdbook translation workflow based on Gettext."

[dependencies]
anyhow = "1.0.68"
mdbook = { version = "0.4.25", default-features = false }
polib = "0.2.0"
pulldown-cmark = { version = "0.9.2", default-features = false }
pulldown-cmark-to-cmark = "11.0.0"
regex = "1.9.4"
semver = "1.0.16"
serde_json = "1.0.91"

[dev-dependencies]
pretty_assertions = "1.3.0"
tempfile = "3.5.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions i18n-helpers/fuzz/fuzz_targets/normalize.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#![no_main]

use libfuzzer_sys::fuzz_target;
use mdbook_i18n_helpers::normalize::normalize;
use polib::catalog::Catalog;
use polib::message::Message;
use polib::metadata::CatalogMetadata;

fuzz_target!(|translations: Vec<(&str, &str)>| {
let catalog = create_catalog(translations);
let _ = normalize(catalog);
});

fn create_catalog(translations: Vec<(&str, &str)>) -> Catalog {
let mut catalog = Catalog::new(CatalogMetadata::new());
for (idx, (msgid, msgstr)) in translations.iter().enumerate() {
let message = Message::build_singular()
.with_source(format!("foo.md:{idx}"))
.with_msgid(String::from(*msgid))
.with_msgstr(String::from(*msgstr))
.done();
catalog.append_or_update(message);
}
catalog
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 45e610d

Please sign in to comment.