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.
Files changed (28) hide show
  1. {lhtml_markup-2.5.0/src/lhtml_markup.egg-info → lhtml_markup-2.5.1}/PKG-INFO +1 -1
  2. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/__init__.py +1 -1
  3. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/export_html.py +6 -5
  4. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1/src/lhtml_markup.egg-info}/PKG-INFO +1 -1
  5. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/test/test_lhtml.py +3 -0
  6. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/LICENSE.md +0 -0
  7. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/README.md +0 -0
  8. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/pyproject.toml +0 -0
  9. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/setup.cfg +0 -0
  10. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/__main__.py +0 -0
  11. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/cli.py +0 -0
  12. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/code.py +0 -0
  13. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/element_extract.py +0 -0
  14. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/errors.py +0 -0
  15. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/insert_in_text.py +0 -0
  16. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/listing.py +0 -0
  17. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/macros.py +0 -0
  18. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/patterns.py +0 -0
  19. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/pipeline.py +0 -0
  20. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/process.py +0 -0
  21. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/tag_element.lark +0 -0
  22. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/tag_parser.py +0 -0
  23. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml/wrap_html.py +0 -0
  24. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/SOURCES.txt +0 -0
  25. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/dependency_links.txt +0 -0
  26. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/entry_points.txt +0 -0
  27. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/requires.txt +0 -0
  28. {lhtml_markup-2.5.0 → lhtml_markup-2.5.1}/src/lhtml_markup.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lhtml-markup
3
- Version: 2.5.0
3
+ Version: 2.5.1
4
4
  Summary: Lightweight HTML markup language — simplifies HTML authoring with shorthand syntax
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/drohmer/lhtml
@@ -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.0'
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="..." id="..." attributes."""
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
- classes.append(token[1:])
55
- elif token.startswith('#'):
56
- ids.append(token[1:])
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)}"')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lhtml-markup
3
- Version: 2.5.0
3
+ Version: 2.5.1
4
4
  Summary: Lightweight HTML markup language — simplifies HTML authoring with shorthand syntax
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/drohmer/lhtml
@@ -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