@@ -65,7 +65,7 @@ func NewGHDoc(Path string, AbsPaths bool, StartDepth int, Depth int, Escape bool
65
65
httpGetter : internal .HttpGet ,
66
66
httpPoster : internal .HttpPost ,
67
67
ghURL : "https://api.github.com" ,
68
- reVersion : "0" ,
68
+ reVersion : internal . GH_2024_03 ,
69
69
}
70
70
}
71
71
@@ -168,18 +168,29 @@ func (doc *GHDoc) GrabToc() *GHToc {
168
168
// si:
169
169
// - s - let . match \n (single-line mode)
170
170
// - i - case-insensitive
171
- re := `(?si)<h(?P<num>[1-6]) id="[^"]+">\s*` +
172
- `<a class="heading-link"\s*` +
173
- `href="(?P<href>[^"]+)">\s*` +
174
- `(?P<name>.*?)<span`
175
- if doc .reVersion == "0" {
171
+ re := ""
172
+ if doc .reVersion == internal .GH_V0 {
176
173
re = `(?si)<h(?P<num>[1-6])>\s*` +
177
174
`<a\s*id="user-content-[^"]*"\s*class="anchor"\s*` +
178
175
`(aria-hidden="[^"]*"\s*)?` +
179
176
`(tabindex="[^"]*"\s*)?` +
180
177
`href="(?P<href>[^"]*)"[^>]*>\s*` +
181
178
`.*?</a>(?P<name>.*?)</h`
182
179
}
180
+ if doc .reVersion == internal .GH_2023_10 {
181
+ re = `(?si)<h(?P<num>[1-6]) id="[^"]+">\s*` +
182
+ `<a class="heading-link"\s*` +
183
+ `href="(?P<href>[^"]+)">\s*` +
184
+ `(?P<name>.*?)<span`
185
+ }
186
+ if doc .reVersion == internal .GH_2024_03 {
187
+ re = `(?si)<h(?P<num>[1-6]) class="heading-element">(?P<name>[^<]+)</h\d>` +
188
+ `<a\s*id="user-content-[^"]*"\s*` +
189
+ `class="[^"]*"\s*` +
190
+ `aria-label="[^"]*"\s*` +
191
+ `href="(?P<href>[^"]+)">`
192
+ }
193
+
183
194
r := regexp .MustCompile (re )
184
195
listIndentation := internal .GenerateListIndentation (doc .Indent )
185
196
0 commit comments