From 848f7194a04013d37cfb426217a27b7a663ae694 Mon Sep 17 00:00:00 2001 From: Enoc Date: Sun, 26 Dec 2021 16:06:07 -0600 Subject: [PATCH] Add Gnu Make documentation --- assets/javascripts/news.json | 4 + .../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(+) create mode 100644 assets/stylesheets/pages/_gnu_make.scss create mode 100644 lib/docs/filters/gnu_make/clean_html.rb create mode 100644 lib/docs/filters/gnu_make/entries.rb create mode 100644 lib/docs/scrapers/gnu_make.rb create mode 100644 public/icons/docs/gnu_make/16.png create mode 100644 public/icons/docs/gnu_make/16@2x.png create mode 100644 public/icons/docs/gnu_make/SOURCE 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: Gnu Make" + ], [ "2021-12-07", "New documentation: Prettier", 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.
+ 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 0000000000000000000000000000000000000000..a94aef6ea296ae8cba1c97f6ad30a7a12ce791cb GIT binary patch literal 626 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6SkfJR9T^xl_H+M9WCijSl0AZa z85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP=YDR+ueoXe|!I#{Xiaj ziKnkC`%@kD$R!R=%Gz53Om2eQ`Iu9P>r;e6a=R z@v|pqUE8>HLCXo&(|Ru})aB3YPCv6OH@CLEtfu1lr4?#Ii0a*k;8x zYuTL30+AbD^oaFvEuI^&ebLfqU0eFKlx6i7A%DkuC;zT!2rE&110{qExW z&wV5*HuZJbms~5UhxVDbYBs9mFj@k`T(!hCq9i4;B-JXpC>2OC7#SED>KYp98X1Kc zm|B^dSQ#2=8yHv_7^KIl>_yR#o1c=IR*9~`(8|;hqQSM>SqZ2?5@bVgep*R+Vo@qX jd3m{BW?pu2a$-TMUVc&f>~}U&Kt&9mu6{1-oD!M004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00002 zVoOIv0RM-N%)bBt00(qQO+^Rg3>F3kBvcFfHUIzw4oO5oR5;6x)LU%SWgf=y&wu_i z!}K6+8IEo30tJc+7L%@7JYdU;AqtpyN=Ve0n3!nd#a`@{*-i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