diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 0165ade2..60c74210 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -311,6 +311,11 @@ credits = [ 'Free Software Foundation', 'GFDL', 'https://www.gnu.org/licenses/fdl-1.3.en.html' + ], [ + 'Gnuplot', + 'Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley', + 'gnuplot license', + 'https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright' ], [ 'Go', 'Google, Inc.', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 0072d511..1b1c3ad0 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -60,6 +60,7 @@ 'pages/github', 'pages/go', 'pages/graphite', + 'pages/gnuplot', 'pages/haskell', 'pages/jekyll', 'pages/jquery', diff --git a/assets/stylesheets/pages/_gnuplot.scss b/assets/stylesheets/pages/_gnuplot.scss new file mode 100644 index 00000000..b7d584e7 --- /dev/null +++ b/assets/stylesheets/pages/_gnuplot.scss @@ -0,0 +1,6 @@ +._gnuplot { + .CENTER { + text-align: center; + } + @extend %simple; +} diff --git a/lib/docs/filters/gnuplot/clean_html.rb b/lib/docs/filters/gnuplot/clean_html.rb new file mode 100644 index 00000000..e612982b --- /dev/null +++ b/lib/docs/filters/gnuplot/clean_html.rb @@ -0,0 +1,61 @@ +module Docs + class Gnuplot + class CleanHtmlFilter < Filter + def call + # remove some anchors nested inside headers: ... + css('h1, h2, h3, h4, h5').each do |heading| + anchor = heading.css('a')[0] + heading['id'] = anchor['id'] || anchor['name'] + heading.content = anchor.content.strip + end + + # make the title on the front page which is in some weird tags + if root_page? + title = css('.HUGE')[0] + title.name = 'h1' + + subtitle = css('.XLARGE')[0] + title.content = title.content + ' − ' + subtitle.content + + css('> *:first-child')[0].before(title) + subtitle.remove + + css('p:contains("TableOfContents")').remove + end + + # remove nav, empty items, and any useless horizontal rules as well + # as the subsection table of contents (.ChildLinks) + css('.navigation').remove + css('#CHILD_LINKS, ul.ChildLinks').remove + css('hr').remove + # Anchors that use only names are some numerical IDs that latex2html distributes through the document + css('a[name]:not([href]):not([id])').remove + + # spacing + css('> div, p').each do |node| + node.remove if node.content.strip.empty? + end + + # links generated are of the form (NB: some might have been removed): + # {text} (p. [*]) + # transform to nil, 'Linetypes, colors, and styles' => nil, 'Fit' => nil, 'Format' => nil, + 'Plot' => nil, 'Splot' => nil, 'Style' => 'Plot appearance', + 'Set-show' => 'Set / Show', 'Datafile' => nil, 'Key' => 'Legend'} + NOREPEAT = ['String constants, string variables, and string functions', 'Substitution and Command line macros'] + + class EntriesFilter < Docs::EntriesFilter + def initialize(*) + super + end + + def get_name + return 'Stats' if slug.downcase == 'stats_statistical_summary' + return css('h1')[0].content.strip + end + + def get_type + return (PROMOTE[name] || name) if PROMOTE.include? name + + parent = at_css('.navigation > b:contains("Up:")').next_element.content + return 'Using Gnuplot' if parent == 'Gnuplot' + return parent + end + + def include_default_entry? + !root_page? and slug.downcase != 'complete_list_terminals' #and !PROMOTE.include? name + end + + def additional_entries + return [] if root_page? + entries = [] + + if slug.downcase == 'complete_list_terminals' + list_stack = [[css('ul.ChildLinks'), '', nil]] + else + list_stack = [[css('ul.ChildLinks'), name, nil]] + end + + while !list_stack.empty? + list, name_, type_ = list_stack.pop + list.css('> li').each do |item| + + sublists = item.css('> ul') + link = item.css('> a, span') + + if link.empty? + item_name = name_ + else + item_name = link[0].text.strip + item_name = "#{name_} #{item_name}".strip unless PROMOTE.include? name_ or NOREPEAT.include? name_ + item_name = item_name.sub /^(\w+) \1/, '\1' + item_name = 'set style boxplot' if slug.downcase == 'set_show' and item_name == 'Boxplot' + + if PROMOTE.include? name_ + type_ = PROMOTE[name_] || name_ + end + + entries << [item_name, link[0]['href'].split('#')[1], type_] + end + + list_stack.push([sublists, item_name, type_]) unless sublists.empty? + end + end + + return entries + end + + private + + end + end +end diff --git a/lib/docs/scrapers/gnuplot.rb b/lib/docs/scrapers/gnuplot.rb new file mode 100644 index 00000000..dc55edb7 --- /dev/null +++ b/lib/docs/scrapers/gnuplot.rb @@ -0,0 +1,41 @@ +module Docs + class Gnuplot < FileScraper + self.name = 'Gnuplot' + self.slug = 'gnuplot' + self.type = 'gnuplot' + self.links = { + home: 'http://gnuplot.sourceforge.net/' + } + + self.root_path = 'index.html' + + html_filters.push 'gnuplot/entries', 'gnuplot/clean_html' + + options[:skip_links] = false + + options[:skip] = %w( + Copyright.html + External_libraries.html + Known_limitations.html + Introduction.html + About_this_document.html + New_features.html + Differences_from_version_4.html + Seeking_assistance.html + Gnuplot.html + Deprecated_syntax.html + Demos_Online_Examples.html + Terminal_types.html + Plotting_styles.html + Commands.html + Contents.html + Bugs.html + ) + + options[:attribution] = <<-HTML + Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
+ Distributed under the
gnuplot license (rights to distribute modified versions are withheld). + HTML + + end +end diff --git a/public/icons/docs/gnuplot/16.png b/public/icons/docs/gnuplot/16.png new file mode 100644 index 00000000..3db00280 Binary files /dev/null and b/public/icons/docs/gnuplot/16.png differ diff --git a/public/icons/docs/gnuplot/16@2x.png b/public/icons/docs/gnuplot/16@2x.png new file mode 100644 index 00000000..5985b7aa Binary files /dev/null and b/public/icons/docs/gnuplot/16@2x.png differ diff --git a/public/icons/docs/gnuplot/SOURCE b/public/icons/docs/gnuplot/SOURCE new file mode 100644 index 00000000..8acb1e8c --- /dev/null +++ b/public/icons/docs/gnuplot/SOURCE @@ -0,0 +1 @@ +https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/demo/html/favicon.ico