[devdocsgjs/main: 862/1867] gcc: enable syntax highlighting




commit 651f20a8f9fea9685195263ab896b66c7510ebfd
Author: Simon Legner <Simon Legner gmail com>
Date:   Wed Aug 21 15:52:18 2019 +0200

    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(-)
---
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]