lhtml-markup 2.5.0__tar.gz → 2.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lhtml_markup-2.5.0/src/lhtml_markup.egg-info → lhtml_markup-2.5.1}/PKG-INFO +1 -1
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/__init__.py +1 -1
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/export_html.py +6 -5
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1/src/lhtml_markup.egg-info}/PKG-INFO +1 -1
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/test/test_lhtml.py +3 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/LICENSE.md +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/README.md +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/pyproject.toml +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/setup.cfg +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/__main__.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/cli.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/code.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/element_extract.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/errors.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/insert_in_text.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/listing.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/macros.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/patterns.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/pipeline.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/process.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/tag_element.lark +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/tag_parser.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/wrap_html.py +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/SOURCES.txt +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/dependency_links.txt +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/entry_points.txt +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/requires.txt +0 -0
- {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/top_level.txt +0 -0
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
html = lhtml.run(text, {'wrap-auto': True, 'title': 'My Page'})
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
__version__ = '2.5.
|
|
12
|
+
__version__ = '2.5.1'
|
|
13
13
|
|
|
14
14
|
from .element_extract import extract_bracket_elements
|
|
15
15
|
from .insert_in_text import insert_element_from_index, remove_element_to_index
|
|
@@ -44,16 +44,17 @@ def export_html_element_style(text):
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def export_html_element_class_and_id(text):
|
|
47
|
-
"""Parse '.class1 .class2 #id' into class="..."
|
|
47
|
+
"""Parse '.class1 .class2 #id' (or '.class1.class2#id') into class="..."
|
|
48
|
+
id="..." attributes."""
|
|
48
49
|
if not text:
|
|
49
50
|
return ''
|
|
50
51
|
classes = []
|
|
51
52
|
ids = []
|
|
52
53
|
for token in text.split():
|
|
53
|
-
if token.startswith('.'):
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
ids.append(
|
|
54
|
+
if not token.startswith(('.', '#')):
|
|
55
|
+
continue
|
|
56
|
+
for part in re.findall(r'[.#][^.#]+', token):
|
|
57
|
+
(classes if part[0] == '.' else ids).append(part[1:])
|
|
57
58
|
parts = []
|
|
58
59
|
if classes:
|
|
59
60
|
parts.append(f' class="{" ".join(classes)}"')
|
|
@@ -1570,3 +1570,6 @@ class TestMacrosRound3:
|
|
|
1570
1570
|
with pytest.raises(lhtml.LHTMLMacroError, match='not an element'):
|
|
1571
1571
|
lhtml.run('x\n', {'macros': {'m': {'tag': tag}}})
|
|
1572
1572
|
|
|
1573
|
+
def test_chained_classes(self):
|
|
1574
|
+
assert lhtml.run('div::(.a.b#c) x ::\n') == '<div class="a b" id="c"> x </div>\n'
|
|
1575
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|