diff options
author | kn <kn@cvs.openbsd.org> | 2021-02-19 19:49:50 +0000 |
---|---|---|
committer | kn <kn@cvs.openbsd.org> | 2021-02-19 19:49:50 +0000 |
commit | 5b6acf598869f6c88162e70342d103b46cb1b9d5 (patch) | |
tree | 589872a163bdb1ca5ea219ef65d549a4afc861ff /usr.bin/mandoc/main.c | |
parent | 2fb47400c373b318117637063aa9dd08948ed083 (diff) |
Append .html suffix to temporary files enabling browsers to recognise it
Occasionally one might read a manual page in a webbrowser, e.g.
"MANPAGER=firefox man -T html jq", however temporary files created for
pagers lack file extensions and most web browsers are unable to detect a
file's content without it.
Special case mandoc(1)'s HTML output format by appending the ".html" suffix
to file names such that browsers will actually render HTML as such instead
of showing it as plain text.
Input schwarze
Diffstat (limited to 'usr.bin/mandoc/main.c')
-rw-r--r-- | usr.bin/mandoc/main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 52c961d966a..0647c2e585c 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.255 2020/07/21 15:08:48 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.256 2021/02/19 19:49:49 kn Exp $ */ /* * Copyright (c) 2010-2012, 2014-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> @@ -824,6 +824,7 @@ process_onefile(struct mparse *mp, struct manpage *resp, int startdir, if (outst->use_pager) { outst->use_pager = 0; outst->tag_files = term_tag_init(conf->output.outfilename, + outst->outtype == OUTT_HTML ? ".html" : "", conf->output.tagfilename); if ((conf->output.outfilename != NULL || conf->output.tagfilename != NULL) && |