Docs: Update some man page markup and remove pod2adoc.py.

Remove pod2adoc.py since it's no longer needed. Add versions to the
Wireshark, TShark, and Dumpcap man pages. Use definition lists in the
TShark glossary descriptions. Other minor fixes.
This commit is contained in:
Gerald Combs 2021-09-30 19:39:09 -07:00 committed by Wireshark GitLab Utility
parent 7f47511653
commit 8705dfbe74
20 changed files with 102 additions and 297 deletions

View File

@ -266,7 +266,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*Androiddump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -456,7 +456,7 @@ xref:dumpcap.html[dumpcap](1), xref:captype.html[captype](1), xref:https://www.t
*Capinfos* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -40,7 +40,7 @@ xref:dumpcap.html[dumpcap](1), xref:capinfos.html[capinfos](1), xref:https://www
*Captype* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -259,7 +259,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*ciscodump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -159,7 +159,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*dpauxmon* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -521,10 +521,11 @@ xref:https://www.tcpdump.org/manpages/pcap-filter.7.html[pcap-filter](7) or xref
== NOTES
*Dumpcap* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
This is the manual page for *Dumpcap* {wireshark-version}.
*Dumpcap* is part of the *Wireshark* distribution.
The latest version of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -568,7 +568,7 @@ xref:text2pcap.html[text2pcap](1), xref:reordercap.html[reordercap](1), od(1), x
*Editcap* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -146,7 +146,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*etwdump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -157,5 +157,5 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*Extcap* is feature of *Wireshark*. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.

View File

@ -193,7 +193,7 @@ xref:https://www.tcpdump.org/manpages/pcap-filter.7.html[pcap-filter](7) or xref
*Mergecap* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -65,7 +65,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1)
*mmdbresolve* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -1,210 +0,0 @@
#!/usr/bin/env python3
import os
import re
import sys
from enum import Enum
# To do:
# - Fix COUNT(field)filter man output.
class PodState(Enum):
PRE = 1
HEAD = 2
SYNOPSIS = 3
ITEM_BODY = 4
AUTHOR = 5
skip_commands = ('=back', '=begin', '=encoding', '=end', '=over')
man4_files = ('extcap', 'wireshark-filter')
tcpdump_manurls = {
'pcap': 'https://www.tcpdump.org/manpages/pcap.3pcap.html',
'pcap-filter': 'https://www.tcpdump.org/manpages/pcap-filter.7.html',
'tcpdump': 'https://www.tcpdump.org/manpages/tcpdump.1.html',
}
def xlate_markup(podline, inline_nobreak=True):
# Replace < and > in two steps, here and at the end
podline = podline.replace('E<lt>', '{lt}')
podline = podline.replace('E<gt>', '{gt}')
# TShark escapes quotes
podline = podline.replace('E<34>', '"')
# Italic, files, bold, and code
podline = re.sub(r'[IF]<([^>]+)>', r'__\1__', podline)
podline = re.sub(r'B<([^>]+)>', r'*\1*', podline)
podline = re.sub(r'C<([^>]+)>', r'`\1`', podline)
# AsciiDoctor figures out URL links on its own.
podline = re.sub(r'L<([^>]+)>', r'\1', podline)
# S< ... > inserts <span style="white-space: nowrap;"> ... </span>
# XXX Handle multiline nowraps?
nobr_re = re.search(r'S<([^>]+)>', podline)
if nobr_re:
text = nobr_re.group(1).strip()
if inline_nobreak:
if '#' in text:
text = f'++{text}++'
# Use .nowrap in paragraphs instead of manarg so that we don't trigger
# "can't break line" warnings in nroff.
podline = re.sub(r'S<[^>]+>', f'[.nowrap]#{text}#', podline)
else:
podline = re.sub(r'S<([^>]+)>', r'\1', text)
podline = podline.replace('{lt}', '<')
podline = podline.replace('{gt}', '>')
if not podline.endswith('\n'):
podline += '\n'
return(podline)
def pod2adoc(podfile):
if not podfile.endswith('.pod'):
sys.stderr.write(f"{podfile} doesn't have a .pod extension")
return
manpage_name = os.path.basename(podfile).split('.')[-2]
mansect = 1
adoc_fname = os.path.join(os.path.dirname(podfile), f'{manpage_name}.adoc')
if manpage_name in man4_files:
mansect = 4
print(f'Processing {manpage_name}')
state = PodState.PRE
with open(podfile, 'r') as podf:
adoc_body = f'''\
= {manpage_name}({mansect})
:doctype: manpage
include::../docbook/attributes.adoc[]
:stylesheet: ws.css
:linkcss:
:copycss: ../docbook/{{stylesheet}}
'''
linenum = 0
for podline in podf:
if state == PodState.AUTHOR:
author = re.sub(r'\s+', ' ', podline.strip())
if author == '' or author.isspace():
state = PodState.PRE
adoc_body += f'{author}\n'
continue
# Assume that command line synopses start with
# B<command>
# S< ... >
if podline == f'B<{manpage_name}>\n':
adoc_body += '[manarg]\n'
state = PodState.SYNOPSIS
podline = xlate_markup(podline, state != PodState.SYNOPSIS)
linenum += 1
if re.search('[BCEFLISXZ]<', podline):
podline = xlate_markup(f'{podline} {next(podf)}', state != PodState.SYNOPSIS)
sys.stderr.write(f'{manpage_name}: joined partial markup on line {linenum}\n')
linenum += 1
head = re.match('=head([12]) *(.*)', podline)
if head:
if state == PodState.ITEM_BODY:
adoc_body += '--\n\n'
adoc_body += f'={"=" * int(head.group(1))} {head.group(2)}\n'
state = PodState.HEAD
continue
# Continued unordered and ordered list items
item = re.match(r'=item\s*(\*|\d+\.)\s*$', podline)
if item:
adoc_body += f'{item.group(1)} '
continue
# Inline unordered and ordered list items
item = re.match(r'=item\s*([-\*]\s+.*|\d+\.\s+.*)\s*$', podline)
if item:
adoc_body += f'{item.group(1)}'
continue
# Other list items
item = re.match('=item\s*(.*)\s*', podline)
if item:
dl_term = item.group(1)
# Menu items
menu = dl_term.split(':')
if len(menu) > 1 and re.match('[A-Z][a-z]+$', menu[0]):
dl_term = f'menu:{menu[0]}[{",".join(menu[1:])}]'
if state == PodState.ITEM_BODY:
adoc_body += '--\n\n'
adoc_body += f'''\
{dl_term}::
+
--'''
state = PodState.ITEM_BODY
continue
if podline.startswith(skip_commands):
continue
if podline.startswith('='):
sys.stderr.write(f'{manpage_name}: unhandled header on line {linenum}\n')
sys.exit(1)
if re.search('[BCEFLISXZ]<', podline):
sys.stderr.write(f'{manpage_name}: unhandled partial markup on line {linenum}\n')
sys.stderr.write(podline)
sys.exit(1)
# Author / contributor block.
if podline.startswith((' Original Author', ' Contributors')):
if not next(podf).startswith(' --------'):
sys.stderr.write(f'{manpage_name}: unexpected author or contributor markup on line {linenum}\n')
sys.exit(1)
linenum += 1
adoc_body += f'''\
.{podline.strip()}
[%hardbreaks]
'''
state = PodState.AUTHOR
continue
for man_re in re.finditer(r'\b([\w-]+)\(\d\)', podline):
linkfile = man_re.group(1)
if os.path.isfile(os.path.join(os.path.dirname(podfile), linkfile + '.pod')):
podline = re.sub(fr'\b{linkfile}\(', f'xref:{linkfile}.html[{linkfile}](', podline)
elif linkfile in tcpdump_manurls:
podline = re.sub(fr'\b{linkfile}\(', f'xref:{tcpdump_manurls[linkfile]}[{linkfile}](', podline)
# Single line manual fixups
if podline.startswith('*lua_script*__num__:__argument__'):
podline = re.sub('^\*lua_script\*', '**lua_script**', podline)
if '(__field__)__filter__*' in podline:
podline = re.sub(r'^\*([A-Z/]+)(\(__field__\)__filter__)(\*)', r'**\1**', podline)
if podline.startswith('*FRAMES | BYTES[()__filter__]*'):
podline = podline.replace('*FRAMES | BYTES[()__filter__]*', '**FRAMES | BYTES**[()__filter__]')
if state != PodState.PRE:
adoc_body += podline
# Clean up our empty lines.
adoc_body = re.sub('\n\n+', '\n\n', adoc_body)
# Clean up our item blocks.
adoc_body = re.sub('\n+--\n\n', '\n--\n\n', adoc_body)
# Body-wide manual fixups
adoc_body = adoc_body.replace('[<=Jelly Bean]', '[++<=++Jelly Bean]')
with open(adoc_fname, 'w') as adocf:
adocf.write(f'{adoc_body}')
if __name__ == '__main__':
for podfile in sys.argv[1:]:
pod2adoc(podfile)

View File

@ -174,7 +174,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*randpktdump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -599,7 +599,7 @@ xref:text2pcap.html[text2pcap](1), xref:https://www.tcpdump.org/manpages/pcap-fi
*Rawshark* is part of the *Wireshark* distribution. The latest version of
*Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -67,7 +67,7 @@ of *Wireshark* can be found at https://www.wireshark.org.
It may make sense to move this functionality into *editcap*, or perhaps
*mergecap*, in which case *reordercap* could be retired.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -147,7 +147,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*sdjournal* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -292,7 +292,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*Sshdump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -433,29 +433,32 @@ The available report types include:
*column-formats* Dumps the column formats understood by tshark.
There is one record per line. The fields are tab-delimited.
* Field 1 = format string (e.g. "%rD")
* Field 2 = text description of format string (e.g. "Dest port (resolved)")
[horizontal]
Field 1:: format string (e.g. "%rD")
Field 2:: text description of format string (e.g. "Dest port (resolved)")
*currentprefs* Dumps a copy of the current preferences file to stdout.
*decodes* Dumps the "layer type"/"decode as" associations to stdout.
There is one record per line. The fields are tab-delimited.
* Field 1 = layer type, e.g. "tcp.port"
* Field 2 = selector in decimal
* Field 3 = "decode as" name, e.g. "http"
[horizontal]
Field 1:: layer type, e.g. "tcp.port"
Field 2:: selector in decimal
Field 3:: "decode as" name, e.g. "http"
*defaultprefs* Dumps a default preferences file to stdout.
*dissector-tables* Dumps a list of dissector tables to stdout. There
is one record per line. The fields are tab-delimited.
* Field 1 = dissector table name, e.g. "tcp.port"
* Field 2 = name used for the dissector table in the GUI
* Field 3 = type (textual representation of the ftenum type)
* Field 4 = base for display (for integer types)
* Field 5 = protocol name
* Field 6 = "decode as" support
[horizontal]
Field 1:: dissector table name, e.g. "tcp.port"
Field 2:: name used for the dissector table in the GUI
Field 3:: type (textual representation of the ftenum type)
Field 4:: base for display (for integer types)
Field 5:: protocol name
Field 6:: "decode as" support
*elastic-mapping* Dumps the ElasticSearch mapping file to stdout.
@ -467,60 +470,65 @@ tables or HTML or whatever. There is one record per line. Each record is
either a protocol or a header field, differentiated by the first field.
The fields are tab-delimited.
* Protocols
* ---------
* Field 1 = 'P'
* Field 2 = descriptive protocol name
* Field 3 = protocol abbreviation
*
* Header Fields
* -------------
* Field 1 = 'F'
* Field 2 = descriptive field name
* Field 3 = field abbreviation
* Field 4 = type (textual representation of the ftenum type)
* Field 5 = parent protocol abbreviation
* Field 6 = base for display (for integer types); "parent bitfield width" for FT_BOOLEAN
* Field 7 = bitmask: format: hex: 0x....
* Field 8 = blurb describing field
.Protocols
[horizontal]
Field 1:: 'P'
Field 2:: descriptive protocol name
Field 3:: protocol abbreviation
.Header Fields
[horizontal]
Field 1:: 'F'
Field 2:: descriptive field name
Field 3:: field abbreviation
Field 4:: type (textual representation of the ftenum type)
Field 5:: parent protocol abbreviation
Field 6:: base for display (for integer types); "parent bitfield width" for FT_BOOLEAN
Field 7:: bitmask: format: hex: 0x....
Field 8:: blurb describing field
*folders* Dumps various folders used by tshark. This is essentially the
same data reported in Wireshark's About | Folders tab.
There is one record per line. The fields are tab-delimited.
* Field 1 = Folder type (e.g "Personal configuration:")
* Field 2 = Folder location (e.g. "/home/vagrant/.config/wireshark/")
[horizontal]
Field 1:: Folder type (e.g "Personal configuration:")
Field 2:: Folder location (e.g. "/home/vagrant/.config/wireshark/")
*ftypes* Dumps the "ftypes" (fundamental types) understood by tshark.
There is one record per line. The fields are tab-delimited.
* Field 1 = FTYPE (e.g "FT_IPv6")
* Field 2 = text description of type (e.g. "IPv6 address")
[horizontal]
Field 1:: FTYPE (e.g "FT_IPv6")
Field 2:: text description of type (e.g. "IPv6 address")
*heuristic-decodes* Dumps the heuristic decodes currently installed.
There is one record per line. The fields are tab-delimited.
* Field 1 = underlying dissector (e.g. "tcp")
* Field 2 = name of heuristic decoder (e.g. ucp")
* Field 3 = heuristic enabled (e.g. "T" or "F")
[horizontal]
Field 1:: underlying dissector (e.g. "tcp")
Field 2:: name of heuristic decoder (e.g. ucp")
Field 3:: heuristic enabled (e.g. "T" or "F")
*help* Displays the available report types.
*plugins* Dumps the plugins currently installed.
There is one record per line. The fields are tab-delimited.
* Field 1 = plugin library/Lua script/extcap executable (e.g. "gryphon.so")
* Field 2 = plugin version (e.g. 0.0.4)
* Field 3 = plugin type ("dissector", "tap", "file type", etc.)
* Field 4 = full path to plugin file
[horizontal]
Field 1:: plugin library/Lua script/extcap executable (e.g. "gryphon.so")
Field 2:: plugin version (e.g. 0.0.4)
Field 3:: plugin type ("dissector", "tap", "file type", etc.)
Field 4:: full path to plugin file
*protocols* Dumps the protocols in the registration database to stdout.
An independent program can take this output and format it into nice tables
or HTML or whatever. There is one record per line. The fields are tab-delimited.
* Field 1 = protocol name
* Field 2 = protocol short name
* Field 3 = protocol filter name
[horizontal]
Field 1:: protocol name
Field 2:: protocol short name
Field 3:: protocol filter name
*values* Dumps the value_strings, range_strings or true/false strings
for fields that have them. There is one record per line. Fields are
@ -528,27 +536,27 @@ tab-delimited. There are three types of records: Value String, Range
String and True/False String. The first field, 'V', 'R' or 'T', indicates
the type of record.
* Value Strings
* -------------
* Field 1 = 'V'
* Field 2 = field abbreviation to which this value string corresponds
* Field 3 = Integer value
* Field 4 = String
*
* Range Strings
* -------------
* Field 1 = 'R'
* Field 2 = field abbreviation to which this range string corresponds
* Field 3 = Integer value: lower bound
* Field 4 = Integer value: upper bound
* Field 5 = String
*
* True/False Strings
* ------------------
* Field 1 = 'T'
* Field 2 = field abbreviation to which this true/false string corresponds
* Field 3 = True String
* Field 4 = False String
.Value Strings
[horizontal]
Field 1:: 'V'
Field 2:: field abbreviation to which this value string corresponds
Field 3:: Integer value
Field 4:: String
.Range Strings
[horizontal]
Field 1:: 'R'
Field 2:: field abbreviation to which this range string corresponds
Field 3:: Integer value: lower bound
Field 4:: Integer value: upper bound
Field 5:: String
.True/False Strings
[horizontal]
Field 1:: 'T'
Field 2:: field abbreviation to which this true/false string corresponds
Field 3:: True String
Field 4:: False String
--
-h|--help::
@ -2169,8 +2177,8 @@ transport identifier includes one port number and one transport protocol name
An example is:
mydns 5045/udp # My own Domain Name Server
mydns 5045/tcp # My own Domain Name Server
mydns 5045/udp # My own Domain Name Server
mydns 5045/tcp # My own Domain Name Server
--
Name Resolution (ipxnets)::
@ -2218,6 +2226,8 @@ and using a modern terminal application if possible.
== ENVIRONMENT VARIABLES
// Should this be moved to an include file?
WIRESHARK_CONFIG_DIR::
+
--
@ -2347,10 +2357,11 @@ xref:text2pcap.html[text2pcap](1), xref:mergecap.html[mergecap](1), xref:https:/
== NOTES
*TShark* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
This is the manual page for *TShark* {wireshark-version}.
*TShark* is part of the *Wireshark* distribution.
The latest version of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -141,7 +141,7 @@ xref:wireshark.html[wireshark](1), xref:tshark.html[tshark](1), xref:dumpcap.htm
*udpdump* is part of the *Wireshark* distribution. The latest version
of *Wireshark* can be found at https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.
== AUTHORS

View File

@ -3268,6 +3268,8 @@ See above in the description of the About:Plugins page.
== ENVIRONMENT VARIABLES
// Should this be moved to an include file?
WIRESHARK_CONFIG_DIR::
+
--
@ -3413,8 +3415,9 @@ xref:text2pcap.html[text2pcap](1), xref:https://www.tcpdump.org/manpages/pcap-fi
== NOTES
This is the manual page for *Wireshark* {wireshark-version}.
The latest version of *Wireshark* can be found at
https://www.wireshark.org.
HTML versions of the Wireshark project man pages are available at:
HTML versions of the Wireshark project man pages are available at
https://www.wireshark.org/docs/man-pages.