public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* How to turn off hyphenation when writing roff/man pages?  Variables nor metadata works
@ 2019-07-03 20:16 Nicolas Hillegeer
       [not found] ` <fbaf534c-daf9-49fe-8a20-190663a88c33-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Hillegeer @ 2019-07-03 20:16 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3328 bytes --]

Sorry for posting what appears to be a very basic question, but I've looked 
for hours and couldn't find it.

Problem: I want to generate my manpage from a markdown source, but I don't 
want any hyphenation. By default, hyphenation is enabled:

$ pandoc --print-default-template=man
...
$if(hyphenate)$
.hy
$else$
.nh \" Turn off hyphenation by default.
$endif$
...


Both in the documentation <https://pandoc.org/MANUAL.html> and in the original 
commit 
<https://github.com/jgm/pandoc/commit/f5e33e0dce8a4f08e23a59a8b270d3dad94601e0> which 
enabled hyphenation, it is described as a "default". Which indicates it is 
somehow overridable:

Variables for man pages
adjusting

adjusts text to left (l), right (r), center (c), or both (b) margins

footer

footer in man pages

header

header in man pages

hyphenate

if true (the default), hyphenation will be used

section

section number in man pages



With regards to variable setting, I found the following in the docs:

Templates contain variables, which allow for the inclusion of arbitrary 
information at any point in the file. They may be set at the command line 
using the -V/--variable option. If a variable is not set, pandoc will look 
for the key in the document’s metadata – which can be set using either YAML 
metadata blocks or with the -M/--metadata option.

And:

-V KEY[=VAL], --variable=KEY[:VAL]

Set the template variable KEY to the value VAL when rendering the document 
in standalone mode. This is generally only useful when the --template 
option is used to specify a custom template, since pandoc automatically 
sets the variables used in the default templates. If no VAL is specified, 
the key will be given the value true.

-M KEY[=VAL], --metadata=KEY[:VAL]

Set the metadata field KEY to the value VAL. A value specified on the 
command line overrides a value specified in the document using YAML 
metadata blocks. Values will be parsed as YAML boolean or string values. If 
no value is specified, the value will be treated as Boolean true. Like 
--variable, --metadata causes template variables to be set. But unlike 
--variable, --metadata affects the metadata of the underlying document 
(which is accessible from filters and may be printed in some output 
formats) and metadata values will be escaped when inserted into the 
template.


So, I'm trying thins like:

$ pandoc --metadata=hyphenate:False --variable=hyphenate:False -s -f 
markdown -t man mycommand.1.md -o mycommand.1 


However it seems to have no effect. I tried the other metadata routes too:

% hyphenate: False

---
hyphenate: False
---


(In my document.)

Nothing works.

What am I doing wrong?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fbaf534c-daf9-49fe-8a20-190663a88c33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 6239 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to turn off hyphenation when writing roff/man pages?  Variables nor metadata works
       [not found] ` <fbaf534c-daf9-49fe-8a20-190663a88c33-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-07-04 17:24   ` John MacFarlane
       [not found]     ` <874l41n25d.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2019-07-04 17:24 UTC (permalink / raw)
  To: Nicolas Hillegeer, pandoc-discuss


Try

--metadata hyphenate=false

False should also work.  I just tested with both.
Don't set --variable too, as this will override the
metadata value, and variables are just strings, so you
can't get a boolean false value.

If this doesn't work, check that you're using the most
recent version of pandoc.

The comment about "default" in the template is
misleading, because the man writer sets the hyphenate
variable to true if it's not set.  I'll change this.



Nicolas Hillegeer <nicolashillegeer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Sorry for posting what appears to be a very basic question, but I've looked 
> for hours and couldn't find it.
>
> Problem: I want to generate my manpage from a markdown source, but I don't 
> want any hyphenation. By default, hyphenation is enabled:
>
> $ pandoc --print-default-template=man
> ...
> $if(hyphenate)$
> .hy
> $else$
> .nh \" Turn off hyphenation by default.
> $endif$
> ...
>
>
> Both in the documentation <https://pandoc.org/MANUAL.html> and in the original 
> commit 
> <https://github.com/jgm/pandoc/commit/f5e33e0dce8a4f08e23a59a8b270d3dad94601e0> which 
> enabled hyphenation, it is described as a "default". Which indicates it is 
> somehow overridable:
>
> Variables for man pages
> adjusting
>
> adjusts text to left (l), right (r), center (c), or both (b) margins
>
> footer
>
> footer in man pages
>
> header
>
> header in man pages
>
> hyphenate
>
> if true (the default), hyphenation will be used
>
> section
>
> section number in man pages
>
>
>
> With regards to variable setting, I found the following in the docs:
>
> Templates contain variables, which allow for the inclusion of arbitrary 
> information at any point in the file. They may be set at the command line 
> using the -V/--variable option. If a variable is not set, pandoc will look 
> for the key in the document’s metadata – which can be set using either YAML 
> metadata blocks or with the -M/--metadata option.
>
> And:
>
> -V KEY[=VAL], --variable=KEY[:VAL]
>
> Set the template variable KEY to the value VAL when rendering the document 
> in standalone mode. This is generally only useful when the --template 
> option is used to specify a custom template, since pandoc automatically 
> sets the variables used in the default templates. If no VAL is specified, 
> the key will be given the value true.
>
> -M KEY[=VAL], --metadata=KEY[:VAL]
>
> Set the metadata field KEY to the value VAL. A value specified on the 
> command line overrides a value specified in the document using YAML 
> metadata blocks. Values will be parsed as YAML boolean or string values. If 
> no value is specified, the value will be treated as Boolean true. Like 
> --variable, --metadata causes template variables to be set. But unlike 
> --variable, --metadata affects the metadata of the underlying document 
> (which is accessible from filters and may be printed in some output 
> formats) and metadata values will be escaped when inserted into the 
> template.
>
>
> So, I'm trying thins like:
>
> $ pandoc --metadata=hyphenate:False --variable=hyphenate:False -s -f 
> markdown -t man mycommand.1.md -o mycommand.1 
>
>
> However it seems to have no effect. I tried the other metadata routes too:
>
> % hyphenate: False
>
> ---
> hyphenate: False
> ---
>
>
> (In my document.)
>
> Nothing works.
>
> What am I doing wrong?
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fbaf534c-daf9-49fe-8a20-190663a88c33%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/874l41n25d.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to turn off hyphenation when writing roff/man pages? Variables nor metadata works
       [not found]     ` <874l41n25d.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2019-07-05 22:22       ` Nicolas Hillegeer
       [not found]         ` <CACqJ-1e6EMt2z2P_k9SkFYrDEaHathk-N0-9nCZrAhmH6uBjDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Hillegeer @ 2019-07-05 22:22 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 5873 bytes --]

On Thu, 4 Jul 2019 at 19:24, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> Try
>
> --metadata hyphenate=false
>
> False should also work.  I just tested with both.
> Don't set --variable too, as this will override the
> metadata value, and variables are just strings, so you
> can't get a boolean false value.
>

That worked. Thank you!


> If this doesn't work, check that you're using the most
> recent version of pandoc.
>
> The comment about "default" in the template is
> misleading, because the man writer sets the hyphenate
> variable to true if it's not set.  I'll change this.
>
>
Thanks for fixing it.

I have but one more thought/question: what I really wanted to accomplish
was the following:

  - I have a table which I use in my SYNOPSIS, which is a little uncommon I
agree (it's due to the source markdown being used by another rendered which
doesn't support the '|' at start of line extension).
  - The table contains command-line argument.
  - Somehow they were being hyphenated, which is wrong. For example
--columns came out as --col-umns.

Is there perhaps some other way to prevent hyphenation of either:

  - A section.
  - "Words" that have been marked a certain way (like bolded or in code
blocks). I tried a number of things but nothing seemed to take effect in
that sense. I would've expected code blocks to do it (as in, they would be
verbatim).


>
>
> Nicolas Hillegeer <nicolashillegeer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Sorry for posting what appears to be a very basic question, but I've
> looked
> > for hours and couldn't find it.
> >
> > Problem: I want to generate my manpage from a markdown source, but I
> don't
> > want any hyphenation. By default, hyphenation is enabled:
> >
> > $ pandoc --print-default-template=man
> > ...
> > $if(hyphenate)$
> > .hy
> > $else$
> > .nh \" Turn off hyphenation by default.
> > $endif$
> > ...
> >
> >
> > Both in the documentation <https://pandoc.org/MANUAL.html> and in the
> original
> > commit
> > <
> https://github.com/jgm/pandoc/commit/f5e33e0dce8a4f08e23a59a8b270d3dad94601e0>
> which
> > enabled hyphenation, it is described as a "default". Which indicates it
> is
> > somehow overridable:
> >
> > Variables for man pages
> > adjusting
> >
> > adjusts text to left (l), right (r), center (c), or both (b) margins
> >
> > footer
> >
> > footer in man pages
> >
> > header
> >
> > header in man pages
> >
> > hyphenate
> >
> > if true (the default), hyphenation will be used
> >
> > section
> >
> > section number in man pages
> >
> >
> >
> > With regards to variable setting, I found the following in the docs:
> >
> > Templates contain variables, which allow for the inclusion of arbitrary
> > information at any point in the file. They may be set at the command
> line
> > using the -V/--variable option. If a variable is not set, pandoc will
> look
> > for the key in the document’s metadata – which can be set using either
> YAML
> > metadata blocks or with the -M/--metadata option.
> >
> > And:
> >
> > -V KEY[=VAL], --variable=KEY[:VAL]
> >
> > Set the template variable KEY to the value VAL when rendering the
> document
> > in standalone mode. This is generally only useful when the --template
> > option is used to specify a custom template, since pandoc automatically
> > sets the variables used in the default templates. If no VAL is
> specified,
> > the key will be given the value true.
> >
> > -M KEY[=VAL], --metadata=KEY[:VAL]
> >
> > Set the metadata field KEY to the value VAL. A value specified on the
> > command line overrides a value specified in the document using YAML
> > metadata blocks. Values will be parsed as YAML boolean or string values.
> If
> > no value is specified, the value will be treated as Boolean true. Like
> > --variable, --metadata causes template variables to be set. But unlike
> > --variable, --metadata affects the metadata of the underlying document
> > (which is accessible from filters and may be printed in some output
> > formats) and metadata values will be escaped when inserted into the
> > template.
> >
> >
> > So, I'm trying thins like:
> >
> > $ pandoc --metadata=hyphenate:False --variable=hyphenate:False -s -f
> > markdown -t man mycommand.1.md -o mycommand.1
> >
> >
> > However it seems to have no effect. I tried the other metadata routes
> too:
> >
> > % hyphenate: False
> >
> > ---
> > hyphenate: False
> > ---
> >
> >
> > (In my document.)
> >
> > Nothing works.
> >
> > What am I doing wrong?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/fbaf534c-daf9-49fe-8a20-190663a88c33%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CACqJ-1e6EMt2z2P_k9SkFYrDEaHathk-N0-9nCZrAhmH6uBjDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 8451 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to turn off hyphenation when writing roff/man pages? Variables nor metadata works
       [not found]         ` <CACqJ-1e6EMt2z2P_k9SkFYrDEaHathk-N0-9nCZrAhmH6uBjDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-07-07 15:47           ` John MacFarlane
  0 siblings, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2019-07-07 15:47 UTC (permalink / raw)
  To: Nicolas Hillegeer; +Cc: pandoc-discuss

Nicolas Hillegeer <nicolashillegeer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Is there perhaps some other way to prevent hyphenation of either:
>
>   - A section.
>   - "Words" that have been marked a certain way (like bolded or in code
> blocks). I tried a number of things but nothing seemed to take effect in
> that sense. I would've expected code blocks to do it (as in, they would be
> verbatim).

You can turn off groff hyphenation at any point in the
document, I think, by doing

.nh

and then re-enable it with

.hy

So one option would be to insert

```{=man}
.nh
```

before your table, and

```{=man}
.hy
```

after it.  These will be passed through to man output.

It would be nice to make this more automatic for code,
but I don't see a way to do that other than using a
custom macro for code, which would make pandoc's
output a little more brittle.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-07 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 20:16 How to turn off hyphenation when writing roff/man pages? Variables nor metadata works Nicolas Hillegeer
     [not found] ` <fbaf534c-daf9-49fe-8a20-190663a88c33-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-07-04 17:24   ` John MacFarlane
     [not found]     ` <874l41n25d.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-07-05 22:22       ` Nicolas Hillegeer
     [not found]         ` <CACqJ-1e6EMt2z2P_k9SkFYrDEaHathk-N0-9nCZrAhmH6uBjDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-07-07 15:47           ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).