Skip to content

Commit 507b32e

Browse files
committed
ReStructuredText: extract titles and subtitles
Close #3224. Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 5825596 commit 507b32e

File tree

16 files changed

+281
-27
lines changed

16 files changed

+281
-27
lines changed
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
#
22
# with --sort=yes
33
#
4-
A spaces B input_space.rst /^A spaces B$/;" c
4+
A spaces B input_space.rst /^A spaces B$/;" H
55
test input file.cc /^int32 test(int32 a)$/;" f typeref:typename:int32 signature:(int32 a)
66
test2 input file.cc /^int32 test2(void)$/;" f typeref:typename:int32 signature:(void)
77
test3 input file.cc /^int32 test3(int32 a)$/;" f typeref:typename:int32 signature:(int32 a)
88
test4 input file.cc /^int32 test4(int32$/;" f typeref:typename:int32 signature:(int32 a)
99
# WITH SCOPE
10-
X space Y input_scope.rst /^X space Y$/;" s chapter:title
11-
title input_scope.rst /^title$/;" c
12-
topic in space input_scope.rst /^topic in space$/;" S section:X space Y
10+
X space Y input_scope.rst /^X space Y$/;" c title:title
11+
title input_scope.rst /^title$/;" H
12+
topic in space input_scope.rst /^topic in space$/;" s chapter:X space Y
1313
# WITHOUT SCOPE
14-
X space Y input_scope.rst /^X space Y$/;" s
15-
title input_scope.rst /^title$/;" c
16-
topic in space input_scope.rst /^topic in space$/;" S
17-
topic in tab input_scope.rst /^topic in tab$/;" S
14+
X space Y input_scope.rst /^X space Y$/;" c
15+
title input_scope.rst /^title$/;" H
16+
topic in space input_scope.rst /^topic in space$/;" s
17+
topic in tab input_scope.rst /^topic in tab$/;" s
1818
#
1919
# with --sort=no
2020
#
2121
test input file.cc /^int32 test(int32 a)$/;" f typeref:typename:int32 signature:(int32 a)
2222
test2 input file.cc /^int32 test2(void)$/;" f typeref:typename:int32 signature:(void)
2323
test3 input file.cc /^int32 test3(int32 a)$/;" f typeref:typename:int32 signature:(int32 a)
2424
test4 input file.cc /^int32 test4(int32$/;" f typeref:typename:int32 signature:(int32 a)
25-
A spaces B input_space.rst /^A spaces B$/;" c
25+
A spaces B input_space.rst /^A spaces B$/;" H
2626
# WITH SCOPE
27-
title input_scope.rst /^title$/;" c
28-
X space Y input_scope.rst /^X space Y$/;" s chapter:title
29-
topic in space input_scope.rst /^topic in space$/;" S section:X space Y
27+
title input_scope.rst /^title$/;" H
28+
X space Y input_scope.rst /^X space Y$/;" c title:title
29+
topic in space input_scope.rst /^topic in space$/;" s chapter:X space Y
3030
# WITHOUT SCOPE
31-
title input_scope.rst /^title$/;" c
32-
topic in tab input_scope.rst /^topic in tab$/;" S
33-
X space Y input_scope.rst /^X space Y$/;" s
34-
topic in space input_scope.rst /^topic in space$/;" S
31+
title input_scope.rst /^title$/;" H
32+
topic in tab input_scope.rst /^topic in tab$/;" s
33+
X space Y input_scope.rst /^X space Y$/;" c
34+
topic in space input_scope.rst /^topic in space$/;" s
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
KVM VCPU Requests input.rst /^KVM VCPU Requests$/;" c sectionMarker:= overline:
2-
VCPU Request Internals input.rst /^VCPU Request Internals$/;" s chapter:KVM VCPU Requests sectionMarker:=
3-
References input.rst /^References$/;" s chapter:KVM VCPU Requests sectionMarker:=
4-
atomic-ops input.rst /^.. [atomic-ops] Documentation\/core-api\/atomic_ops.rst$/;" C section:References
5-
memory-barriers input.rst /^.. [memory-barriers] Documentation\/memory-barriers.txt$/;" C section:References
6-
lwn-mb input.rst /^.. [lwn-mb] https:\/\/lwn.net\/Articles\/573436\/$/;" C section:References
1+
KVM VCPU Requests input.rst /^KVM VCPU Requests$/;" H sectionMarker:= overline:
2+
VCPU Request Internals input.rst /^VCPU Request Internals$/;" c title:KVM VCPU Requests sectionMarker:=
3+
References input.rst /^References$/;" c title:KVM VCPU Requests sectionMarker:=
4+
atomic-ops input.rst /^.. [atomic-ops] Documentation\/core-api\/atomic_ops.rst$/;" C chapter:References
5+
memory-barriers input.rst /^.. [memory-barriers] Documentation\/memory-barriers.txt$/;" C chapter:References
6+
lwn-mb input.rst /^.. [lwn-mb] https:\/\/lwn.net\/Articles\/573436\/$/;" C chapter:References
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Ch�pt�r 1 input.rst /^Ch�pt�r 1$/;" c
1+
Ch�pt�r 1 input.rst /^Ch�pt�r 1$/;" c subtitle:S�bit�tl�
22
Subsubsection 1.1.1.1 input.rst /^Subsubsection 1.1.1.1$/;" t subsection:S�bs
33
S��ti�n 1.1 input.rst /^S��ti�n 1.1$/;" s chapter:Ch�pt�r 1
44
S�bs input.rst /^S�bs$/;" S section:S��ti�n 1.1
5+
S�bit�tl� input.rst /^S�bit�tl�$/;" h title:T�tl�
6+
T�tl� input.rst /^T�tl�$/;" H

Units/parser-restructuredtext.r/iso8859-1-restructuredtext.d/input.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
=======================================
2+
Tîtlë
3+
=======================================
4+
---------------------------------------
5+
Sûbitïtlê
6+
---------------------------------------
7+
18
Chàptèr 1
29
=========
310

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
struct cpuidle_state input.rst /^.. |struct cpuidle_state| replace:: :c:type:`struct cpuidle_state <cpuidle_state>`$/;" d
22
cpufreq input.rst /^.. |cpufreq| replace:: :doc:`CPU Performance Scaling <cpufreq>`$/;" d
3-
CPU Idle Time Management input.rst /^CPU Idle Time Management$/;" c
3+
CPU Idle Time Management input.rst /^CPU Idle Time Management$/;" H

Units/parser-restructuredtext.r/target-restructuredtext.d/expected.tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ANOTHER TITLE input.rst /^ANOTHER TITLE$/;" c
12
TITLE input.rst /^TITLE$/;" c
23
title-target input.rst /^.. _title-target:$/;" T chapter:TITLE
34
section0 input.rst /^section0$/;" s chapter:TITLE

Units/parser-restructuredtext.r/target-restructuredtext.d/input.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
===========================================
2+
ANOTHER TITLE
3+
===========================================
4+
15
===========================================
26
TITLE
37
===========================================
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--sort=no
2+
--fields=+ZK
3+
--fields-ReStructuredText=+{sectionMarker}{overline}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
TITLE input.rst /^TITLE$/;" title sectionMarker:= overline:
2+
Subtitle input.rst /^Subtitle$/;" subtitle scope:title:TITLE sectionMarker:- overline:
3+
a input.rst /^.. [a] a.rst$/;" citation scope:subtitle:Subtitle
4+
Chapter input.rst /^Chapter$/;" chapter scope:subtitle:Subtitle sectionMarker:=
5+
b input.rst /^.. [b] b.rst$/;" citation scope:chapter:Chapter
6+
Section input.rst /^Section$/;" section scope:chapter:Chapter sectionMarker:-
7+
c input.rst /^.. [c] c.rst$/;" citation scope:section:Section
8+
Subsection input.rst /^Subsection$/;" subsection scope:section:Section sectionMarker:|
9+
d input.rst /^.. [d] d.rst$/;" citation scope:subsection:Subsection
10+
SubSubsection input.rst /^SubSubsection$/;" subsubsection scope:subsection:Subsection sectionMarker:. overline:
11+
e input.rst /^.. [e] e.rst$/;" citation scope:subsubsection:SubSubsection
12+
f input.rst /^.. [f] f.rst$/;" citation scope:subsubsection:SubSubsection
13+
g input.rst /^.. [g] g.rst$/;" citation scope:subsubsection:SubSubsection
14+
Chapter2 input.rst /^Chapter2$/;" chapter scope:subtitle:Subtitle sectionMarker:=
15+
h input.rst /^.. [h] g.rst$/;" citation scope:chapter:Chapter2
16+
C0 input-0.rst /^C0$/;" chapter sectionMarker:= overline:
17+
S0 input-0.rst /^S0$/;" section scope:chapter:C0 sectionMarker:- overline:
18+
s0 input-0.rst /^s0$/;" subsection scope:section:S0 sectionMarker:=
19+
C1 input-0.rst /^C1$/;" chapter sectionMarker:= overline:
20+
S1 input-0.rst /^S1$/;" section scope:chapter:C1 sectionMarker:- overline:
21+
s1 input-0.rst /^s1$/;" subsection scope:section:S1 sectionMarker:=
22+
T0 input-1.rst /^ T0$/;" title sectionMarker:= overline:
23+
xC0 input-1.rst /^ xC0$/;" chapter scope:title:T0 sectionMarker:- overline:
24+
xs0 input-1.rst /^xs0$/;" section scope:chapter:xC0 sectionMarker:=
25+
xC1 input-1.rst /^xC1$/;" chapter scope:title:T0 sectionMarker:- overline:
26+
xs1 input-1.rst /^xs1$/;" section scope:chapter:xC1 sectionMarker:=
27+
yT0 input-2.rst /^ yT0$/;" title sectionMarker:= overline:
28+
yST0 input-2.rst /^yST0$/;" subtitle scope:title:yT0 sectionMarker:-
29+
yC0 input-2.rst /^yC0$/;" chapter scope:subtitle:yST0 sectionMarker:=
30+
yC1 input-2.rst /^yC1$/;" chapter scope:subtitle:yST0 sectionMarker:=
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
==============================================
2+
C0
3+
==============================================
4+
----------------------------------------------
5+
S0
6+
----------------------------------------------
7+
8+
s0
9+
==============================================
10+
11+
==============================================
12+
C1
13+
==============================================
14+
----------------------------------------------
15+
S1
16+
----------------------------------------------
17+
18+
s1
19+
==============================================

0 commit comments

Comments
 (0)