Fix PHPUnit searching
Unified · Split
| @@ -9,14 +9,16 @@ module Docs · 8 unmodified lines | |||
| 9 | node['data-language'] = 'php' | 9 | node['data-language'] = 'php' |
| 10 | end | 10 | end |
| 11 | 11 | ||
| 12 | # When extracting strings, filter out non-ASCII chars that mysteriously get added. | ||
| 13 | |||
| 12 | if slug.match(/assertion|annotations|configuration/) | 14 | if slug.match(/assertion|annotations|configuration/) |
| 13 | css('h2').each do |node| | 15 | css('h2').each do |node| |
| 14 | node['id'] = node.content | 16 | node['id'] = node.content.gsub(/\P{ASCII}/, '') |
| 15 | end | 17 | end |
| 16 | end | 18 | end |
| 17 | 19 | ||
| 18 | css('h1').each do |node| | 20 | css('h1', 'h2', 'h3').each do |node| |
| 19 | node.content = node.content.gsub(/\d*\./, '').strip | 21 | node.content = node.content.gsub(/\d*\. |\P{ASCII}/, '') |
| 20 | end | 22 | end |
| 21 | 23 | ||
| 22 | doc | 24 | doc |
| @@ -7,8 +7,9 @@ module Docs · 6 unmodified lines | |||
| 7 | end | 7 | end |
| 8 | 8 | ||
| 9 | def get_type | 9 | def get_type |
| 10 | name.gsub!(/\P{ASCII}/, '') | ||
| 10 | if name.in? ['Assertions', 'Annotations', 'The XML Configuration File'] | 11 | if name.in? ['Assertions', 'Annotations', 'The XML Configuration File'] |
| 11 | name | 12 | name.gsub('The ', '') |
| 12 | else | 13 | else |
| 13 | 'Guides' | 14 | 'Guides' |
| 14 | end | 15 | end |
| @@ -17,11 +18,10 @@ module Docs · 2 unmodified lines | |||
| 17 | def additional_entries | 18 | def additional_entries |
| 18 | return [] if type == 'Guides' | 19 | return [] if type == 'Guides' |
| 19 | 20 | ||
| 20 | css('h2').map do |node| | 21 | css('h3').map do |node| |
| 21 | [node.content, node['id']] | 22 | [node.content.gsub('The ', ''), node['id'] || node.ancestors('section[id]').first['id']] |
| 22 | end | 23 | end |
| 23 | end | 24 | end |
| 24 | |||
| 25 | end | 25 | end |
| 26 | end | 26 | end |
| 27 | end | 27 | end |
| @@ -24,7 +24,7 @@ module Docs · 23 unmodified lines | |||
| 24 | FILTERS = %w(phpunit/clean_html phpunit/entries title) | 24 | FILTERS = %w(phpunit/clean_html phpunit/entries title) |
| 25 | 25 | ||
| 26 | version do | 26 | version do |
| 27 | self.release = '12.0' | 27 | self.release = '12.5' |
| 28 | self.base_url = "https://docs.phpunit.de/en/#{release}/" | 28 | self.base_url = "https://docs.phpunit.de/en/#{release}/" |
| 29 | 29 | ||
| 30 | html_filters.push FILTERS | 30 | html_filters.push FILTERS |