-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mangen: verbatim_doc_comment has no effect #5003
Comments
For easier reproduction with cargo-script (with #!/usr/bin/env nargo
/*!
```cargo
[dependencies]
clap = { version = "4", features = ["derive"] }
clap_mangen = "0.2"
```
*/
use std::io::Write;
use clap::{CommandFactory, Parser};
/// *shotman* takes a screenshot and shows it in a small floating thumbnail window.
///
/// Screenshots are saved immediately. The first of the following locations that is
/// defined is used (i.e.: if the environment variable is undefined, the next one on
/// the list is used).
///
/// - _$XDG_SCREENSHOTS_DIR/_
/// - _$XDG_PICTURES_DIR/screenshots/_
/// - _$HOME/screenshots/_
/// - The current directory.
///
/// *shotman* requires a compositor that supports *wlr_screencopy* and
/// *wlr_layer_shell*.
#[derive(Parser)]
#[clap(author, about, long_about, verbatim_doc_comment)]
pub struct Cli {}
fn main() {
Cli::parse();
let man = clap_mangen::Man::new(Cli::command());
let mut buffer: Vec<u8> = Default::default();
man.render_title(&mut buffer)
.expect("Render man page to buffer");
man.render_name_section(&mut buffer)
.expect("Render man page to buffer");
man.render_synopsis_section(&mut buffer)
.expect("Render man page to buffer");
man.render_description_section(&mut buffer)
.expect("Render man page to buffer");
let stdout = std::io::stdout();
stdout
.lock()
.write_all(&buffer)
.expect("Write buffer with rendered manpage to stdout");
} |
The
|
The ROFF .ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH clap-5003 1 "clap-5003 "
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH NAME
clap\-5003 \- *shotman* takes a screenshot and shows it in a small floating thumbnail window.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH SYNOPSIS
\fBclap\-5003\fR [\fB\-h\fR|\fB\-\-help\fR]
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.SH DESCRIPTION
*shotman* takes a screenshot and shows it in a small floating thumbnail window.
.PP
Screenshots are saved immediately. The first of the following locations that is
defined is used (i.e.: if the environment variable is undefined, the next one on
the list is used).
.PP
\- _$XDG_SCREENSHOTS_DIR/_
\- _$XDG_PICTURES_DIR/screenshots/_
\- _$HOME/screenshots/_
\- The current directory.
.PP
*shotman* requires a compositor that supports *wlr_screencopy* and
*wlr_layer_shell*. |
An approx of what the man page looks like
|
Based on The challenge is knowing hard line breaks from soft line breaks |
I think that you're right; strictly speaking, I expected Do you have any thoughts here? Should |
I lean towards keeping We could add a |
Please complete the following tasks
Rust Version
rustc 1.70.0 (90c541806 2023-05-31) (Alpine Linux 1.70.0-r4)
Clap Version
version = "4.1.4"
Minimal reproducible code
Steps to reproduce the bug with the above code
Actual Behaviour
Text is mangled up due to pre-processing.
Expected Behaviour
verbatim_doc_comment
should minimise pre-processing when converting doc comments.Additional Context
The
--help
output of this example prints fine:#4444 seems remotely related, but not quite the same.
Debug Output
The text was updated successfully, but these errors were encountered: