aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/androiddump.adoc (renamed from doc/androiddump.pod)0
-rw-r--r--doc/asn2deb.adoc (renamed from doc/asn2deb.pod)0
-rw-r--r--doc/capinfos.adoc (renamed from doc/capinfos.pod)0
-rw-r--r--doc/captype.adoc (renamed from doc/captype.pod)0
-rw-r--r--doc/ciscodump.adoc (renamed from doc/ciscodump.pod)0
-rw-r--r--doc/dftest.adoc (renamed from doc/dftest.pod)0
-rw-r--r--doc/dpauxmon.adoc (renamed from doc/dpauxmon.pod)0
-rw-r--r--doc/dumpcap.adoc (renamed from doc/dumpcap.pod)0
-rw-r--r--doc/editcap.adoc (renamed from doc/editcap.pod)0
-rw-r--r--doc/etwdump.adoc (renamed from doc/etwdump.pod)0
-rw-r--r--doc/extcap.adoc (renamed from doc/extcap.pod)0
-rw-r--r--doc/idl2deb.adoc (renamed from doc/idl2deb.pod)0
-rw-r--r--doc/idl2wrs.adoc (renamed from doc/idl2wrs.pod)0
-rw-r--r--doc/mergecap.adoc (renamed from doc/mergecap.pod)0
-rw-r--r--doc/mmdbresolve.adoc (renamed from doc/mmdbresolve.pod)0
-rwxr-xr-xdoc/pod2adoc.py210
-rw-r--r--doc/randpkt.adoc (renamed from doc/randpkt.pod)0
-rw-r--r--doc/randpktdump.adoc (renamed from doc/randpktdump.pod)0
-rw-r--r--doc/rawshark.adoc (renamed from doc/rawshark.pod)0
-rw-r--r--doc/reordercap.adoc (renamed from doc/reordercap.pod)0
-rw-r--r--doc/sdjournal.adoc (renamed from doc/sdjournal.pod)0
-rw-r--r--doc/sshdump.adoc (renamed from doc/sshdump.pod)0
-rw-r--r--doc/text2pcap.adoc (renamed from doc/text2pcap.pod)0
-rw-r--r--doc/tshark.adoc (renamed from doc/tshark.pod)0
-rw-r--r--doc/udpdump.adoc (renamed from doc/udpdump.pod)0
-rw-r--r--doc/wireshark-filter.adoc (renamed from doc/wireshark-filter.pod)0
-rw-r--r--doc/wireshark.adoc (renamed from doc/wireshark.pod)0
27 files changed, 210 insertions, 0 deletions
diff --git a/doc/androiddump.pod b/doc/androiddump.adoc
index 5747968d38..5747968d38 100644
--- a/doc/androiddump.pod
+++ b/doc/androiddump.adoc
diff --git a/doc/asn2deb.pod b/doc/asn2deb.adoc
index 7484e9c6dd..7484e9c6dd 100644
--- a/doc/asn2deb.pod
+++ b/doc/asn2deb.adoc
diff --git a/doc/capinfos.pod b/doc/capinfos.adoc
index fd5e0417c2..fd5e0417c2 100644
--- a/doc/capinfos.pod
+++ b/doc/capinfos.adoc
diff --git a/doc/captype.pod b/doc/captype.adoc
index 1ea31d2558..1ea31d2558 100644
--- a/doc/captype.pod
+++ b/doc/captype.adoc
diff --git a/doc/ciscodump.pod b/doc/ciscodump.adoc
index 30c0503f5a..30c0503f5a 100644
--- a/doc/ciscodump.pod
+++ b/doc/ciscodump.adoc
diff --git a/doc/dftest.pod b/doc/dftest.adoc
index 6f2ae63e9a..6f2ae63e9a 100644
--- a/doc/dftest.pod
+++ b/doc/dftest.adoc
diff --git a/doc/dpauxmon.pod b/doc/dpauxmon.adoc
index 196b0da066..196b0da066 100644
--- a/doc/dpauxmon.pod
+++ b/doc/dpauxmon.adoc
diff --git a/doc/dumpcap.pod b/doc/dumpcap.adoc
index 29ca7a8ff2..29ca7a8ff2 100644
--- a/doc/dumpcap.pod
+++ b/doc/dumpcap.adoc
diff --git a/doc/editcap.pod b/doc/editcap.adoc
index d24576f86c..d24576f86c 100644
--- a/doc/editcap.pod
+++ b/doc/editcap.adoc
diff --git a/doc/etwdump.pod b/doc/etwdump.adoc
index 4694e69b1e..4694e69b1e 100644
--- a/doc/etwdump.pod
+++ b/doc/etwdump.adoc
diff --git a/doc/extcap.pod b/doc/extcap.adoc
index a0564a886e..a0564a886e 100644
--- a/doc/extcap.pod
+++ b/doc/extcap.adoc
diff --git a/doc/idl2deb.pod b/doc/idl2deb.adoc
index 8a2c7bae8d..8a2c7bae8d 100644
--- a/doc/idl2deb.pod
+++ b/doc/idl2deb.adoc
diff --git a/doc/idl2wrs.pod b/doc/idl2wrs.adoc
index a321137baa..a321137baa 100644
--- a/doc/idl2wrs.pod
+++ b/doc/idl2wrs.adoc
diff --git a/doc/mergecap.pod b/doc/mergecap.adoc
index 12e5e40755..12e5e40755 100644
--- a/doc/mergecap.pod
+++ b/doc/mergecap.adoc
diff --git a/doc/mmdbresolve.pod b/doc/mmdbresolve.adoc
index 7d7ffa889f..7d7ffa889f 100644
--- a/doc/mmdbresolve.pod
+++ b/doc/mmdbresolve.adoc
diff --git a/doc/pod2adoc.py b/doc/pod2adoc.py
new file mode 100755
index 0000000000..86f1ec3c02
--- /dev/null
+++ b/doc/pod2adoc.py
@@ -0,0 +1,210 @@
+#!/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)
diff --git a/doc/randpkt.pod b/doc/randpkt.adoc
index 7e65ba2445..7e65ba2445 100644
--- a/doc/randpkt.pod
+++ b/doc/randpkt.adoc
diff --git a/doc/randpktdump.pod b/doc/randpktdump.adoc
index 887146d495..887146d495 100644
--- a/doc/randpktdump.pod
+++ b/doc/randpktdump.adoc
diff --git a/doc/rawshark.pod b/doc/rawshark.adoc
index 525df2ac7b..525df2ac7b 100644
--- a/doc/rawshark.pod
+++ b/doc/rawshark.adoc
diff --git a/doc/reordercap.pod b/doc/reordercap.adoc
index 5135acbc48..5135acbc48 100644
--- a/doc/reordercap.pod
+++ b/doc/reordercap.adoc
diff --git a/doc/sdjournal.pod b/doc/sdjournal.adoc
index dbbb96de60..dbbb96de60 100644
--- a/doc/sdjournal.pod
+++ b/doc/sdjournal.adoc
diff --git a/doc/sshdump.pod b/doc/sshdump.adoc
index 4de0678336..4de0678336 100644
--- a/doc/sshdump.pod
+++ b/doc/sshdump.adoc
diff --git a/doc/text2pcap.pod b/doc/text2pcap.adoc
index 4a5a653461..4a5a653461 100644
--- a/doc/text2pcap.pod
+++ b/doc/text2pcap.adoc
diff --git a/doc/tshark.pod b/doc/tshark.adoc
index a0e04a9535..a0e04a9535 100644
--- a/doc/tshark.pod
+++ b/doc/tshark.adoc
diff --git a/doc/udpdump.pod b/doc/udpdump.adoc
index 4077ccf7a8..4077ccf7a8 100644
--- a/doc/udpdump.pod
+++ b/doc/udpdump.adoc
diff --git a/doc/wireshark-filter.pod b/doc/wireshark-filter.adoc
index 4571f0daeb..4571f0daeb 100644
--- a/doc/wireshark-filter.pod
+++ b/doc/wireshark-filter.adoc
diff --git a/doc/wireshark.pod b/doc/wireshark.adoc
index cf6ad7fa97..cf6ad7fa97 100644
--- a/doc/wireshark.pod
+++ b/doc/wireshark.adoc