From d470f306e08c22bfa388d959eaecc487dff4e081 Mon Sep 17 00:00:00 2001 From: MasterEnoc Date: Tue, 8 Sep 2020 20:50:04 -0600 Subject: [PATCH 1/4] Add Elisp documentation for 26.3 release - Add elisp.rb, clean_html.rb and entries.rb --- lib/docs/filters/elisp/clean_html.rb | 56 ++++++++++++++++++++++++ lib/docs/filters/elisp/entries.rb | 50 +++++++++++++++++++++ lib/docs/scrapers/elisp.rb | 65 ++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 lib/docs/filters/elisp/clean_html.rb create mode 100644 lib/docs/filters/elisp/entries.rb create mode 100644 lib/docs/scrapers/elisp.rb diff --git a/lib/docs/filters/elisp/clean_html.rb b/lib/docs/filters/elisp/clean_html.rb new file mode 100644 index 00000000..985191b2 --- /dev/null +++ b/lib/docs/filters/elisp/clean_html.rb @@ -0,0 +1,56 @@ +module Docs + class Elisp + class CleanHtmlFilter < Filter + def call + + if current_url == root_url + # remove copyright header + css('table ~ p').remove + + # remove "Detailed Node Listing" header + css('h3').remove + + # remove "Detailed Node Listing" table + css('table')[1].remove + + # remove copyright + css('blockquote').remove + + # remove index page in the index table + css('tbody tr:last-child').remove + end + + # remove navigation bar + css('.node').remove + + # Remove content in headers + css('h2', 'h3', 'h4', 'h5', 'h6').each do |node| + + # remove numbers at the beginning of all headers + node.content = node.content.slice(/[[:alpha:]]...*/) + + # remove 'Appendix' word + node.content = node.content.sub(/Appendix.{2}/, '') if node.content.include?('Appendix') + + # remove 'E.' notation for appendixes + if node.content.match?(/[[:upper:]]\./) + # remove 'E.' + node.content = node.content.sub(/[[:upper:]]\./, '') + # remove all dots (.) + node.content = node.content.gsub(/\./, '') + # remove all numbers + node.content = node.content.gsub(/[[:digit:]]/, '') + end + + end + + # add id to each defun section that contains a functions, macro, etc. + css('.defun').each do |node| + node['id']= node.first_element_child.content + end + + doc + end + end + end +end diff --git a/lib/docs/filters/elisp/entries.rb b/lib/docs/filters/elisp/entries.rb new file mode 100644 index 00000000..4961e36d --- /dev/null +++ b/lib/docs/filters/elisp/entries.rb @@ -0,0 +1,50 @@ +module Docs + class Elisp + class EntriesFilter < Docs::EntriesFilter + def get_name + # remove numbers at the beginnig + name = at_css('h2', 'h3', 'h4', 'h5', 'h6').content.slice(/[[:alpha:]]...*/) + + # remove 'Appendix' word + name = name.sub(/Appendix.{2}/, '') if name.include?('Appendix') + + # remove 'E.' notation for appendixes + if name.match?(/[[:upper:]]\./) + # remove 'E.' + name = name.sub(/[[:upper:]]\./, '') + # remove all dots (.) + name = name.gsub(/\./, '') + # remove all numbers + name = name.gsub(/[[:digit:]]/, '') + end + + name + end + + def get_type + 'Manual' + end + + def additional_entries + entries = [] + + css('.defun').each do |node| + entry_type = 'Builtin Functions' if node.content.include?('Function') + entry_type = 'Builtin Macros' if node.content.include?('Macro') + entry_type = 'Builtin Variables' if node.content.include?('Variable') + entry_type = 'Builtin User Options' if node.content.include?('User Option') + entry_type = 'Builtin Special Forms' if node.content.include?('Special Form') + entry_type = 'Builtin Commands' if node.content.include?('Command') + entry_type = 'Builtin Constants' if node.content.include?('Constant') + + entry_name = node.first_element_child.content + entry_path = slug + '#' + entry_name + entries << [entry_name, entry_path.downcase, entry_type] + end + + entries + end + + end + end +end diff --git a/lib/docs/scrapers/elisp.rb b/lib/docs/scrapers/elisp.rb new file mode 100644 index 00000000..0a103bdc --- /dev/null +++ b/lib/docs/scrapers/elisp.rb @@ -0,0 +1,65 @@ +module Docs + class Elisp < UrlScraper + self.type = 'elisp' + self.release = '26.3' + self.base_url= 'https://www.gnu.org/software/emacs/manual/html_node/elisp/' + self.root_path = 'index.html' + self.links = { + home:'https://www.gnu.org/software/emacs/manual/elisp', + code: 'https://git.savannah.gnu.org/cgit/emacs.git' + } + + html_filters.push 'elisp/entries', 'elisp/clean_html' + + # some file that were not skipped by skip patterns + options[:skip] = [ + 'Coding-Conventions.html', + 'Key-Binding-Conventions.html', + 'Library-Headers.html' + ] + + # some non essential sections + options[:skip_patterns] = [ + /Introduction.html/, + /Antinews.html/, + /GNU-Free-Documentation-License.html/, + /GPL.html/, + /Tips.html/, + /Definition-of-/ + ] + + # fix duplicates + options[:fix_urls]= -> (url) do + url.sub!('Window-Group.html', 'Basic-Windows.html') + url.sub!('Local-defvar-example.html', 'Using-Lexical-Binding.html') + url.sub!('Defining-Lisp-variables-in-C.html', 'Writing-Emacs-Primitives.html') + url.sub!('describe_002dsymbols-example.html', 'Accessing-Documentation.html') + url.sub!('The-interactive_002donly-property.html', 'Defining-Commands.html') + url.sub!('Text-help_002decho.html', 'Special-Properties.html') + url.sub!('Help-display.html', 'Special-Properties.html') + url.sub!('autoload-cookie.html', 'Autoload.html') + url.sub!('external_002ddebugging_002doutput.html', 'Output-Streams.html') + url.sub!('modifier-bits.html', 'Other-Char-Bits.html') + url.sub!('message_002dbox.html', 'Displaying-Messages.html') + url.sub!('abbreviate_002dfile_002dname.html', 'Directory-Names.html') + url.sub!('Inhibit-point-motion-hooks.html', 'Special-Properties.html') + url.sub!('Coding-systems-for-a-subprocess.html', 'Process-Information.html') + url.sub!('Process-Filter-Example.html', 'Filter-Functions.html') + url.sub!('Docstring-hyperlinks.html', 'Documentation-Tips.html') + url.sub!('seq_002dlet.html', 'Sequence-Functions.html') + url.sub!('should_005fquit.html', 'Module-Misc.html') + url.sub!('Display-Face-Attribute-Testing.html', 'Display-Feature-Testing.html') + url.sub!('module-initialization-function.html', 'Module-Initialization.html') + url.sub!('pcase_002dsymbol_002dcaveats.html', 'pcase-Macro.html') + url.sub!('intern.html', 'Module-Misc.html') + url.sub!('pcase_002dexample_002d1.html', 'pcase-Macro.html') + url + end + + options[:attribution]= <<-HTML + Copyright © 1990-1996, 1998-2019 Free Software Foundation, Inc.
+ Licensed under the GNU GPL license. + HTML + + end +end From f43b1f7b2d1195a4f6e979fc380e28a31005c846 Mon Sep 17 00:00:00 2001 From: MasterEnoc Date: Wed, 9 Sep 2020 00:08:16 -0600 Subject: [PATCH 2/4] Add styles for elisp docs and improve some html cleanups - Add elisp (emacs) images. - Add elisp in about_tmpl.coffee file - Add get_latest_version method to elisp.rb - Add some cleanups to the html doc for style purposes - Add _elisp stylesheet --- .../templates/pages/about_tmpl.coffee | 5 +++++ assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_elisp.scss | 9 +++++++++ lib/docs/filters/elisp/clean_html.rb | 13 +++++++++++++ lib/docs/scrapers/elisp.rb | 5 +++++ public/icons/docs/elisp/16.png | Bin 0 -> 1426 bytes public/icons/docs/elisp/16@2x.png | Bin 0 -> 2905 bytes public/icons/docs/elisp/SOURCE | 1 + 8 files changed, 34 insertions(+) create mode 100644 assets/stylesheets/pages/_elisp.scss create mode 100644 public/icons/docs/elisp/16.png create mode 100644 public/icons/docs/elisp/16@2x.png create mode 100644 public/icons/docs/elisp/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8ac93ed4..fcb4ca50 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -261,6 +261,11 @@ credits = [ '2012 Plataformatec', 'Apache', 'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE' + ], [ + 'Elisp', + '1990-1996, 1998-2019 Free Software Foundation, Inc.', + 'GPLv3', + 'https://www.gnu.org/licenses/gpl-3.0.html' ], [ 'Ember.js', '2017 Yehuda Katz, Tom Dale and Ember.js contributors', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 1b1c3ad0..04c9ddb3 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -53,6 +53,7 @@ 'pages/dojo', 'pages/drupal', 'pages/elixir', + 'pages/elisp', 'pages/ember', 'pages/erlang', 'pages/express', diff --git a/assets/stylesheets/pages/_elisp.scss b/assets/stylesheets/pages/_elisp.scss new file mode 100644 index 00000000..3b366005 --- /dev/null +++ b/assets/stylesheets/pages/_elisp.scss @@ -0,0 +1,9 @@ +._elisp { + div > b { + @extend %block-label, %label-blue; + } + + div > b { + margin: 2% auto; + } +} diff --git a/lib/docs/filters/elisp/clean_html.rb b/lib/docs/filters/elisp/clean_html.rb index 985191b2..7b4db744 100644 --- a/lib/docs/filters/elisp/clean_html.rb +++ b/lib/docs/filters/elisp/clean_html.rb @@ -47,8 +47,21 @@ module Docs # add id to each defun section that contains a functions, macro, etc. css('.defun').each do |node| node['id']= node.first_element_child.content + + # change all tags to , this helps pages style + functionName = node.first_element_child + arguments = functionName.next_sibling + arguments.parent= functionName + end + + # remove br for style purposes + css('br').each do |node| + node.remove end + # remove footnotes + css('.footnote').remove + doc end end diff --git a/lib/docs/scrapers/elisp.rb b/lib/docs/scrapers/elisp.rb index 0a103bdc..264ba6f5 100644 --- a/lib/docs/scrapers/elisp.rb +++ b/lib/docs/scrapers/elisp.rb @@ -61,5 +61,10 @@ module Docs Licensed under the GNU GPL license. HTML + def get_latest_version(opts) + body = fetch('https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html', opts) + body.scan(/version \d*\.?\d*/)[0].sub('version', '') + end + end end diff --git a/public/icons/docs/elisp/16.png b/public/icons/docs/elisp/16.png new file mode 100644 index 0000000000000000000000000000000000000000..dc2d8ca88b91ec45fc9810f04adc505d972b509d GIT binary patch literal 1426 zcmZ`(dpOg382=I#CDl2duDZx2H2p}_5N2aC_r)@|VRI=q+qA}Rw$*BKO>>Lts3;Mc zxy+r8Zc++GggS+TJm;xSk7~}(`R_dEIp62|e&6@=KJVpwdEf6jZ%03A0h z+85?)muTfOc-@20^@Ev4l#_=O0M!|*zLPXzyfXsp>j6NL5dZ=)01L26FbO~+1i*9{ z0LVN5HqtIN`q%-WuJp#?F|dK3UNU+k1=2pUxVWgl@}Pw-P8Ky_tYaT)o#ti2BtQbJ zJ_WJP^#x&Z+uD7`Iu09j4Ap_AyMDaQHoUDa0dK|)vrmu2T#P{H1S6$hdrn&F;NY;Z zKH9x7kzB=LDA}-a$m2JX6t2`wCz%_Azf1i2s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d2!Zz)ALq-(|iNm&Au z-PS4G?Irn8a<@)H^9_Y2@Y?U7+LscV9}W6OOEM}uC!0BBTBTp`Q+CapwCk1wb5Jb( zThxPrQSTpw=WylToAo_x&fEF3Li4sRykc+EhDcYsUB)XMso@mn@;PYixo727BAkO+ zTph*a3binna5Ia5+Nh7ZV*I>5D5HkQb4#5{&h%o==_{OjaAvC(l@}kRc!<7j$OGpP zS9Nrd>jeSwNO`0TQthHqNCkDIqPn8WWh7D^i9GUPl>486um1y2xA6ZTc%sypb`jwF ud%@D*Ed=8n Date: Wed, 9 Sep 2020 00:08:16 -0600 Subject: [PATCH 3/4] Add Elisp language docs for version 26.3 --- .../templates/pages/about_tmpl.coffee | 5 +++++ assets/stylesheets/application.css.scss | 1 + assets/stylesheets/pages/_elisp.scss | 9 +++++++++ lib/docs/filters/elisp/clean_html.rb | 13 +++++++++++++ lib/docs/scrapers/elisp.rb | 5 +++++ public/icons/docs/elisp/16.png | Bin 0 -> 1426 bytes public/icons/docs/elisp/16@2x.png | Bin 0 -> 2905 bytes public/icons/docs/elisp/SOURCE | 1 + 8 files changed, 34 insertions(+) create mode 100644 assets/stylesheets/pages/_elisp.scss create mode 100644 public/icons/docs/elisp/16.png create mode 100644 public/icons/docs/elisp/16@2x.png create mode 100644 public/icons/docs/elisp/SOURCE diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 8ac93ed4..fcb4ca50 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -261,6 +261,11 @@ credits = [ '2012 Plataformatec', 'Apache', 'https://raw.githubusercontent.com/elixir-lang/elixir/master/LICENSE' + ], [ + 'Elisp', + '1990-1996, 1998-2019 Free Software Foundation, Inc.', + 'GPLv3', + 'https://www.gnu.org/licenses/gpl-3.0.html' ], [ 'Ember.js', '2017 Yehuda Katz, Tom Dale and Ember.js contributors', diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index 1b1c3ad0..04c9ddb3 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -53,6 +53,7 @@ 'pages/dojo', 'pages/drupal', 'pages/elixir', + 'pages/elisp', 'pages/ember', 'pages/erlang', 'pages/express', diff --git a/assets/stylesheets/pages/_elisp.scss b/assets/stylesheets/pages/_elisp.scss new file mode 100644 index 00000000..3b366005 --- /dev/null +++ b/assets/stylesheets/pages/_elisp.scss @@ -0,0 +1,9 @@ +._elisp { + div > b { + @extend %block-label, %label-blue; + } + + div > b { + margin: 2% auto; + } +} diff --git a/lib/docs/filters/elisp/clean_html.rb b/lib/docs/filters/elisp/clean_html.rb index 985191b2..7b4db744 100644 --- a/lib/docs/filters/elisp/clean_html.rb +++ b/lib/docs/filters/elisp/clean_html.rb @@ -47,8 +47,21 @@ module Docs # add id to each defun section that contains a functions, macro, etc. css('.defun').each do |node| node['id']= node.first_element_child.content + + # change all tags to , this helps pages style + functionName = node.first_element_child + arguments = functionName.next_sibling + arguments.parent= functionName + end + + # remove br for style purposes + css('br').each do |node| + node.remove end + # remove footnotes + css('.footnote').remove + doc end end diff --git a/lib/docs/scrapers/elisp.rb b/lib/docs/scrapers/elisp.rb index 0a103bdc..264ba6f5 100644 --- a/lib/docs/scrapers/elisp.rb +++ b/lib/docs/scrapers/elisp.rb @@ -61,5 +61,10 @@ module Docs Licensed under the GNU GPL license. HTML + def get_latest_version(opts) + body = fetch('https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html', opts) + body.scan(/version \d*\.?\d*/)[0].sub('version', '') + end + end end diff --git a/public/icons/docs/elisp/16.png b/public/icons/docs/elisp/16.png new file mode 100644 index 0000000000000000000000000000000000000000..dc2d8ca88b91ec45fc9810f04adc505d972b509d GIT binary patch literal 1426 zcmZ`(dpOg382=I#CDl2duDZx2H2p}_5N2aC_r)@|VRI=q+qA}Rw$*BKO>>Lts3;Mc zxy+r8Zc++GggS+TJm;xSk7~}(`R_dE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eW+u9agB>tO-V6kG#&h;i6M)zI1Xk=Xi z&H;_>3P4<2d-23zGTEQ@e#YHfR8(=DCfk9qm9Rs0*1Ub+5<*7wdDVDEam2Tup_|&- zN4i3TLNQ#&62&FHEc+XwzL8j(jf`ap=`kO3KN%g*PJ@`S>kFxAQ>ip>zsDCEMhqAhAzX#p{1T3A>(PZ>RmNWt#RH+`OSXK#+LQo0&U@A@o!{O$MM#y zyZb6g-xB%O^4kRYuI=d`Zby%^3rs%!fxwL*{GR5v1@lg^?fd2!Zz)ALq-(|iNm&Au z-PS4G?Irn8a<@)H^9_Y2@Y?U7+LscV9}W6OOEM}uC!0BBTBTp`Q+CapwCk1wb5Jb( zThxPrQSTpw=WylToAo_x&fEF3Li4sRykc+EhDcYsUB)XMso@mn@;PYixo727BAkO+ zTph*a3binna5Ia5+Nh7ZV*I>5D5HkQb4#5{&h%o==_{OjaAvC(l@}kRc!<7j$OGpP zS9Nrd>jeSwNO`0TQthHqNCkDIqPn8WWh7D^i9GUPl>486um1y2xA6ZTc%sypb`jwF ud%@D*Ed=8n Date: Sat, 14 Nov 2020 13:12:37 -0600 Subject: [PATCH 4/4] Update elisp to 27.1 - fix scraper due changes in the web page - add better style --- assets/stylesheets/pages/_elisp.scss | 11 ++++++++--- lib/docs/filters/elisp/clean_html.rb | 17 +++++++---------- lib/docs/filters/elisp/entries.rb | 28 +++++++++++++++------------- lib/docs/scrapers/elisp.rb | 2 +- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/assets/stylesheets/pages/_elisp.scss b/assets/stylesheets/pages/_elisp.scss index 3b366005..f8fbe580 100644 --- a/assets/stylesheets/pages/_elisp.scss +++ b/assets/stylesheets/pages/_elisp.scss @@ -1,9 +1,14 @@ ._elisp { - div > b { + dl > dt { @extend %block-label, %label-blue; } - div > b { - margin: 2% auto; + dl[compact] > dt { + background: none; + border-color: none; + line-height: normal; + margin: auto; + border: none; } + } diff --git a/lib/docs/filters/elisp/clean_html.rb b/lib/docs/filters/elisp/clean_html.rb index 7b4db744..7d173360 100644 --- a/lib/docs/filters/elisp/clean_html.rb +++ b/lib/docs/filters/elisp/clean_html.rb @@ -8,7 +8,7 @@ module Docs css('table ~ p').remove # remove "Detailed Node Listing" header - css('h3').remove + css('h2').remove # remove "Detailed Node Listing" table css('table')[1].remove @@ -21,10 +21,10 @@ module Docs end # remove navigation bar - css('.node').remove + css('.header').remove # Remove content in headers - css('h2', 'h3', 'h4', 'h5', 'h6').each do |node| + css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').each do |node| # remove numbers at the beginning of all headers node.content = node.content.slice(/[[:alpha:]]...*/) @@ -45,13 +45,10 @@ module Docs end # add id to each defun section that contains a functions, macro, etc. - css('.defun').each do |node| - node['id']= node.first_element_child.content - - # change all tags to , this helps pages style - functionName = node.first_element_child - arguments = functionName.next_sibling - arguments.parent= functionName + css('dl > dt').each do |node| + if !(node.parent.attribute('compact')) + node['id'] = node.at_css('strong').content + end end # remove br for style purposes diff --git a/lib/docs/filters/elisp/entries.rb b/lib/docs/filters/elisp/entries.rb index 4961e36d..9ccacb59 100644 --- a/lib/docs/filters/elisp/entries.rb +++ b/lib/docs/filters/elisp/entries.rb @@ -3,7 +3,7 @@ module Docs class EntriesFilter < Docs::EntriesFilter def get_name # remove numbers at the beginnig - name = at_css('h2', 'h3', 'h4', 'h5', 'h6').content.slice(/[[:alpha:]]...*/) + name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').content.slice(/[[:alpha:]]...*/) # remove 'Appendix' word name = name.sub(/Appendix.{2}/, '') if name.include?('Appendix') @@ -28,18 +28,20 @@ module Docs def additional_entries entries = [] - css('.defun').each do |node| - entry_type = 'Builtin Functions' if node.content.include?('Function') - entry_type = 'Builtin Macros' if node.content.include?('Macro') - entry_type = 'Builtin Variables' if node.content.include?('Variable') - entry_type = 'Builtin User Options' if node.content.include?('User Option') - entry_type = 'Builtin Special Forms' if node.content.include?('Special Form') - entry_type = 'Builtin Commands' if node.content.include?('Command') - entry_type = 'Builtin Constants' if node.content.include?('Constant') - - entry_name = node.first_element_child.content - entry_path = slug + '#' + entry_name - entries << [entry_name, entry_path.downcase, entry_type] + css('dl > dt').each do |node| + if !(node.parent.attribute('compact')) + entry_type = 'Builtin Functions' if node.content.include?('Function') + entry_type = 'Builtin Macros' if node.content.include?('Macro') + entry_type = 'Builtin Variables' if node.content.include?('Variable') + entry_type = 'Builtin User Options' if node.content.include?('User Option') + entry_type = 'Builtin Special Forms' if node.content.include?('Special Form') + entry_type = 'Builtin Commands' if node.content.include?('Command') + entry_type = 'Builtin Constants' if node.content.include?('Constant') + + entry_name = node.at_css('strong').content + entry_path = slug + '#' + entry_name + entries << [entry_name, entry_path.downcase, entry_type] + end end entries diff --git a/lib/docs/scrapers/elisp.rb b/lib/docs/scrapers/elisp.rb index 264ba6f5..70702945 100644 --- a/lib/docs/scrapers/elisp.rb +++ b/lib/docs/scrapers/elisp.rb @@ -1,7 +1,7 @@ module Docs class Elisp < UrlScraper self.type = 'elisp' - self.release = '26.3' + self.release = '27.1' self.base_url= 'https://www.gnu.org/software/emacs/manual/html_node/elisp/' self.root_path = 'index.html' self.links = {