Showing the changes to lib/docs (17 of 30 files). Show all
Unified · Split
| @@ -0,0 +1,58 @@ | ||
| 1 | +module Docs | |
| 2 | + class Click | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + TYPE_BY_SLUG = {} | |
| 5 | + | |
| 6 | + def call | |
| 7 | + if root_page? | |
| 8 | + css('section').each do |node| | |
| 9 | + next if ['documentation', 'api-reference'].include?(node['id']) | |
| 10 | + type = node.at_css('h2').content.strip | |
| 11 | + node.css('li > a').each do |toclink| | |
| 12 | + slug = toclink['href'].split('/')[-2] | |
| 13 | + TYPE_BY_SLUG[slug] = type | |
| 14 | + end | |
| 15 | + end | |
| 16 | + end | |
| 17 | + super | |
| 18 | + end | |
| 19 | + | |
| 20 | + def get_name | |
| 21 | + return at_css('h1').content.strip | |
| 22 | + end | |
| 23 | + | |
| 24 | + def get_type | |
| 25 | + TYPE_BY_SLUG[slug.split('/').first] || at_css('h1').content.strip | |
| 26 | + end | |
| 27 | + | |
| 28 | + def include_default_entry? | |
| 29 | + TYPE_BY_SLUG.include?(slug.split('/').first) | |
| 30 | + end | |
| 31 | + | |
| 32 | + def additional_entries | |
| 33 | + return [] if root_page? || TYPE_BY_SLUG.include?(slug.split('/').first) | |
| 34 | + | |
| 35 | + if slug == 'api/' | |
| 36 | + entries = [] | |
| 37 | + doc.css('> section').each do |section| | |
| 38 | + title = section.at_css('h2').content.strip | |
| 39 | + section.css('dl.py > dt[id]').each do |dt| | |
| 40 | + name = dt['id'].split('.')[1..].join('.') | |
| 41 | + name << '()' if dt.parent.classes.intersect?(['function', 'method', 'classmethod', 'staticmethod']) | |
| 42 | + entries << [name, dt['id'], title] | |
| 43 | + end | |
| 44 | + end | |
| 45 | + return entries | |
| 46 | + end | |
| 47 | + | |
| 48 | + (doc.css('> section') || []).map do |section| | |
| 49 | + title = section.at_css('h2').content.strip | |
| 50 | + [title, section['id']] | |
| 51 | + end | |
| 52 | + end | |
| 53 | + | |
| 54 | + private | |
| 55 | + | |
| 56 | + end | |
| 57 | + end | |
| 58 | +end | |
| @@ -0,0 +1,11 @@ | ||
| 1 | +module Docs | |
| 2 | + class Click | |
| 3 | + class PreCleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + # Remove ¶ character from headers | |
| 6 | + css('.headerlink').remove | |
| 7 | + doc | |
| 8 | + end | |
| 9 | + end | |
| 10 | + end | |
| 11 | +end | |
| @@ -2,7 +2,7 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Elisp |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | 4 | def get_name |
| 5 | − # remove numbers at the beginnig | |
| 5 | + # remove numbers at the beginning | |
| 6 | 6 | name = at_css('.chapter', '.section', '.subsection', '.subsubsection', '.appendix').content.slice(/[[:alpha:]]...*/) |
| 7 | 7 | |
| 8 | 8 | # remove 'Appendix' word |
| @@ -4,7 +4,7 @@ module Docs · 3 unmodified lines | ||
| 4 | 4 | # The GTK documentation paths are "flat" and while the contents of each |
| 5 | 5 | # page provides a way to determine the direct parent relationship, we |
| 6 | 6 | # really need a full hierarchy of pages *a priori* to be able to fully |
| 7 | − # categorize all pages and entries. So we're going to recursivly generate | |
| 7 | + # categorize all pages and entries. So we're going to recursively generate | |
| 8 | 8 | # a full map of page -> parent relationships from the table of contents... |
| 9 | 9 | PARENT_BY_PATH = {} |
| 10 | 10 | |
| @@ -15,7 +15,7 @@ module Docs · 14 unmodified lines | ||
| 15 | 15 | group = 'kubectl' |
| 16 | 16 | commands = css('h1').to_a() |
| 17 | 17 | commands.map do |node| |
| 18 | − # handle titles differnetly by converting them into sidebar groups (types) | |
| 18 | + # handle titles differently by converting them into sidebar groups (types) | |
| 19 | 19 | new_group = at_css("##{node['id']} > strong") |
| 20 | 20 | if new_group |
| 21 | 21 | group = new_group.content.titleize |
| @@ -0,0 +1,30 @@ | ||
| 1 | +module Docs | |
| 2 | + class Nextjs | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + @doc = at_css('.prose') | |
| 6 | + | |
| 7 | + css('.zola-anchor').remove | |
| 8 | + doc.prepend_child("<h1>NextJS2</h1>") if root_page? | |
| 9 | + css('div:contains("NEWS:")').remove | |
| 10 | + css('h2:contains("sponsors"), #sponsor-table').remove | |
| 11 | + css('div.sticky').remove #remove the floating menu | |
| 12 | + css('div.-mt-4').remove #remove the navigation line | |
| 13 | + css('footer').remove | |
| 14 | + css('div.feedback_inlineTriggerWrapper__o7yUx').remove | |
| 15 | + css('header').remove #remove links from the top of the page | |
| 16 | + css('nav').remove | |
| 17 | + | |
| 18 | + css('h1, h2, h3, h4').each { |node| node.content = node.content } | |
| 19 | + | |
| 20 | + css('pre > code').each do |node| | |
| 21 | + node.parent['data-language'] = 'typescript' | |
| 22 | + node.parent.content = node.parent.content | |
| 23 | + end | |
| 24 | + css('div[class^="code-block_header"]').remove | |
| 25 | + | |
| 26 | + doc | |
| 27 | + end | |
| 28 | + end | |
| 29 | + end | |
| 30 | +end | |
| @@ -0,0 +1,43 @@ | ||
| 1 | +module Docs | |
| 2 | + class Nextjs | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + def get_name | |
| 5 | + name = at_css('h1').content | |
| 6 | + name.strip! | |
| 7 | + #name | |
| 8 | + subpath_items = subpath.split('/', -1) | |
| 9 | + if subpath_items.length >= 5 | |
| 10 | + subpath_items[3].capitalize + ': ' + name # e.g. Routing: Defining Routes | |
| 11 | + else | |
| 12 | + name | |
| 13 | + end | |
| 14 | + end | |
| 15 | + | |
| 16 | + def get_type | |
| 17 | + if slug.start_with?('architecture') | |
| 18 | + 'Architecture' | |
| 19 | + elsif slug.start_with?('community') | |
| 20 | + 'Community' | |
| 21 | + elsif slug.start_with?('getting-started') | |
| 22 | + 'Getting Started' | |
| 23 | + elsif slug.start_with?('messages') | |
| 24 | + 'Messages' | |
| 25 | + elsif slug.start_with?('app/building-your-application') | |
| 26 | + 'Using App Router: Building your application' | |
| 27 | + elsif slug.start_with?('app/api-reference') | |
| 28 | + 'Using App Router: api-reference' | |
| 29 | + elsif slug.start_with?('app') | |
| 30 | + 'Using App Router' | |
| 31 | + elsif slug.start_with?('pages/building-your-application') | |
| 32 | + 'Using Pages Router: Building your application' | |
| 33 | + elsif slug.start_with?('pages/api-reference') | |
| 34 | + 'Using Pages Router: api-reference' | |
| 35 | + elsif slug.start_with?('pages') | |
| 36 | + 'Using Pages Router' | |
| 37 | + else | |
| 38 | + get_name | |
| 39 | + end | |
| 40 | + end | |
| 41 | + end | |
| 42 | + end | |
| 43 | +end | |
| @@ -0,0 +1,30 @@ | ||
| 1 | +module Docs | |
| 2 | + class Click < UrlScraper | |
| 3 | + self.name = 'click' | |
| 4 | + self.type = 'sphinx' | |
| 5 | + self.root_path = 'index.html' | |
| 6 | + self.links = { | |
| 7 | + home: 'https://click.palletsprojects.com/', | |
| 8 | + code: 'https://github.com/pallets/click' | |
| 9 | + } | |
| 10 | + | |
| 11 | + html_filters.push 'click/pre_clean_html', 'click/entries', 'sphinx/clean_html' | |
| 12 | + | |
| 13 | + options[:container] = '.body > section' | |
| 14 | + options[:skip] = ['changes/', 'genindex/', 'py-modindex/'] | |
| 15 | + options[:title] = false | |
| 16 | + | |
| 17 | + options[:attribution] = <<-HTML | |
| 18 | + © Copyright 2014 Pallets.<br> | |
| 19 | + Licensed under the BSD 3-Clause License.<br> | |
| 20 | + We are not supported nor endorsed by Pallets. | |
| 21 | + HTML | |
| 22 | + | |
| 23 | + self.release = '8.1.x' | |
| 24 | + self.base_url = "https://click.palletsprojects.com/en/#{self.release}/" | |
| 25 | + | |
| 26 | + def get_latest_version(opts) | |
| 27 | + get_latest_github_release('pallets', 'click', opts) | |
| 28 | + end | |
| 29 | + end | |
| 30 | +end | |
| @@ -36,7 +36,7 @@ module Docs · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | def get_latest_version(opts) |
| 38 | 38 | doc = fetch_doc('https://crystal-lang.org/', opts) |
| 39 | − doc.at_css('.latest-release').content.scan(/([0-9.]+)/)[0][0] | |
| 39 | + doc.at_css('.latest-release-info > a > strong').content.scan(/([0-9.]+)/)[0][0] | |
| 40 | 40 | end |
| 41 | 41 | end |
| 42 | 42 | end |
| @@ -96,7 +96,7 @@ module Docs · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | def get_latest_version(opts) |
| 98 | 98 | doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts) |
| 99 | − latest_version = doc.at_css('.content > section > h2').content.strip | |
| 99 | + latest_version = doc.at_css('.DocSearch-content > h2 > a').content.strip | |
| 100 | 100 | latest_version.rpartition(' ')[-1] |
| 101 | 101 | end |
| 102 | 102 | end |
| @@ -0,0 +1,26 @@ | ||
| 1 | +module Docs | |
| 2 | + class Nextjs < UrlScraper | |
| 3 | + self.name = 'Next.js' | |
| 4 | + self.slug = 'nextjs' | |
| 5 | + self.type = 'simple' | |
| 6 | + self.release = '14.2.4' | |
| 7 | + self.base_url = 'https://nextjs.org/docs' | |
| 8 | + self.initial_paths = %w(reference/) | |
| 9 | + self.links = { | |
| 10 | + home: 'https://www.nextjs.org/', | |
| 11 | + code: 'https://github.com/vercel/next.js' | |
| 12 | + } | |
| 13 | + | |
| 14 | + html_filters.push 'nextjs/entries', 'nextjs/clean_html' | |
| 15 | + options[:download_images] = false | |
| 16 | + | |
| 17 | + options[:attribution] = <<-HTML | |
| 18 | + © 2024 Vercel, Inc.<br> | |
| 19 | + Licensed under the MIT License. | |
| 20 | + HTML | |
| 21 | + | |
| 22 | + def get_latest_version(opts) | |
| 23 | + get_npm_version('next', opts) | |
| 24 | + end | |
| 25 | + end | |
| 26 | +end | |
| @@ -74,8 +74,8 @@ module Docs · 73 unmodified lines | ||
| 74 | 74 | end |
| 75 | 75 | |
| 76 | 76 | def get_latest_version(opts) |
| 77 | − doc = fetch_doc('https://nodejs.org/en/', opts) | |
| 78 | − doc.at_css('#home-intro > .home-downloadblock:last-of-type > a')['data-version'][1..-1] | |
| 77 | + tags = get_github_tags('nodejs', 'node', opts) | |
| 78 | + tags[0]['name'][1..-1] | |
| 79 | 79 | end |
| 80 | 80 | end |
| 81 | 81 | end |
| @@ -51,7 +51,7 @@ module Docs · 50 unmodified lines | ||
| 51 | 51 | |
| 52 | 52 | def get_latest_version(opts) |
| 53 | 53 | doc = fetch_doc('https://octave.org/doc/interpreter/', opts) |
| 54 | − doc.at_css('h1').content.scan(/([0-9.]+)/)[0][0] | |
| 54 | + doc.at_css('#SEC_Top + p').content.scan(/([0-9.]+)/)[1][0][0..-2] | |
| 55 | 55 | end |
| 56 | 56 | |
| 57 | 57 | end |
| @@ -31,8 +31,8 @@ module Docs · 30 unmodified lines | ||
| 31 | 31 | end |
| 32 | 32 | |
| 33 | 33 | def get_latest_version(opts) |
| 34 | − doc = fetch_doc('https://docs.phalconphp.com/', opts) | |
| 35 | − doc.at_css('.header__lang.expand > div > ul > li > a').content | |
| 34 | + tags = get_github_tags('phalcon', 'cphalcon', opts) | |
| 35 | + tags[0]['name'][1..-1] | |
| 36 | 36 | end |
| 37 | 37 | end |
| 38 | 38 | end |
| @@ -23,7 +23,7 @@ module Docs · 22 unmodified lines | ||
| 23 | 23 | HTML |
| 24 | 24 | |
| 25 | 25 | def get_latest_version(opts) |
| 26 | − get-npm-version("sanctuary-type-classes", opts) | |
| 26 | + get_npm_version("sanctuary-type-classes", opts) | |
| 27 | 27 | end |
| 28 | 28 | end |
| 29 | 29 | end |
| @@ -22,7 +22,7 @@ module Docs · 21 unmodified lines | ||
| 22 | 22 | html_filters.push 'vite/entries', 'vite/clean_html' |
| 23 | 23 | |
| 24 | 24 | version do |
| 25 | − self.release = '5.0.11' | |
| 25 | + self.release = '5.2.13' | |
| 26 | 26 | self.base_url = 'https://vitejs.dev/' |
| 27 | 27 | end |
| 28 | 28 | |
| @@ -19,7 +19,7 @@ module Docs · 18 unmodified lines | ||
| 19 | 19 | HTML |
| 20 | 20 | |
| 21 | 21 | version '3' do |
| 22 | − self.release = '3.4.5' | |
| 22 | + self.release = '3.4.27' | |
| 23 | 23 | self.base_url = 'https://vuejs.org/' |
| 24 | 24 | self.initial_paths = %w(guide/introduction.html) |
| 25 | 25 | html_filters.push 'vue/entries_v3', 'vue/clean_html' |