Skip to content

Commit 69db669

Browse files
authored
Merge pull request #2644 from spamguy/phpunit
Fix PHPUnit searching
2 parents 3ddb499 + e110b2c commit 69db669

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

lib/docs/filters/phpunit/clean_html.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ def call
99
node['data-language'] = 'php'
1010
end
1111

12+
# When extracting strings, filter out non-ASCII chars that mysteriously get added.
13+
1214
if slug.match(/assertion|annotations|configuration/)
1315
css('h2').each do |node|
14-
node['id'] = node.content
16+
node['id'] = node.content.gsub(/\P{ASCII}/, '')
1517
end
1618
end
1719

18-
css('h1').each do |node|
19-
node.content = node.content.gsub(/\d*\./, '').strip
20+
css('h1', 'h2', 'h3').each do |node|
21+
node.content = node.content.gsub(/\d*\. |\P{ASCII}/, '')
2022
end
2123

2224
doc

lib/docs/filters/phpunit/entries.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ def get_name
77
end
88

99
def get_type
10+
name.gsub!(/\P{ASCII}/, '')
1011
if name.in? ['Assertions', 'Annotations', 'The XML Configuration File']
11-
name
12+
name.gsub('The ', '')
1213
else
1314
'Guides'
1415
end
@@ -17,11 +18,10 @@ def get_type
1718
def additional_entries
1819
return [] if type == 'Guides'
1920

20-
css('h2').map do |node|
21-
[node.content, node['id']]
21+
css('h3').map do |node|
22+
[node.content.gsub('The ', ''), node['id'] || node.ancestors('section[id]').first['id']]
2223
end
2324
end
24-
2525
end
2626
end
2727
end

lib/docs/scrapers/phpunit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Phpunit < UrlScraper
2424
FILTERS = %w(phpunit/clean_html phpunit/entries title)
2525

2626
version do
27-
self.release = '12.0'
27+
self.release = '12.5'
2828
self.base_url = "https://docs.phpunit.de/en/#{release}/"
2929

3030
html_filters.push FILTERS

0 commit comments

Comments
 (0)