Skip to content

Commit

Permalink
Merge pull request #8756 from bjorng/bjorn/fix-man-page-rendering
Browse files Browse the repository at this point in the history
Properly render backslashes in man pages
  • Loading branch information
bjorng authored Aug 30, 2024
2 parents 537e272 + 7e2d1f5 commit 2d6e2e0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion erts/doc/references/erl_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ described in the corresponding application documentation.

The file `FileName` is to be a plain text file and can contain comments and
command-line arguments. A comment begins with a `#` character and continues
until the next end of line character. Backslash (\\\\) is used as quoting
until the next end of line character. Backslash (\\) is used as quoting
character. All command-line arguments accepted by `erl` are allowed, also flag
`-args_file FileName`. Be careful not to cause circular dependencies between
files containing flag `-args_file`, though.
Expand Down
2 changes: 1 addition & 1 deletion erts/doc/references/erlsrv_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ The following parameters can be specified for each Erlang service:
shows up as the service description in the Windows service manager.

[](){: #001 } The naming of the service in a system that uses release handling
must follow the convention _NodeName_\__Release_, where _NodeName_ is the first
must follow the convention *NodeName_Release*, where _NodeName_ is the first
part of the Erlang node name (up to, but not including the "@") and _Release_ is
the current release of the application.

Expand Down
8 changes: 4 additions & 4 deletions erts/doc/references/start_erl_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Windows). Although there are programs with the same name on other platforms,
their functionality is different.

This program is distributed both in compiled form (under
`<Erlang root>\\erts-<version>\\bin`) and in source form (under
`<Erlang root>\\erts-<version>\\src`). The purpose of the source code is to
`<Erlang root>\erts-<version>\bin`) and in source form (under
`<Erlang root>\erts-<version>\src`). The purpose of the source code is to
ease customization of the program for local needs, such as cyclic restart
detection. There is also a "make"-file, written for the `nmake` program
distributed with Microsoft Visual C++. This program can, however, be compiled
Expand All @@ -55,10 +55,10 @@ The `start_erl` program in its original form recognizes the following options:
- **`-reldir <release root>`** - Mandatory if environment variable `RELDIR` is
not specified and no `-rootdir` option is specified. Tells `start_erl` where
the root of the release tree is located in the file system (typically
`<Erlang root>\\releases`). The `start_erl.data` file is expected to be
`<Erlang root>\releases`). The `start_erl.data` file is expected to be
located in this directory (unless otherwise specified). If only option
`-rootdir` is specified, the directory is assumed to be
`<Erlang root>\\releases`.
`<Erlang root>\releases`.

- **`-rootdir <Erlang root directory>`** - Mandatory if `-reldir` is not
specified and no `RELDIR` exists in the environment. This specifies the Erlang
Expand Down
16 changes: 10 additions & 6 deletions lib/snmp/doc/references/snmpc_cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ limitations under the License.

SNMP MIB compiler frontend

## Synopsis

```
snmpc [options] file.mib | file.bin
```

## Description

The `snmpc` program provides a way to run the SNMP MIB compiler of the Erlang
system.

## snmpc \[options] file.mib | file.bin

`snmpc` compile a SNMP MIB file, see [compile/1,2](`snmpc:compile/1`) for more
info.
`snmpc` compiles an SNMP MIB file. See [compile/1,2](`snmpc:compile/1`) for more
information.

It can also be used to generate a header file (.hrl) with definitions of Erlang
constants for the objects in the MIB, see [mib_to_hrl/1](`snmpc:mib_to_hrl/1`).
It can also be used to generate a header file (`.hrl`) with definitions of Erlang
constants for the objects in the MIB. See [mib_to_hrl/1](`snmpc:mib_to_hrl/1`).

[](){: #options }

Expand Down
16 changes: 11 additions & 5 deletions make/markdown_to_man.escript
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ format_one({ul,_,Ul}) ->
format_ul(Ul).

format_p(Is0) ->
Is = [format_p_item(I) || I <- Is0],
[~".PP\n",Is,$\n].
Text0 = iolist_to_binary([format_p_item(I) || I <- Is0]),
Text = string:trim(Text0, leading),
[~".PP\n",Text,$\n].

format_p_item({code,_,Text}) ->
[~B"\fI",Text,~B"\fR"];
[~B"\fI",format_p_item(Text),~B"\fR"];
format_p_item({em,_,Text}) ->
[~B"\fB",format_p_item(Text),~B"\fR"];
format_p_item({i,_,Text}) ->
Expand All @@ -150,14 +151,14 @@ format_p_item([H|T]) ->
format_p_item([]) ->
[];
format_p_item(Text) when is_binary(Text) ->
Text.
escape_backslashes(Text).

format_pre(Ps0) ->
Ps = [format_pre_item(P) || P <- Ps0],
[~".IP\n.nf\n",Ps,$\n,~".fi\n"].

format_pre_item({code,_,Text}) ->
Text.
escape_backslashes(Text).

format_ul(UL) ->
[format_ul_item(I) || I <- UL].
Expand Down Expand Up @@ -200,3 +201,8 @@ strip_formatting(<<".",_/binary>> = Bin) ->
[~B"\&",Bin];
strip_formatting(Bin) when is_binary(Bin) ->
Bin.

escape_backslashes(Text) when is_list(Text) ->
escape_backslashes(iolist_to_binary(Text));
escape_backslashes(Text) when is_binary(Text) ->
binary:replace(Text, ~B"\", ~B"\\", [global]).

0 comments on commit 2d6e2e0

Please sign in to comment.