Skip to content

Commit

Permalink
Update man page generating program to python3.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Aug 3, 2024
1 parent 3ec91f2 commit ec14cd9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mingw:
$(MAKE) && $(MAKE) install

man/man3/cmark.3: src/cmark.h | $(CMARK)
python man/make_man_page.py $< > $@ \
python3 man/make_man_page.py $< > $@ \

archive:
git archive --prefix=$(RELEASE)/ -o $(RELEASE).tar.gz HEAD
Expand Down
22 changes: 11 additions & 11 deletions man/make_man_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ def md2man(text):
textlen = len(text)
return render_man(parse_document(textbytes, textlen), 0, 72)

comment_start_re = re.compile('^\/\*\* ?')
comment_delim_re = re.compile('^[/ ]\** ?')
comment_end_re = re.compile('^ \**\/')
function_re = re.compile('^ *(?:CMARK_EXPORT\s+)?(?P<type>(?:const\s+)?\w+(?:\s*[*])?)\s*(?P<name>\w+)\s*\((?P<args>[^)]*)\)')
blank_re = re.compile('^\s*$')
macro_re = re.compile('CMARK_EXPORT *')
typedef_start_re = re.compile('typedef.*{$')
typedef_end_re = re.compile('}')
single_quote_re = re.compile("(?<!\w)'([^']+)'(?!\w)")
double_quote_re = re.compile("(?<!\w)''([^']+)''(?!\w)")
comment_start_re = re.compile(r'^\/\*\* ?')
comment_delim_re = re.compile(r'^[/ ]\** ?')
comment_end_re = re.compile(r'^ \**\/')
function_re = re.compile(r'^ *(?:CMARK_EXPORT\s+)?(?P<type>(?:const\s+)?\w+(?:\s*[*])?)\s*(?P<name>\w+)\s*\((?P<args>[^)]*)\)')
blank_re = re.compile(r'^\s*$')
macro_re = re.compile(r'CMARK_EXPORT *')
typedef_start_re = re.compile(r'typedef.*{$')
typedef_end_re = re.compile(r'}')
single_quote_re = re.compile(r"(?<!\w)'([^']+)'(?!\w)")
double_quote_re = re.compile(r"(?<!\w)''([^']+)''(?!\w)")

def handle_quotes(s):
return re.sub(double_quote_re, '**\g<1>**', re.sub(single_quote_re, '*\g<1>*', s))
return re.sub(double_quote_re, r'**\g<1>**', re.sub(single_quote_re, r'*\g<1>*', s))

typedef = False
mdlines = []
Expand Down

0 comments on commit ec14cd9

Please sign in to comment.