|
|
@ -2,6 +2,15 @@ module Docs
|
|
|
|
class Pytorch
|
|
|
|
class Pytorch
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
class EntriesFilter < Docs::EntriesFilter
|
|
|
|
def get_name
|
|
|
|
def get_name
|
|
|
|
|
|
|
|
# retrive the name in breadcrumb from the auxiliary node
|
|
|
|
|
|
|
|
name_in_breadcrumb = doc.child.content
|
|
|
|
|
|
|
|
doc.child.remove
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# hard-coded name replacements, for better presentation.
|
|
|
|
|
|
|
|
name_replacements = {
|
|
|
|
|
|
|
|
"Distributed communication package - torch.distributed" => "torch.distributed"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# The id of the container `div.section` indicates the page type.
|
|
|
|
# The id of the container `div.section` indicates the page type.
|
|
|
|
# If the id starts with `module-`, then it's an API reference,
|
|
|
|
# If the id starts with `module-`, then it's an API reference,
|
|
|
|
# otherwise it is a note or design doc.
|
|
|
|
# otherwise it is a note or design doc.
|
|
|
@ -9,7 +18,9 @@ module Docs
|
|
|
|
if doc.element_children[1]['id']&.starts_with? 'module-'
|
|
|
|
if doc.element_children[1]['id']&.starts_with? 'module-'
|
|
|
|
/\Amodule-(.*)/.match(doc.element_children[1]['id'])[1]
|
|
|
|
/\Amodule-(.*)/.match(doc.element_children[1]['id'])[1]
|
|
|
|
else
|
|
|
|
else
|
|
|
|
at_css('h1').content
|
|
|
|
name_in_breadcrumb = name_in_breadcrumb.delete_suffix(' >')
|
|
|
|
|
|
|
|
name_in_breadcrumb = name_replacements.fetch(name_in_breadcrumb, name_in_breadcrumb)
|
|
|
|
|
|
|
|
name_in_breadcrumb
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -18,9 +29,8 @@ module Docs
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def include_default_entry?
|
|
|
|
def include_default_entry?
|
|
|
|
# If the page is not an API reference, we only include it in the index when it
|
|
|
|
# Only include API references, and ignore notes or design docs
|
|
|
|
# contains additional entries. See the doc for `get_name`.
|
|
|
|
!subpath.start_with? 'generated/' and type.start_with? 'torch'
|
|
|
|
doc.element_children[1]['id']&.starts_with? 'module-'
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def additional_entries
|
|
|
|
def additional_entries
|
|
|
|