[devdocsgjs/main: 617/1867] Add Mkdocs abstract scraper
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 617/1867] Add Mkdocs abstract scraper
- Date: Fri, 19 Nov 2021 23:47:18 +0000 (UTC)
commit b45090f369bc8fa7681237eca0def4c730f5f5a2
Author: Emil Maruszczak <emilekm gmail com>
Date: Mon Apr 29 00:57:50 2019 +0200
Add Mkdocs abstract scraper
assets/stylesheets/application.css.scss | 1 +
assets/stylesheets/pages/_mkdocs.scss | 15 +++++++++++++++
lib/docs/filters/mkdocs/clean_html.rb | 18 ++++++++++++++++++
lib/docs/scrapers/mkdocs.rb | 5 +++++
4 files changed, 39 insertions(+)
---
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 2a64e5c9..d2005cb2 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -71,6 +71,7 @@
'pages/lua',
'pages/mdn',
'pages/meteor',
+ 'pages/mkdocs',
'pages/modernizr',
'pages/moment',
'pages/nginx',
diff --git a/assets/stylesheets/pages/_mkdocs.scss b/assets/stylesheets/pages/_mkdocs.scss
new file mode 100644
index 00000000..e70ff66c
--- /dev/null
+++ b/assets/stylesheets/pages/_mkdocs.scss
@@ -0,0 +1,15 @@
+%mkdocs {
+ h2 { @extend %block-heading; }
+ h3 { @extend %block-label, %label-blue; }
+ h4 { @extend %block-label; }
+
+ blockquote { @extend %note; }
+
+ strong { font-weight: var(--bolderFontWeight); }
+
+ p > code, li > code { @extend %label; }
+}
+
+._mkdocs {
+ @extend %mkdocs;
+}
diff --git a/lib/docs/filters/mkdocs/clean_html.rb b/lib/docs/filters/mkdocs/clean_html.rb
new file mode 100644
index 00000000..c346d23e
--- /dev/null
+++ b/lib/docs/filters/mkdocs/clean_html.rb
@@ -0,0 +1,18 @@
+module Docs
+ class Mkdocs
+ class CleanHtmlFilter < Docs::Filter
+ def call
+ css('.toclink').each do |node|
+ node.parent.content = node.content
+ node.remove
+ end
+
+ css('pre').each do |node|
+ node.content = node.at_css('code').content
+ end
+
+ at_css('#main-content')
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/mkdocs.rb b/lib/docs/scrapers/mkdocs.rb
new file mode 100644
index 00000000..c0f5d5e5
--- /dev/null
+++ b/lib/docs/scrapers/mkdocs.rb
@@ -0,0 +1,5 @@
+module Docs
+ class Mkdocs < Scraper
+ self.abstract = true
+ end
+end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]