diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 94881c2e..0243afeb 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -67,6 +67,7 @@ 'pages/haproxy', 'pages/haskell', 'pages/jekyll', + 'pages/jq', 'pages/jquery', 'pages/julia', 'pages/knockout', diff --git a/assets/stylesheets/pages/_jq.scss b/assets/stylesheets/pages/_jq.scss new file mode 100644 index 00000000..65252223 --- /dev/null +++ b/assets/stylesheets/pages/_jq.scss @@ -0,0 +1,26 @@ +._jq { + @extend %simple; + + .manual-example table { + border: none; + + & td { + @extend %pre; + &.jqprogram { font-weight: bold; } + border: none; + } + + & th { + color: var(--textColor); + background: var(--contentBackground); + text-align: right; + border: none; + } + + & tr:not(:first-child) th:not(:empty) { + &, & + td { + border-top: 1px solid var(--boxBorder); + } + } + } +} diff --git a/lib/docs/filters/jq/clean_html.rb b/lib/docs/filters/jq/clean_html.rb index e3c9f650..036ee866 100644 --- a/lib/docs/filters/jq/clean_html.rb +++ b/lib/docs/filters/jq/clean_html.rb @@ -2,7 +2,19 @@ module Docs class Jq class CleanHtmlFilter < Filter def call - at_css('div#manualcontent') + content = at_css('div#manualcontent') + + css('.manual-example').each do |node| + container = node.parent + example_header = doc.document.create_element('h4') + example_header.content = container.at_css('a[data-toggle="collapse"]').content + node.children.before(example_header) + + node.remove_class('collapse') + container.replace(node) + end + + content end end end diff --git a/lib/docs/filters/latex/clean_html.rb b/lib/docs/filters/latex/clean_html.rb index 5902679f..98d198ce 100644 --- a/lib/docs/filters/latex/clean_html.rb +++ b/lib/docs/filters/latex/clean_html.rb @@ -13,6 +13,10 @@ module Docs css('h1, h2, h3, h4').each { |node| node.content = node.content.sub /^[0-9A-Z]+(\.[0-9]+)* /, '' } + css('div.example').each do |node| + node.replace(node.children) + end + css('pre').each do |node| node.delete 'class' node['data-language'] = 'latex' diff --git a/lib/docs/scrapers/jq.rb b/lib/docs/scrapers/jq.rb index 4a733505..5125b863 100644 --- a/lib/docs/scrapers/jq.rb +++ b/lib/docs/scrapers/jq.rb @@ -2,7 +2,7 @@ module Docs class Jq < UrlScraper self.name = 'jq' self.slug = 'jq' - self.type = 'simple' + self.type = 'jq' self.release = '1.6' self.links = { home: 'https://stedolan.github.io/jq/'