From 651f20a8f9fea9685195263ab896b66c7510ebfd Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Wed, 21 Aug 2019 15:52:18 +0200 Subject: [PATCH] gcc: enable syntax highlighting --- lib/docs/filters/gcc/clean_html.rb | 12 ++++++++++++ lib/docs/scrapers/gnu/gcc.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 lib/docs/filters/gcc/clean_html.rb diff --git a/lib/docs/filters/gcc/clean_html.rb b/lib/docs/filters/gcc/clean_html.rb new file mode 100644 index 00000000..14639b3e --- /dev/null +++ b/lib/docs/filters/gcc/clean_html.rb @@ -0,0 +1,12 @@ +module Docs + class Gcc + class CleanHtmlFilter < Filter + def call + css('pre').each do |node| + node['data-language'] = 'cpp' + end + doc + end + end + end +end diff --git a/lib/docs/scrapers/gnu/gcc.rb b/lib/docs/scrapers/gnu/gcc.rb index 565706d9..2aa9da39 100644 --- a/lib/docs/scrapers/gnu/gcc.rb +++ b/lib/docs/scrapers/gnu/gcc.rb @@ -6,7 +6,7 @@ module Docs home: 'https://gcc.gnu.org/' } - html_filters.push 'title' + html_filters.push 'gcc/clean_html', 'title' options[:root_title] = false options[:title] = false