Skip to content
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

Roff output force-adds a specific NAME section #33

Open
adminspotter opened this issue Aug 20, 2019 · 3 comments
Open

Roff output force-adds a specific NAME section #33

adminspotter opened this issue Aug 20, 2019 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@adminspotter
Copy link
Contributor

My markdown documents have their own NAME sections, because I want them to look mostly like manpages before I do any processing on them. ronn adds another NAME section, even though one already exists.

Testing file:

# Test #

## NAME ##

test - the test manpage

## DESCRIPTION ##

Testing items.  w00t!

ronn invocation:

$ ronn --roff --pipe --name 'Testing' --section=9 --manual='Testing manual' --organization='Testers, Inc.' --date='2019-08-19' < test.md > test.9

Manual output:

TESTING(9)                      Testing manual                      TESTING(9)

NAME
       Testing - Test

NAME
       test - the test manpage

DESCRIPTION
       Testing items. w00t!

Testers, Inc.                     August 2019                       TESTING(9)

It looks like there's some logic in Ronn::Document to handle the various ways in which the document name can enter the processing, but they seem to assume that they should always add a NAME section. If I move the contents of my NAME section into the top header in the Markdown document, and drop the --name command line flag, ronn will format the resulting manpages correctly, but I lose the manpage format - specifically the NAME section - that I want in the original Markdown documents.

@apjanke
Copy link
Owner

apjanke commented Aug 26, 2019

Coincidentally, another user just emailed me about this last week.

I think we probably need a --no-name option to suppress automatic NAME section generation for cases like this. And maybe more probing for the existence of an explicit NAME section in the input.

@apjanke apjanke added the bug Something isn't working label Aug 26, 2019
@apjanke apjanke self-assigned this Aug 26, 2019
@adminspotter
Copy link
Contributor Author

The ideal situation would be if ronn was able to notice whether the section was there or not, and add it if necessary. As I was exploring the ronn source, that's what I had in mind, but was never able to find how that new NAME section got injected into the document source.

@adminspotter
Copy link
Contributor Author

I've recently picked this back up and did some more hacking, and I think I've got the fix. I went in the direction of having ronn be able to figure things out on its own, rather than requiring any new command-line arguments. The Ronn::Document::sniff method gets some expansion, and then there's some small tweakage to Ronn::Document::html_filter_inject_name_section.

I need to add a unit test for the name injection method, and then I'll have a PR for you to look at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: High priority
Development

No branches or pull requests

2 participants