[devdocsgjs/main: 1146/1867] Update elisp to 27.1
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 1146/1867] Update elisp to 27.1
- Date: Fri, 19 Nov 2021 23:47:46 +0000 (UTC)
commit 7f4b499579c004ad6804dad7fcf80ccacd518e92
Author: MasterEnoc <brianhernandez222 hotmail com>
Date: Sat Nov 14 13:12:37 2020 -0600
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 <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
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 = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]