Commit c59f4169 authored by di68kap's avatar di68kap
Browse files

- MLW Fehlerkorrekturen

parent 37fc3f35
......@@ -52,6 +52,7 @@ __all__ = ('TransformationDict',
......@@ -605,7 +606,7 @@ def merge_children(context: List[Node], tag_names: List[str]):
def replace_content(context: List[Node], func: Callable): # Callable[[Node], ResultType]
"""Replaces the content of the node. ``func`` takes the node
"""Replaces the content of the node. ``func`` takes the node's result
as an argument an returns the mapped result.
node = context[-1]
......@@ -31,7 +31,7 @@ from DHParser import is_filename, load_if_file, \
is_empty, is_expendable, collapse, replace_content, remove_nodes, remove_content, \
remove_brackets, replace_parser, traverse_locally, remove_nodes, \
keep_children, is_one_of, has_content, apply_if, remove_first, remove_last, \
lstrip, rstrip, strip, keep_nodes, remove_anonymous_empty
lstrip, rstrip, strip, keep_nodes, remove_anonymous_empty, has_parent
from DHParser.log import logging
......@@ -568,11 +568,12 @@ MLW_AST_transformation_table = {
"SW_DEU": [replace_or_reduce],
"SW_GRIECH": [replace_or_reduce],
"Verweis": [],
"VerweisZiel": [],
"VerweisKern": [reduce_single_child],
"ziel": [], # [apply_if(replace_content(lambda s: ''), has_parent("URL"))],
"Anker": [reduce_single_child],
"Werk": [reduce_single_child],
"ZielName": [replace_by_single_child],
"URL": [flatten, keep_nodes('protokoll', 'domäne', 'pfad', 'ziel')],
"URL": [flatten, keep_nodes('protokoll', 'domäne', 'pfad', 'ziel'), replace_by_single_child],
"NAME": [],
"DEU_WORT": [reduce_single_child],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment