Examples¶
dj-angles
is pretty flexible when determining what HTML to parse. Here are some examples of to show what can be done. Set up custom mappers to handle additional use cases.
React-style include¶
# settings.py
ANGLES = {
"initial_tag_regex": r"(?=[A-Z])", # lookahead match upper-case letter
}
<PartialOne />
This would transpile to the following.
<dj-partial>{% include 'partial-one.html' %}</dj-partial>
Special character¶
# settings.py
ANGLES = {
"initial_tag_regex": r"(\$)"
}
<$partial />
This would transpile to the following.
<dj-partial>{% include 'partial.html' %}</dj-partial>