mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
react_bootstrap: clean html
This commit is contained in:
parent
306b264d76
commit
8ceba764dd
1 changed files with 7 additions and 1 deletions
|
@ -2,12 +2,14 @@ module Docs
|
|||
class ReactBootstrap
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = doc.at_css('main')
|
||||
|
||||
css('.flex-column.d-flex').remove
|
||||
css('header').remove
|
||||
css('.bs-example').remove
|
||||
|
||||
css('.position-relative pre').each do |node|
|
||||
# node.content = node.content
|
||||
node.content = node.children.map(&:content).join("\n")
|
||||
node.remove_attribute('style')
|
||||
node['data-language'] = 'jsx'
|
||||
node.parent.replace(node)
|
||||
|
@ -16,6 +18,10 @@ module Docs
|
|||
css('div, main, pre, h1, h2, h3, h4, h5, h6, a, p').each do |node|
|
||||
node.delete 'class'
|
||||
end
|
||||
css('h1, h2, h3, h4, h5, h6').each do |node|
|
||||
node.css('a').remove
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
css('#___gatsby, #gatsby-focus-wrapper').each do |node|
|
||||
node.delete 'id'
|
||||
|
|
Loading…
Reference in a new issue