Skip to content

Commit bacba8d

Browse files
authored
Merge pull request #3242 from masatake/man--subsection
Man: extract subsections
2 parents 1b719af + a2073a8 commit bacba8d

File tree

23 files changed

+640
-51
lines changed

23 files changed

+640
-51
lines changed

Tmain/json-output-format.d/stdout-expected.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{"_type": "tag", "name": "main", "path": "input.go", "pattern": "/^package main$/", "kind": "package"}
99
# json --languages=+man --fields=*-T
1010
{"_type": "tag", "name": "Foo", "path": "input.py", "pattern": "/^class Foo:$/", "language": "Python", "line": 1, "kind": "class", "inherits": false, "access": "public", "roles": "def", "end": 3}
11-
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def"}
11+
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def", "end": 1}
1212
{"_type": "tag", "name": "doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "end": 3}
1313
{"_type": "tag", "name": "foo", "path": "input.c", "pattern": "/^static int foo (void)$/", "file": true, "language": "C", "line": 3, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "extras": "fileScope", "end": 6}
1414
{"_type": "tag", "name": "main", "path": "input.c", "pattern": "/^main(void)$/", "language": "C", "line": 9, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "end": 12}
@@ -24,7 +24,7 @@
2424
{"_type": "ptag", "name": "TAG_PROGRAM_URL", "path": "https://ctags.io/", "pattern": "official site"}
2525
{"_type": "tag", "name": "Foo", "path": "input.py", "pattern": "/^class Foo:$/", "language": "Python", "line": 1, "kind": "class", "inherits": false, "access": "public", "roles": "def", "end": 3}
2626
{"_type": "tag", "name": "Foo.doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "extras": "qualified", "end": 3}
27-
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def"}
27+
{"_type": "tag", "name": "N\tA\tM\tE", "path": "input.1", "pattern": "/^.SH \"\tN\tA\tM\tE\t\"$/", "language": "Man", "line": 1, "kind": "section", "roles": "def", "end": 1}
2828
{"_type": "tag", "name": "doIt", "path": "input.py", "pattern": "/^ def doIt():$/", "language": "Python", "line": 2, "kind": "member", "access": "public", "signature": "()", "scope": "Foo", "scopeKind": "class", "roles": "def", "end": 3}
2929
{"_type": "tag", "name": "foo", "path": "input.c", "pattern": "/^static int foo (void)$/", "file": true, "language": "C", "line": 3, "typeref": "typename:int", "kind": "function", "signature": "(void)", "roles": "def", "extras": "fileScope", "end": 6}
3030
{"_type": "tag", "name": "input.1", "path": "input.1", "pattern": false, "language": "Man", "line": 1, "kind": "file", "roles": "def", "extras": "inputFile", "end": 1}

Tmain/list-mtable-regex-flags.d/stdout-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ p pcre2 use pcre2 regex engine
66
- fatal="MESSAGE" print the given MESSAGE and exit
77
- mgroup=N a group in pattern determining the line number of tag
88
- placeholder don't put this tag to tags file.
9-
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set
9+
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace
1010
- tenter=TABLE[,CONT] enter to given regext table (with specifying continuation)
1111
- tjump=TABLE jump to another regext table(don't push the current table to state stack)
1212
- tleave leave from the current regext table

Tmain/list-regex-flags.d/stdout-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ p pcre2 use pcre2 regex engine
66
x exclusive skip testing the other patterns if a line is matched to this pattern
77
- fatal="MESSAGE" print the given MESSAGE and exit
88
- placeholder don't put this tag to tags file.
9-
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set
9+
- scope=ACTION use scope stack: ACTION = ref|push|pop|clear|set|replace
1010
- warning="MESSAGE" print the given MESSAGE at WARNING level
1111
- _anonymous=PREFIX make an anonymous tag with PREFIX
1212
- _extra=EXTRA record the tag only when the extra is enabled
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--fields=+n
2+
3+
--langdef=X
4+
--map-X=.unknown
5+
--kinddef-X=l,line,lines
6+
7+
--regex-X=/^DEF ([A-Z])//{{
8+
0 string dup 1 _matchloc _matchloc2line exch cvs
9+
/line
10+
1 _matchloc
11+
_tag _commit pop
12+
}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3 input.unknown /^DEF C$/;" l line:3
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
REF A
2+
REF B
3+
DEF C
4+
REF D
5+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--fields=+e
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CTAGS input.1 /^.TH "CTAGS" 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t
2-
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS
1+
CTAGS input.1 /^.TH "CTAGS" 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t end:7
2+
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS end:7
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sort=no
2+
--fields=+e
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
CTAGS input.1 /^.TH CTAGS 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t
2-
DESCRIPTION input.1 /^.SH "DESCRIPTION"$/;" s title:CTAGS
3-
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS
4-
SYNOPSIS input.1 /^.SH SYNOPSIS$/;" s title:CTAGS
1+
CTAGS input.1 /^.TH CTAGS 1 "Version 0.0.0" "Darren Hiebert" "Universal Ctags"$/;" t end:89
2+
NAME input.1 /^.SH "NAME"$/;" s title:CTAGS end:6
3+
ABSTRACT input.1 /^ABSTRACT$/;" s title:CTAGS end:9
4+
SYNOPSIS input.1 /^.SH SYNOPSIS$/;" s title:CTAGS end:16
5+
DESCRIPTION input.1 /^.SH "DESCRIPTION"$/;" s title:CTAGS end:25
6+
AUTHOR input.1 /^AUTHOR$/;" s title:CTAGS end:52
7+
subsection1 input.1 /^.SS subsection1$/;" S section:CTAGS""AUTHOR end:34
8+
subsection2 input.1 /^.SS "subsection2"$/;" S section:CTAGS""AUTHOR end:38
9+
subsection3 input.1 /^subsection3$/;" S section:CTAGS""AUTHOR end:43
10+
sub section 4 input.1 /^.SS sub section 4$/;" S section:CTAGS""AUTHOR end:47
11+
sub section 5 input.1 /^sub section 5$/;" S section:CTAGS""AUTHOR end:52
12+
ACKNOWLEDGMENT input.1 /^ACKNOWLEDGMENT$/;" s title:CTAGS end:83
13+
subsection6 input.1 /^subsection6$/;" S section:CTAGS""ACKNOWLEDGMENT end:61
14+
subsection7 input.1 /^subsection7$/;" S section:CTAGS""ACKNOWLEDGMENT end:66
15+
subsection8 input.1 /^.SS "subsection8"$/;" S section:CTAGS""ACKNOWLEDGMENT end:70
16+
subsection9 input.1 /^.SS subsection9$/;" S section:CTAGS""ACKNOWLEDGMENT end:74
17+
sub section 10 input.1 /^.SS sub section 10$/;" S section:CTAGS""ACKNOWLEDGMENT end:78
18+
sub section 11 input.1 /^sub section 11$/;" S section:CTAGS""ACKNOWLEDGMENT end:83
19+
SEE ALSO input.1 /^.SH SEE ALSO$/;" s title:CTAGS end:89
20+
sub section 12 input.1 /^sub section 12$/;" S section:CTAGS""SEE ALSO end:89

0 commit comments

Comments
 (0)