mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
commit
ef799d1114
7 changed files with 84 additions and 0 deletions
|
@ -1,4 +1,8 @@
|
|||
[
|
||||
[
|
||||
"2024-01-20",
|
||||
"New documentation: <a href=\"/htmx/\">htmx</a>"
|
||||
],
|
||||
[
|
||||
"2024-01-12",
|
||||
"New documentation: <a href=\"/hammerspoon/\">Hammerspoon</a>"
|
||||
|
|
13
lib/docs/filters/htmx/clean_html.rb
Normal file
13
lib/docs/filters/htmx/clean_html.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Docs
|
||||
class Htmx
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
css('.zola-anchor').remove
|
||||
doc.prepend_child("<h1>htmx</h1>") if root_page?
|
||||
css('div:contains("NEWS:")').remove
|
||||
css('h2:contains("sponsors"), #sponsor-table').remove
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
31
lib/docs/filters/htmx/entries.rb
Normal file
31
lib/docs/filters/htmx/entries.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
module Docs
|
||||
class Htmx
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_type
|
||||
if slug.start_with?('attributes')
|
||||
'Attributes'
|
||||
elsif slug.start_with?('headers')
|
||||
'Headers'
|
||||
elsif slug.start_with?('events')
|
||||
'Events'
|
||||
elsif slug.start_with?('extensions')
|
||||
'Extensions'
|
||||
else
|
||||
get_name
|
||||
end
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h3[id]:has(code)').each_with_object [] do |node, entries|
|
||||
name = node.at_css('code').content
|
||||
id = node['id']
|
||||
entries << [name, id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
35
lib/docs/scrapers/htmx.rb
Normal file
35
lib/docs/scrapers/htmx.rb
Normal file
|
@ -0,0 +1,35 @@
|
|||
module Docs
|
||||
class Htmx < UrlScraper
|
||||
self.name = 'htmx'
|
||||
self.type = 'simple'
|
||||
self.slug = 'htmx'
|
||||
self.links = {
|
||||
home: 'https://htmx.org/',
|
||||
code: 'https://github.com/bigskysoftware/htmx'
|
||||
}
|
||||
self.release = '1.9.10'
|
||||
self.base_url = "https://htmx.org/"
|
||||
self.initial_paths = %w(reference/)
|
||||
|
||||
html_filters.push 'htmx/entries', 'htmx/clean_html'
|
||||
|
||||
options[:trailing_slash] = true
|
||||
options[:container] = '.content'
|
||||
options[:download_images] = false
|
||||
options[:skip_patterns] = [
|
||||
/\Aessays/,
|
||||
/\Aexamples/,
|
||||
/\Amigration-guide/,
|
||||
/\Aposts/,
|
||||
]
|
||||
|
||||
# https://github.com/bigskysoftware/htmx/blob/master/LICENSE
|
||||
options[:attribution] = <<-HTML
|
||||
Licensed under the Zero-Clause BSD
|
||||
HTML
|
||||
|
||||
def get_latest_version(opts)
|
||||
get_npm_version('htmx.org', opts)
|
||||
end
|
||||
end
|
||||
end
|
BIN
public/icons/docs/htmx/16.png
Normal file
BIN
public/icons/docs/htmx/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 817 B |
BIN
public/icons/docs/htmx/16@2x.png
Normal file
BIN
public/icons/docs/htmx/16@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
1
public/icons/docs/htmx/SOURCE
Normal file
1
public/icons/docs/htmx/SOURCE
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/bigskysoftware/htmx/blob/v1.9.10/www/static/img/htmx_logo.2.png
|
Loading…
Reference in a new issue