[devdocsgjs/main: 76/239] Add Gnu Make documentation
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 76/239] Add Gnu Make documentation
- Date: Fri, 8 Apr 2022 07:47:35 +0000 (UTC)
commit 848f7194a04013d37cfb426217a27b7a663ae694
Author: Enoc <brianhernandez222 hotmail com>
Date: Sun Dec 26 16:06:07 2021 -0600
Add Gnu Make documentation
assets/javascripts/news.json | 4 +
.../javascripts/templates/pages/about_tmpl.coffee | 5 ++
assets/stylesheets/application.css.scss | 1 +
assets/stylesheets/pages/_gnu_make.scss | 5 ++
docs/file-scrapers.md | 9 ++
lib/docs/filters/gnu_make/clean_html.rb | 54 ++++++++++++
lib/docs/filters/gnu_make/entries.rb | 97 +++++++++++++++++++++
lib/docs/scrapers/gnu_make.rb | 34 ++++++++
public/icons/docs/gnu_make/16.png | Bin 0 -> 626 bytes
public/icons/docs/gnu_make/16 2x png | Bin 0 -> 1323 bytes
public/icons/docs/gnu_make/SOURCE | 1 +
11 files changed, 210 insertions(+)
---
diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json
index c935a4ee..d6d1b7f1 100644
--- a/assets/javascripts/news.json
+++ b/assets/javascripts/news.json
@@ -1,4 +1,8 @@
[
+ [
+ "2021-12-26",
+ "New documentation: <a href=\"/gnu_make/\">Gnu Make</a>"
+ ],
[
"2021-12-07",
"New documentation: <a href=\"/prettier/\">Prettier</a>",
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee
b/assets/javascripts/templates/pages/about_tmpl.coffee
index 856dd9a6..f5da0aab 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -337,6 +337,11 @@ credits = [
'GFDL',
'https://www.gnu.org/licenses/fdl-1.3.en.html'
], [
+ 'Gnu Make',
+ 'Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Free
Software Foundation, Inc.',
+ 'GFDL',
+ 'https://www.gnu.org/software/make/manual/html_node/GNU-Free-Documentation-License.html'
+ ] ,[
'Gnuplot',
'Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley',
'gnuplot license',
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 0243afeb..93c74b5d 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -76,6 +76,7 @@
'pages/liquid',
'pages/love',
'pages/lua',
+ 'pages/gnu_make',
'pages/mariadb',
'pages/mdn',
'pages/meteor',
diff --git a/assets/stylesheets/pages/_gnu_make.scss b/assets/stylesheets/pages/_gnu_make.scss
new file mode 100644
index 00000000..7e8e102c
--- /dev/null
+++ b/assets/stylesheets/pages/_gnu_make.scss
@@ -0,0 +1,5 @@
+._make {
+ dl dt {
+ @extend %block-label, %label-blue;
+ }
+}
diff --git a/docs/file-scrapers.md b/docs/file-scrapers.md
index 4ea46188..51c30d55 100644
--- a/docs/file-scrapers.md
+++ b/docs/file-scrapers.md
@@ -92,6 +92,15 @@ curl https://gcc.gnu.org/onlinedocs/gcc-$RELEASE/gfortran-html.tar.gz | \
tar --extract --gzip --strip-components=1 --directory=docs/gnu_fortran~$VERSION
```
+## GNU Make
+Go to https://www.gnu.org/software/make/manual/, download the HTML tarball and extract its content in
`/path/to/devdocs/docs/gnu_make` or run the following command:
+
+```sh
+mkdir /path/to/devdocs/docs/gnu_make \
+&& curl https://www.gnu.org/software/make/manual/make.html_node.tar.gz | \
+tar --extract --gzip --strip-components=1 --directory=/path/to/devdocs/docs/gnu_make
+```
+
## Gnuplot
The most recent release can be found near the bottom of
diff --git a/lib/docs/filters/gnu_make/clean_html.rb b/lib/docs/filters/gnu_make/clean_html.rb
new file mode 100644
index 00000000..e8b8b6ab
--- /dev/null
+++ b/lib/docs/filters/gnu_make/clean_html.rb
@@ -0,0 +1,54 @@
+module Docs
+ class GnuMake
+ class CleanHtmlFilter < Filter
+ def call
+
+ if current_url == root_url
+ # Remove short table contents
+ css('.shortcontents').remove
+ css('.shortcontents-heading').remove
+ css('.contents-heading').remove
+ css('.contents').remove
+ css('.settitle').remove
+
+ # remove copyright
+ css('blockquote').remove
+ end
+
+ css('hr').remove
+
+ css('.header').remove
+
+ # Remove undesirable in headers
+ css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').each do |node|
+
+ node.content = node.content.slice(/[[:alpha:]]...*/)
+
+ node.content = node.content.sub(/Appendix.{2}/, '') if node.content.include?('Appendix')
+
+ if node.content.match?(/[[:upper:]]\./)
+ node.content = node.content.sub(/[[:upper:]]\./, '')
+ node.content = node.content.gsub(/\./, '')
+ node.content = node.content.gsub(/[[:digit:]]/, '')
+ end
+
+ node.name = "h1"
+ end
+
+ css('dt code').each do |node|
+ node.parent['id'] = node.content
+ end
+
+ css('dt > samp').each do |node|
+ node.parent['id'] = node.content
+ end
+
+ css('br').remove
+
+ css('.footnote').remove
+
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/gnu_make/entries.rb b/lib/docs/filters/gnu_make/entries.rb
new file mode 100644
index 00000000..e9eb1bf8
--- /dev/null
+++ b/lib/docs/filters/gnu_make/entries.rb
@@ -0,0 +1,97 @@
+module Docs
+ class GnuMake
+ class EntriesFilter < Docs::EntriesFilter
+
+ NO_ADDITIONAL_ENTRIES = [
+ 'Quick Reference', 'Instead of Executing Recipes',
+ 'Loaded Object Interface', 'Conversion of Guile Types',
+ 'Arguments to Specify the Goals', 'Standard Targets for Users',
+ 'Variables for Installation Directories', 'Errors Generated by Make',
+ 'The origin Function', 'The vpath Directive',
+ 'Interfaces from Guile to make', 'Output During Parallel Execution',
+ 'How to Run make', 'The flavor Function', 'Catalogue of Built-In Rules'
+ ]
+
+ DL_DT_TABLE = {
+ 'Automatic Variables' => 'Automatic Variables',
+ 'Other Special Variables' => 'Automatic Variables',
+ 'Variables Used by Implicit Rules' => 'Automatic Variables',
+ 'Special Built-in Target Names' => 'Built-in targets',
+ 'Functions for File Names' => 'File Names Functions',
+ 'Functions for String Substitution and Analysis' => 'String Substitution and Analysis Functions',
+ 'Functions for Conditionals' => 'Conditionals Functions',
+ 'Functions That Control Make' => 'Make Control Functions',
+ 'Syntax of Conditionals' => 'Conditionals Syntax'
+ }
+
+ def get_name
+ name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix')
+
+ if name.nil?
+ name = at_css('h1, h2, h3').content.slice(/[[:alpha:]]...*/)
+ else
+ name = name.content.slice(/[[:alpha:]]...*/)
+ end
+
+ name.gsub!(/Appendix.{2}/, '') if name.include?('Appendix')
+ # remove withespace at the beginning left when "Appendix" is removed
+ name.gsub!(/\G\s/, '')
+
+ name
+ end
+
+ def get_type
+ return 'Transforming text functions' if name =~ /The [a-z]+ Function/
+ return 'Directives' if name =~ /The [a-z]+ Directive/
+ 'Manual'
+ end
+
+ def additional_entries
+ entries = []
+
+ return entries if NO_ADDITIONAL_ENTRIES.include?(name)
+
+ css('dl dt').each do |node|
+
+ break if name == 'Summary of Options'
+
+ entry_type = ""
+
+ if DL_DT_TABLE.key?(name)
+ entry_type = DL_DT_TABLE[name]
+ else
+ entry_type = "Entry type missing"
+ end
+
+ entry_name = node.at_css('code')
+
+ if entry_name.nil?
+ next
+ end
+
+ entry_name = entry_name.content
+ entry_path = slug.downcase + '#' + entry_name
+
+ entries << [entry_name, entry_path, entry_type]
+ end
+
+ css('dt > samp').each do |node|
+
+ break if name == 'Other Special Variables'
+
+ entry_type = 'Automatic Variables' if name == 'Automatic Variables'
+ entry_type = 'Functions for File Names' if name == 'Functions for File Names'
+ entry_type = 'Make Cli Options' if name == 'Summary of Options'
+
+ entry_name = node.content
+ entry_path = slug.downcase + '#' + entry_name
+
+ entries << [entry_name, entry_path, entry_type]
+ end
+
+ entries
+ end
+
+ end
+ end
+end
diff --git a/lib/docs/scrapers/gnu_make.rb b/lib/docs/scrapers/gnu_make.rb
new file mode 100644
index 00000000..2b7ddeb4
--- /dev/null
+++ b/lib/docs/scrapers/gnu_make.rb
@@ -0,0 +1,34 @@
+# coding: utf-8
+module Docs
+ class GnuMake < FileScraper
+ self.name = 'Gnu make'
+ self.type = 'gnu_make'
+ self.slug = 'gnu_make'
+ self.release = '4.3'
+ self.base_url= 'https://www.gnu.org/software/make/manual/html_node/'
+ self.root_path = 'index.html'
+ self.links = {
+ home:'https://www.gnu.org/software/make/manual/html_node/',
+ code: 'http://git.savannah.gnu.org/cgit/make.git/'
+ }
+
+ html_filters.push 'gnu_make/entries', 'gnu_make/clean_html'
+
+ options[:skip] = [
+ 'Concept-Index.html',
+ 'Name-Index.html',
+ 'GNU-Free-Documentation-License.html'
+ ]
+
+ options[:attribution]= <<-HTML
+ Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Free
Software Foundation, Inc. <br>
+ Licensed under the GNU Free Documentation License.
+ HTML
+
+ def get_latest_version(opts)
+ body = fetch(self.base_url, opts)
+ body.scan(/version \d*\.?\d*/)[0].sub('version', '')
+ end
+
+ end
+end
diff --git a/public/icons/docs/gnu_make/16.png b/public/icons/docs/gnu_make/16.png
new file mode 100644
index 00000000..a94aef6e
Binary files /dev/null and b/public/icons/docs/gnu_make/16.png differ
diff --git a/public/icons/docs/gnu_make/16 2x png b/public/icons/docs/gnu_make/16 2x png
new file mode 100644
index 00000000..6df3c03d
Binary files /dev/null and b/public/icons/docs/gnu_make/16 2x png differ
diff --git a/public/icons/docs/gnu_make/SOURCE b/public/icons/docs/gnu_make/SOURCE
new file mode 100644
index 00000000..db0f6512
--- /dev/null
+++ b/public/icons/docs/gnu_make/SOURCE
@@ -0,0 +1 @@
+https://www.gnu.org/graphics/heckert_gnu.png
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]