Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/docs/filters/phpunit/clean_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ def call
node['data-language'] = 'php'
end

# When extracting strings, filter out non-ASCII chars that mysteriously get added.

if slug.match(/assertion|annotations|configuration/)
css('h2').each do |node|
node['id'] = node.content
node['id'] = node.content.gsub(/\P{ASCII}/, '')
end
end

css('h1').each do |node|
node.content = node.content.gsub(/\d*\./, '').strip
css('h1', 'h2', 'h3').each do |node|
node.content = node.content.gsub(/\d*\. |\P{ASCII}/, '')
end

doc
Expand Down
8 changes: 4 additions & 4 deletions lib/docs/filters/phpunit/entries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ def get_name
end

def get_type
name.gsub!(/\P{ASCII}/, '')
if name.in? ['Assertions', 'Annotations', 'The XML Configuration File']
name
name.gsub('The ', '')
else
'Guides'
end
Expand All @@ -17,11 +18,10 @@ def get_type
def additional_entries
return [] if type == 'Guides'

css('h2').map do |node|
[node.content, node['id']]
css('h3').map do |node|
[node.content.gsub('The ', ''), node['id']]
end
end

end
end
end
2 changes: 1 addition & 1 deletion lib/docs/scrapers/phpunit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Phpunit < UrlScraper
FILTERS = %w(phpunit/clean_html phpunit/entries title)

version do
self.release = '12.0'
self.release = '12.5'
self.base_url = "https://docs.phpunit.de/en/#{release}/"

html_filters.push FILTERS
Expand Down