mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Merge pull request #1270 from MasterEnoc/master
Add Elisp docs for version 26.3
This commit is contained in:
commit
eda53194b0
9 changed files with 209 additions and 0 deletions
|
@ -266,6 +266,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',
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
'pages/dojo',
|
||||
'pages/drupal',
|
||||
'pages/elixir',
|
||||
'pages/elisp',
|
||||
'pages/ember',
|
||||
'pages/erlang',
|
||||
'pages/express',
|
||||
|
|
14
assets/stylesheets/pages/_elisp.scss
Normal file
14
assets/stylesheets/pages/_elisp.scss
Normal file
|
@ -0,0 +1,14 @@
|
|||
._elisp {
|
||||
dl > dt {
|
||||
@extend %block-label, %label-blue;
|
||||
}
|
||||
|
||||
dl[compact] > dt {
|
||||
background: none;
|
||||
border-color: none;
|
||||
line-height: normal;
|
||||
margin: auto;
|
||||
border: none;
|
||||
}
|
||||
|
||||
}
|
66
lib/docs/filters/elisp/clean_html.rb
Normal file
66
lib/docs/filters/elisp/clean_html.rb
Normal file
|
@ -0,0 +1,66 @@
|
|||
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('h2').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('.header').remove
|
||||
|
||||
# Remove content in headers
|
||||
css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').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('dl > dt').each do |node|
|
||||
if !(node.parent.attribute('compact'))
|
||||
node['id'] = node.at_css('strong').content
|
||||
end
|
||||
end
|
||||
|
||||
# remove br for style purposes
|
||||
css('br').each do |node|
|
||||
node.remove
|
||||
end
|
||||
|
||||
# remove footnotes
|
||||
css('.footnote').remove
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
52
lib/docs/filters/elisp/entries.rb
Normal file
52
lib/docs/filters/elisp/entries.rb
Normal file
|
@ -0,0 +1,52 @@
|
|||
module Docs
|
||||
class Elisp
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
# remove numbers at the beginnig
|
||||
name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').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('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
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
70
lib/docs/scrapers/elisp.rb
Normal file
70
lib/docs/scrapers/elisp.rb
Normal file
|
@ -0,0 +1,70 @@
|
|||
module Docs
|
||||
class Elisp < UrlScraper
|
||||
self.type = 'elisp'
|
||||
self.release = '27.1'
|
||||
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. <br>
|
||||
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
|
BIN
public/icons/docs/elisp/16.png
Normal file
BIN
public/icons/docs/elisp/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
public/icons/docs/elisp/16@2x.png
Normal file
BIN
public/icons/docs/elisp/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
1
public/icons/docs/elisp/SOURCE
Normal file
1
public/icons/docs/elisp/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://www.gnu.org/software/emacs/
|
Loading…
Reference in a new issue