Update elisp to 27.1

- fix scraper due changes in the web page

- add better style
pull/1270/head^2
MasterEnoc 4 years ago
parent f43b1f7b2d
commit 7f4b499579

@ -1,9 +1,14 @@
._elisp { ._elisp {
div > b { dl > dt {
@extend %block-label, %label-blue; @extend %block-label, %label-blue;
} }
div > b { dl[compact] > dt {
margin: 2% auto; background: none;
border-color: none;
line-height: normal;
margin: auto;
border: none;
} }
} }

@ -8,7 +8,7 @@ module Docs
css('table ~ p').remove css('table ~ p').remove
# remove "Detailed Node Listing" header # remove "Detailed Node Listing" header
css('h3').remove css('h2').remove
# remove "Detailed Node Listing" table # remove "Detailed Node Listing" table
css('table')[1].remove css('table')[1].remove
@ -21,10 +21,10 @@ module Docs
end end
# remove navigation bar # remove navigation bar
css('.node').remove css('.header').remove
# Remove content in headers # 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 # remove numbers at the beginning of all headers
node.content = node.content.slice(/[[:alpha:]]...*/) node.content = node.content.slice(/[[:alpha:]]...*/)
@ -45,13 +45,10 @@ module Docs
end end
# add id to each defun section that contains a functions, macro, etc. # add id to each defun section that contains a functions, macro, etc.
css('.defun').each do |node| css('dl > dt').each do |node|
node['id']= node.first_element_child.content if !(node.parent.attribute('compact'))
node['id'] = node.at_css('strong').content
# change all <var> tags to <b>, this helps pages style end
functionName = node.first_element_child
arguments = functionName.next_sibling
arguments.parent= functionName
end end
# remove br for style purposes # remove br for style purposes

@ -3,7 +3,7 @@ module Docs
class EntriesFilter < Docs::EntriesFilter class EntriesFilter < Docs::EntriesFilter
def get_name def get_name
# remove numbers at the beginnig # 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 # remove 'Appendix' word
name = name.sub(/Appendix.{2}/, '') if name.include?('Appendix') name = name.sub(/Appendix.{2}/, '') if name.include?('Appendix')
@ -28,18 +28,20 @@ module Docs
def additional_entries def additional_entries
entries = [] entries = []
css('.defun').each do |node| css('dl > dt').each do |node|
entry_type = 'Builtin Functions' if node.content.include?('Function') if !(node.parent.attribute('compact'))
entry_type = 'Builtin Macros' if node.content.include?('Macro') entry_type = 'Builtin Functions' if node.content.include?('Function')
entry_type = 'Builtin Variables' if node.content.include?('Variable') entry_type = 'Builtin Macros' if node.content.include?('Macro')
entry_type = 'Builtin User Options' if node.content.include?('User Option') entry_type = 'Builtin Variables' if node.content.include?('Variable')
entry_type = 'Builtin Special Forms' if node.content.include?('Special Form') entry_type = 'Builtin User Options' if node.content.include?('User Option')
entry_type = 'Builtin Commands' if node.content.include?('Command') entry_type = 'Builtin Special Forms' if node.content.include?('Special Form')
entry_type = 'Builtin Constants' if node.content.include?('Constant') 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 entry_name = node.at_css('strong').content
entries << [entry_name, entry_path.downcase, entry_type] entry_path = slug + '#' + entry_name
entries << [entry_name, entry_path.downcase, entry_type]
end
end end
entries entries

@ -1,7 +1,7 @@
module Docs module Docs
class Elisp < UrlScraper class Elisp < UrlScraper
self.type = 'elisp' 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.base_url= 'https://www.gnu.org/software/emacs/manual/html_node/elisp/'
self.root_path = 'index.html' self.root_path = 'index.html'
self.links = { self.links = {

Loading…
Cancel
Save