Skip to content

Commit

Permalink
fix namespace handling (Closes #566)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Apr 28, 2024
1 parent eb55e65 commit 81b943c
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 305 deletions.
35 changes: 30 additions & 5 deletions src/html/mod.rs
Expand Up @@ -290,14 +290,23 @@ impl DocNodeWithContext {
}
}

pub fn create_namespace_child(
&self,
doc_node: Arc<DocNode>,
qualifiers: Rc<Vec<String>>,
) -> Self {
let mut child = self.create_child(doc_node);
child.ns_qualifiers = qualifiers;
child
}

pub fn create_child_method(
&self,
mut method_doc_node: DocNode,
parent_name: &str,
is_static: bool,
) -> Self {
method_doc_node.name =
qualify_drilldown_name(parent_name, &method_doc_node.name, is_static);
qualify_drilldown_name(self.get_name(), &method_doc_node.name, is_static);
method_doc_node.declaration_kind = self.declaration_kind;

let mut new_node = self.create_child(Arc::new(method_doc_node));
Expand All @@ -309,18 +318,34 @@ impl DocNodeWithContext {
pub fn create_child_property(
&self,
mut property_doc_node: DocNode,
parent_name: &str,
is_static: bool,
) -> Self {
property_doc_node.name =
qualify_drilldown_name(parent_name, &property_doc_node.name, is_static);
property_doc_node.name = qualify_drilldown_name(
self.get_name(),
&property_doc_node.name,
is_static,
);
property_doc_node.declaration_kind = self.declaration_kind;

let mut new_node = self.create_child(Arc::new(property_doc_node));
new_node.drilldown_parent_kind = Some(self.kind);
new_node.kind_with_drilldown = DocNodeKindWithDrilldown::Property;
new_node
}

pub fn get_qualified_name(&self) -> String {
if self.ns_qualifiers.is_empty() {
self.get_name().to_string()
} else {
format!("{}.{}", self.ns_qualifiers.join("."), self.get_name())
}
}

pub fn sub_qualifier(&self) -> Vec<String> {
let mut ns_qualifiers = (*self.ns_qualifiers).clone();
ns_qualifiers.push(self.get_name().to_string());
ns_qualifiers
}
}

impl core::ops::Deref for DocNodeWithContext {
Expand Down

0 comments on commit 81b943c

Please sign in to comment.