Skip to content

Commit 126d6ac

Browse files
committed
fix(build): locale and redirect fixes
1 parent bbe8f80 commit 126d6ac

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

crates/rari-doc/src/redirects.rs

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ static REDIRECTS: LazyLock<HashMap<String, String>> = LazyLock::new(|| {
6161
fn read_redirects(path: &Path, map: &mut HashMap<String, String>) -> Result<(), DocError> {
6262
let lines = read_lines(path)?;
6363
map.extend(lines.map_while(Result::ok).filter_map(|line| {
64+
if line.starts_with('#') {
65+
return None;
66+
}
6467
let mut from_to = line.splitn(2, '\t');
6568
if let (Some(from), Some(to)) = (from_to.next(), from_to.next()) {
6669
Some((from.to_lowercase(), to.into()))

crates/rari-doc/src/search_index.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::io::BufWriter;
66
use rari_types::globals::{build_out_root, content_root};
77
use rari_types::locale::Locale;
88
use rari_types::Popularities;
9+
use rari_utils::error::RariIoError;
910
use rari_utils::io::read_to_string;
1011
use serde::Serialize;
1112

@@ -55,7 +56,10 @@ pub fn build_search_index(docs: &[Page]) -> Result<(), DocError> {
5556
let out_file = build_out_root()?
5657
.join(locale.as_folder_str())
5758
.join("search-index.json");
58-
let file = File::create(out_file)?;
59+
let file = File::create(&out_file).map_err(|e| RariIoError {
60+
source: e,
61+
path: out_file,
62+
})?;
5963
let buffed = BufWriter::new(file);
6064

6165
serde_json::to_writer(buffed, &out)?;

crates/rari-types/src/locale.rs

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl Locale {
104104
pub const fn as_folder_str(&self) -> &str {
105105
match *self {
106106
Self::EnUs => "en-us",
107+
Self::PtBr => "pt-br",
107108
Self::ZhCn => "zh-cn",
108109
Self::ZhTw => "zh-tw",
109110
_ => self.as_url_str(),

0 commit comments

Comments
 (0)