Skip to content

Commit

Permalink
Merge pull request #402 from xxyzz/comment
Browse files Browse the repository at this point in the history
Add usage comments to `clean_node()`
  • Loading branch information
xxyzz authored Nov 28, 2023
2 parents c43127e + cace436 commit 3821035
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/wiktextract/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,18 @@ def remove_duplicate_data(page_data: Dict) -> None:
def clean_node(
wxr: WiktextractContext,
sense_data: Optional[Dict],
value: Union[str, WikiNode, List[Union[str, WikiNode, List]]],
wikinode: Union[str, WikiNode, List[Union[str, WikiNode, List]]],
template_fn: Optional[Callable[[str, Dict], str]] = None,
post_template_fn: Optional[Callable[[str, Dict, str], str]] = None,
collect_links: bool = False,
) -> str:
"""Expands the node to text, cleaning up any HTML and duplicate spaces.
This is intended for expanding things like glosses for a single sense."""
"""
Expands node or nodes to text, cleaning up HTML tags and duplicate spaces.
If `sense_data` is a dictionary, expanded category links will be added to
it under the `categories` key. And if `collect_link` is `True`, expanded
links will be added to the `links` key.
"""

# print("CLEAN_NODE:", repr(value))
def clean_template_fn(name, ht):
Expand Down Expand Up @@ -360,7 +365,7 @@ def clean_node_handler_fn(node):

# print("clean_node: value={!r}".format(value))
v = wxr.wtp.node_to_html(
value,
wikinode,
node_handler_fn=clean_node_handler_fn,
template_fn=template_fn,
post_template_fn=post_template_fn,
Expand Down

0 comments on commit 3821035

Please sign in to comment.