mirror of https://github.com/freeCodeCamp/devdocs
parent
9a7806ff70
commit
848f7194a0
@ -0,0 +1,5 @@
|
||||
._make {
|
||||
dl dt {
|
||||
@extend %block-label, %label-blue;
|
||||
}
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
After Width: | Height: | Size: 626 B |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1 @@
|
||||
https://www.gnu.org/graphics/heckert_gnu.png
|
Loading…
Reference in new issue