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

Add a manpage backend #793

Open
pjanx opened this issue Oct 26, 2020 · 11 comments
Open

Add a manpage backend #793

pjanx opened this issue Oct 26, 2020 · 11 comments

Comments

@pjanx
Copy link
Contributor

pjanx commented Oct 26, 2020

https://asciidoctor.org/docs/user-manual/#man-pages

A subset is sufficient to document almost everything: bold, italics, links, section headers, definition lists, literal blocks.

Apparently relates to #581.

scdoc is a good and brief resource--targeting the mdoc macro package would be hard because it uses a lot of semantic markup but the standard-to-Linux man package is rather straight-forward. Make sure to handle sentence spacing correctly (I'm in favour of letting roff double space, unlike Drew).

@pjanx
Copy link
Contributor Author

pjanx commented Nov 10, 2020

I almost have an MVP. Currently blocking on #800.

@xcoulon
Copy link
Member

xcoulon commented Nov 10, 2020

I almost have an MVP. Currently blocking on #800.

oh, a PR for manpage support would be great! 🤩

@pjanx
Copy link
Contributor Author

pjanx commented Nov 12, 2020

Yeah, I'm in the situation where 80% of time will be spent on 20% of details. I'm trying to make it as small as possible.

@pjanx
Copy link
Contributor Author

pjanx commented Nov 12, 2020

If you want to help, this needs to be abstracted away, manpages have .[1-9][a-z] extensions defined by section 0 heading:

		outname := strings.TrimSuffix(path, filepath.Ext(path)) + ".html"

The filename isn't known until parsing (or generation). What do?

@xcoulon
Copy link
Member

xcoulon commented Nov 12, 2020

If you want to help, this needs to be abstracted away, manpages have .[1-9][a-z] extensions defined by section 0 heading:

		outname := strings.TrimSuffix(path, filepath.Ext(path)) + ".html"

The filename isn't known until parsing (or generation). What do?

I'm not sure I'm following you. Maybe you could create a PR in draft mode and point me to where you have blockers?

@pjanx
Copy link
Contributor Author

pjanx commented Nov 12, 2020

foo.adoc:

= foo(1)
== Name
foo - does things
asciidoctor -b manpage foo.adoc

This produces file foo.1. The Convert function is an unusable interface (also for EPUB or whatever).

@pjanx
Copy link
Contributor Author

pjanx commented Nov 12, 2020

Well, it could probably still be used if the extension were placed in the Metadata struct but you'd have to buffer the output or create a temporary file up first (which isn't a bad idea anyway, to use atomic rewrites).

@xcoulon
Copy link
Member

xcoulon commented Nov 12, 2020

foo.adoc:

= foo(1)
== Name
foo - does things
asciidoctor -b manpage foo.adoc

This produces file foo.1. The Convert function is an unusable interface (also for EPUB or whatever).

ok, I see what you mean now. Or you could use the -o flag to specify the output, maybe?

@xcoulon
Copy link
Member

xcoulon commented Nov 12, 2020

Well, it could probably still be used if the extension were placed in the Metadata struct but you'd have to buffer the output or create a temporary file up first (which isn't a bad idea anyway, to use atomic rewrites).

I'm fine with adding this kind of feature for manpage docs, it shouldn't be too hard, as you suggested, to buffer or write in a temp file and rename it afterwards

@pjanx
Copy link
Contributor Author

pjanx commented Nov 25, 2020

I'll return to this sooner or later but right now I'm postponing it.

@pjanx
Copy link
Contributor Author

pjanx commented Sep 25, 2022

If anyone happens to need this feature, I've impulsively created a simplified AsciiDoc to man page converter in AWK for a basic subset of the language (I'm using it as a fallback for 1, 2, 3, 4, 5, 6). Perhaps it works better than it should.

Thus, even though it should remain fairly easy to teach libasciidoc how to do it properly, I'm no longer particularly invested. (To make use of it, I'd additionally need to do something about #187.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants