Improve the manpages & lint them in github#11339
Open
sylvestre wants to merge 4 commits intouutils:mainfrom
Open
Improve the manpages & lint them in github#11339sylvestre wants to merge 4 commits intouutils:mainfrom
sylvestre wants to merge 4 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
22b8e12 to
c8db906
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
6fca3ad to
6691464
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
Contributor
|
I don't know if you have seen it: the newly added tests fail in the CI :| |
- Fix TH header: uppercase command names and remove invalid date format - Remove trailing whitespace from all manpage lines - Fix redundant .br paragraph macros that cause mandoc warnings - Post-process manpage output to ensure compliance with mandoc standards
Add a new workflow that builds and validates all manpages using mandoc -T lint. The workflow runs on PRs and pushes that modify manpage-related files and validates both English and French manpages in parallel.
|
GNU testsuite comparison: |
- Move manpage post-processing logic into post_process_manpage() function - Add comprehensive unit tests for all post-processing functionality - Improve .br macro handling to correctly fix mandoc warnings - Tests cover TH header fixes, whitespace removal, and .br pattern fixes
d91e685 to
b8c10fa
Compare
|
GNU testsuite comparison: |
Contributor
Author
|
@cakebaker looks good this time :) |
cakebaker
reviewed
Mar 18, 2026
src/bin/uudoc.rs
Outdated
| skip_indices.insert(i); | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
I struggled with this code, it seems unnecessarily complex :|
I have rewritten it to do the same thing in a single pass:
let lines: Vec<&str> = result.lines().map(str::trim_end).collect();
let mut fixed_lines: Vec<&str> = Vec::with_capacity(lines.len());
for i in 0..lines.len() {
let line = lines[i];
if line == ".br" {
let preceded_by_empty_line = i > 0 && lines[i - 1].is_empty();
let followed_by_empty_line = i + 1 < lines.len() && lines[i + 1].is_empty();
let followed_by_br = i + 1 < lines.len() && lines[i + 1] == ".br";
if preceded_by_empty_line || followed_by_empty_line || followed_by_br {
// skip this ".br"
continue;
}
}
fixed_lines.push(line);
}
cakebaker
reviewed
Mar 18, 2026
Cargo.toml
Outdated
Comment on lines
+485
to
+486
| jiff = { workspace = true, optional = true } | ||
| regex = { workspace = true, optional = true } |
Contributor
There was a problem hiding this comment.
A detail: I would keep the alphabetic order.
cakebaker
reviewed
Mar 18, 2026
src/bin/uudoc.rs
Outdated
| /// - Removes .br before empty lines to avoid "br before sp" warnings | ||
| /// - Removes .br after empty lines to avoid "br after sp" warnings | ||
| /// - Fixes escape sequences (e.g., \\\\0 to \\0) to avoid "undefined escape" warnings | ||
| fn post_process_manpage(manpage: String, date: Option<&str>) -> String { |
Contributor
There was a problem hiding this comment.
It might make sense to use &str as type for date so that you use the same code path for both testing and non-testing.
- Enhanced post-processing to remove .br macros that appear before empty lines - This fixes 'WARNING: skipping paragraph macro: br before sp' from mandoc - Also handles the common pattern of .br-empty-.br by removing both .br macros - Added comprehensive test cases for the new patterns - All mandoc 'br before sp' warnings are now resolved
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.