Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions lib/docs/filters/hol/clean_html.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module Docs
class Hol
class CleanHtmlFilter < Filter
def call
@doc = at_css('article .theme-doc-markdown') || at_css('article')
return doc if @doc.nil?

css(
'.theme-doc-breadcrumbs',
'.theme-doc-toc-mobile',
'.theme-doc-footer',
'.theme-doc-version-badge',
'.pagination-nav',
'.theme-edit-this-page',
'.hash-link',
'.anchor-link',
'button.copyButtonIcon_Lhsm',
'button.clean-btn',
).remove

css('pre').each do |node|
lines = node.css('.token-line')
node.content = lines.map(&:content).join("\n") if lines.any?
node.remove_attribute('style')

language = node['class'].to_s[/language-([a-z0-9_-]+)/i, 1]
language ||= node.at_css('code')&.[]('class').to_s[/language-([a-z0-9_-]+)/i, 1]
node['data-language'] = language if language

wrapper = node.ancestors('.theme-code-block').first
wrapper.replace(node) if wrapper
end

css('.table-of-contents').remove
css('*[class]').remove_attribute('class')
css('*[style]').remove_attribute('style')

doc
end
end
end
end
77 changes: 77 additions & 0 deletions lib/docs/filters/hol/entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module Docs
class Hol
class EntriesFilter < Docs::EntriesFilter
def include_default_entry?
!root_page?
end

def get_name
heading = at_css('h1')
return super if heading.nil?
normalized_heading_text(heading)
end

def get_type
return standards_sdk_type if standards_sdk_doc?
return registry_broker_type if registry_broker_doc?
nil
end

def additional_entries
return [] if root_page?

css('h2[id], h3[id]').each_with_object([]) do |node, entries|
section_name = normalized_heading_text(node)
next if section_name.empty?
next if section_name == name
entries << ["#{name}: #{section_name}", node['id']]
end
end

private

def normalized_heading_text(node)
fragment = node.dup
fragment.css('a').remove
fragment.content.gsub(/\s+/, ' ').strip
end

def standards_sdk_doc?
slug.start_with?('libraries/standards-sdk/')
end

def registry_broker_doc?
slug.start_with?('registry-broker/')
end

def standards_sdk_type
sdk_slug = slug.delete_prefix('libraries/standards-sdk/').split('/').first
return 'Standards SDK' if sdk_slug.nil? || sdk_slug.empty?
return sdk_slug.upcase if sdk_slug.match?(/\Ahcs-\d+\z/)

case sdk_slug
when 'registry-broker-client'
'SDK Registry Broker Client'
when 'utils-services'
'SDK Utilities & Services'
else
"SDK #{sdk_slug.tr('-', ' ').split.map(&:capitalize).join(' ')}"
end
end

def registry_broker_type
broker_slug = slug.delete_prefix('registry-broker/').split('/').first
return 'Registry Broker' if broker_slug.nil? || broker_slug.empty?

case broker_slug
when 'api'
'Registry Broker API'
when 'chat', 'encrypted-chat', 'multi-protocol-chat'
'Registry Broker Chat'
else
"Registry Broker #{broker_slug.tr('-', ' ').split.map(&:capitalize).join(' ')}"
end
end
end
end
end
39 changes: 39 additions & 0 deletions lib/docs/scrapers/hol.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Docs
class Hol < UrlScraper
self.name = 'Hashgraph Online'
self.slug = 'hol'
self.type = 'simple'
self.release = '0.1.161'
self.base_url = 'https://hol.org/docs/'
self.root_path = 'libraries/standards-sdk/'
self.initial_paths = %w(
libraries/standards-sdk/
registry-broker/
)
self.links = {
home: 'https://hol.org/',
code: 'https://github.com/hashgraph-online/standards-sdk'
}

html_filters.push 'hol/entries', 'hol/clean_html'

options[:trailing_slash] = true
options[:only_patterns] = [
%r{\A(?:libraries/standards-sdk|registry-broker)(?:/|$)},
]
options[:skip_patterns] = [
%r{\Aregistry-broker/examples/(?:chat-demo|ping-agent-demo)/?},
%r{\Aregistry-broker/getting-started/(?:faq|first-registration|installation|quick-start)/?},
%r{\Aregistry-broker/(?:feature-your-agent|moltbook|partner-program|skills-upload-discovery|updating-agents)/?},
]

options[:attribution] = <<-HTML
Copyright &copy; 2025 Hashgraph Online DAO.<br>
Licensed under the Apache License 2.0.
HTML

def get_latest_version(opts)
get_npm_version('@hashgraphonline/standards-sdk', opts)
end
end
end
Binary file added public/icons/docs/hol/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/docs/hol/16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/docs/hol/SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://hol.org/logo.png