-
Notifications
You must be signed in to change notification settings - Fork 67
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
Improve rendering of nested lists #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, can you provide a sample output? A test would be nice, but I know this project is severely lacking in that area.
md2man/roff.go
Outdated
@@ -11,7 +11,7 @@ import ( | |||
|
|||
type roffRenderer struct{} | |||
|
|||
var listCounter int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, I can't believe this global is even here... should be moved to the renderer object
Adds additional indentation to support nesting of lists. Uses a stack to keep track of numbering for ordered lists. Fixes cpuguy83#18
Sample input (excerpt from docker-cp manpage): Assuming a path separator of `/`, a first argument of `SRC_PATH` and second
argument of `DEST_PATH`, the behavior is as follows:
- `SRC_PATH` specifies a file
- `DEST_PATH` does not exist
- the file is saved to a file created at `DEST_PATH`
- `DEST_PATH` does not exist and ends with `/`
- Error condition: the destination directory must exist.
- `DEST_PATH` exists and is a file
- the destination is overwritten with the source file's contents
- `DEST_PATH` exists and is a directory
- the file is copied into this directory using the basename from
`SRC_PATH`
- `SRC_PATH` specifies a directory
- `DEST_PATH` does not exist
- `DEST_PATH` is created as a directory and the *contents* of the source
directory are copied into this directory Output: .PP
Assuming a path separator of \fB\fC/\fR, a first argument of \fB\fCSRC\_PATH\fR and second
argument of \fB\fCDEST\_PATH\fR, the behavior is as follows:
.RS
.IP \(bu 2
\fB\fCSRC\_PATH\fR specifies a file
.RS
.IP \(bu 2
\fB\fCDEST\_PATH\fR does not exist
.RS
.IP \(bu 2
the file is saved to a file created at \fB\fCDEST\_PATH\fR
.RE
.IP \(bu 2
\fB\fCDEST\_PATH\fR does not exist and ends with \fB\fC/\fR
.RS
.IP \(bu 2
Error condition: the destination directory must exist.
.RE
.IP \(bu 2
\fB\fCDEST\_PATH\fR exists and is a file
.RS
.IP \(bu 2
the destination is overwritten with the source file's contents
.RE
.IP \(bu 2
\fB\fCDEST\_PATH\fR exists and is a directory
.RS
.IP \(bu 2
the file is copied into this directory using the basename from
\fB\fCSRC\_PATH\fR
.RE
.RE
.IP \(bu 2
\fB\fCSRC\_PATH\fR specifies a directory
.RS
.IP \(bu 2
\fB\fCDEST\_PATH\fR does not exist
.RS
.IP \(bu 2
\fB\fCDEST\_PATH\fR is created as a directory and the \fIcontents\fP of the source
directory are copied into this directory Output rendered:
Ouput without this PR for comparison:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks!
Adds additional indentation to support nesting of lists. Uses a stack to
keep track of numbering for ordered lists.
Fixes #18