Previously, only non-text statements (such as `**`) were added. Now also `for`, `if`, `elif`, `else`, ... are added See https://github.com/freeCodeCamp/devdocs/issues/696#issuecomment-1243554434
Showing the changes to lib (1 of 1 file). Show all
Unified · Split
| @@ -90,8 +90,6 @@ module Docs · 89 unmodified lines | |||
| 90 | name = node.content.remove("\u{00b6}") | 90 | name = node.content.remove("\u{00b6}") |
| 91 | name.concat " (#{self.name})" if slug.start_with?('library') | 91 | name.concat " (#{self.name})" if slug.start_with?('library') |
| 92 | entries << [name, node.parent['id']] | 92 | entries << [name, node.parent['id']] |
| 93 | statement = name[/The (.+) statement/, 1] | ||
| 94 | entries << ["#{statement} (statement)", node.parent['id'], 'Statements'] if statement && slug.start_with?('reference') | ||
| 95 | end | 93 | end |
| 96 | end | 94 | end |
| 97 | 95 | ||
| @@ -112,19 +110,25 @@ module Docs · 14 unmodified lines | |||
| 112 | name = node.children.first | 110 | name = node.children.first |
| 113 | next unless name.text? | 111 | next unless name.text? |
| 114 | name = name.text.strip() | 112 | name = name.text.strip() |
| 115 | next if name[/^\w/] || name[/^-+\w/] | 113 | next if name[/Python Enhancement Proposals/] |
| 116 | node.css('> ul > li > a').each do |inner_node| | 114 | node.css('> ul > li > a').each do |inner_node| |
| 117 | inner_name = inner_node.text.strip() | 115 | inner_name = inner_node.text.strip() |
| 118 | next if inner_name[/\[\d+\]/] | 116 | next if inner_name[/\[\d+\]/] |
| 117 | href = inner_node['href'] | ||
| 118 | next if (name[/^\w/] || name[/^-+\w/]) && !href[/stmts/] | ||
| 119 | type = case inner_name | 119 | type = case inner_name |
| 120 | when 'keyword' | ||
| 121 | 'Keywords' | ||
| 120 | when 'operator' | 122 | when 'operator' |
| 121 | 'Operators' | 123 | 'Operators' |
| 122 | when 'in regular expressions' | 124 | when 'in regular expressions' |
| 123 | 'Regular Expression' | 125 | 'Regular Expression' |
| 126 | when /statement/ | ||
| 127 | 'Statements' | ||
| 124 | else | 128 | else |
| 125 | 'Symbols' | 129 | 'Symbols' |
| 126 | end | 130 | end |
| 127 | entries << ["#{name} (#{inner_name})", inner_node['href'], type] | 131 | entries << ["#{name} (#{inner_name})", href, type] |
| 128 | end | 132 | end |
| 129 | end | 133 | end |
| 130 | end | 134 | end |