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 {
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;
}
}

@ -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 <var> tags to <b>, 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

@ -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,7 +28,8 @@ module Docs
def additional_entries
entries = []
css('.defun').each do |node|
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')
@ -37,10 +38,11 @@ module Docs
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_name = node.at_css('strong').content
entry_path = slug + '#' + entry_name
entries << [entry_name, entry_path.downcase, entry_type]
end
end
entries
end

@ -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 = {

Loading…
Cancel
Save