mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-03 22:47:46 +00:00
refactor/ptx ~ polish spelling (comments, names, and exceptions)
This commit is contained in:
parent
324605c78c
commit
13561cb5ae
1 changed files with 6 additions and 6 deletions
|
@ -246,7 +246,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap {
|
||||||
file_map
|
file_map
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Go through every lines in the input files and record each match occurance as a `WordRef`.
|
/// Go through every lines in the input files and record each match occurrence as a `WordRef`.
|
||||||
fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet<WordRef> {
|
fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet<WordRef> {
|
||||||
let reg = Regex::new(&filter.word_regex).unwrap();
|
let reg = Regex::new(&filter.word_regex).unwrap();
|
||||||
let ref_reg = Regex::new(&config.context_regex).unwrap();
|
let ref_reg = Regex::new(&config.context_regex).unwrap();
|
||||||
|
@ -412,7 +412,7 @@ fn get_output_chunks(
|
||||||
0,
|
0,
|
||||||
) as usize;
|
) as usize;
|
||||||
|
|
||||||
// the tail chunk takes text starting from where the after chunk ends (with whitespaces trimmed).
|
// the tail chunk takes text starting from where the after chunk ends (with whitespace trimmed).
|
||||||
let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len());
|
let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len());
|
||||||
|
|
||||||
// end = begin + max length
|
// end = begin + max length
|
||||||
|
@ -493,10 +493,10 @@ fn format_tex_line(
|
||||||
output.push_str(&format!("\\{} ", config.macro_name));
|
output.push_str(&format!("\\{} ", config.macro_name));
|
||||||
let all_before = if config.input_ref {
|
let all_before = if config.input_ref {
|
||||||
let before = &line[0..word_ref.position];
|
let before = &line[0..word_ref.position];
|
||||||
let before_start_trimoff =
|
let before_start_trim_offset =
|
||||||
word_ref.position - before.trim_start_matches(reference).trim_start().len();
|
word_ref.position - before.trim_start_matches(reference).trim_start().len();
|
||||||
let before_end_index = before.len();
|
let before_end_index = before.len();
|
||||||
&chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)]
|
&chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
|
||||||
} else {
|
} else {
|
||||||
let before_chars_trim_idx = (0, word_ref.position);
|
let before_chars_trim_idx = (0, word_ref.position);
|
||||||
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
|
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
|
||||||
|
@ -536,10 +536,10 @@ fn format_roff_line(
|
||||||
output.push_str(&format!(".{}", config.macro_name));
|
output.push_str(&format!(".{}", config.macro_name));
|
||||||
let all_before = if config.input_ref {
|
let all_before = if config.input_ref {
|
||||||
let before = &line[0..word_ref.position];
|
let before = &line[0..word_ref.position];
|
||||||
let before_start_trimoff =
|
let before_start_trim_offset =
|
||||||
word_ref.position - before.trim_start_matches(reference).trim_start().len();
|
word_ref.position - before.trim_start_matches(reference).trim_start().len();
|
||||||
let before_end_index = before.len();
|
let before_end_index = before.len();
|
||||||
&chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)]
|
&chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
|
||||||
} else {
|
} else {
|
||||||
let before_chars_trim_idx = (0, word_ref.position);
|
let before_chars_trim_idx = (0, word_ref.position);
|
||||||
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
|
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue