lhtml-markup 2.0.0__tar.gz → 2.1.0__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.0.0/src/lhtml_markup.egg-info → lhtml_markup-2.1.0}/PKG-INFO +20 -4
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/README.md +16 -3
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/pyproject.toml +6 -1
- lhtml_markup-2.1.0/src/lhtml/cli.py +98 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0/src/lhtml_markup.egg-info}/PKG-INFO +20 -4
- lhtml_markup-2.0.0/src/lhtml/cli.py +0 -62
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/LICENSE.md +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/setup.cfg +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/__init__.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/__main__.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/ast_nodes.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/code.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/element_extract.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/errors.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/export_html.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/insert_in_text.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/listing.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/patterns.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/pipeline.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/process.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/tag_element.lark +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/tag_parser.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml/wrap_html.py +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml_markup.egg-info/SOURCES.txt +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml_markup.egg-info/dependency_links.txt +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml_markup.egg-info/entry_points.txt +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml_markup.egg-info/requires.txt +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/src/lhtml_markup.egg-info/top_level.txt +0 -0
- {lhtml_markup-2.0.0 → lhtml_markup-2.1.0}/test/test_lhtml.py +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lhtml-markup
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Lightweight HTML markup language — simplifies HTML authoring with shorthand syntax
|
|
5
5
|
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/drohmer/lhtml
|
|
7
|
+
Project-URL: Repository, https://github.com/drohmer/lhtml
|
|
8
|
+
Project-URL: Issues, https://github.com/drohmer/lhtml/issues
|
|
6
9
|
Requires-Python: >=3.10
|
|
7
10
|
Description-Content-Type: text/markdown
|
|
8
11
|
License-File: LICENSE.md
|
|
@@ -16,23 +19,36 @@ Dynamic: license-file
|
|
|
16
19
|
|
|
17
20
|
# LHTML — Lightweight HTML
|
|
18
21
|
|
|
22
|
+
[](https://github.com/drohmer/lhtml/actions/workflows/tests.yml)
|
|
23
|
+
[](https://pypi.org/project/lhtml-markup/)
|
|
24
|
+
|
|
19
25
|
LHTML is a markup language that simplifies HTML authoring with embedded CSS styling. It is designed to be **HTML-first**: raw HTML passes through untouched, and only a few shorthand symbols (`::`, `*`, `=`, `**`, `__`) trigger conversions.
|
|
20
26
|
|
|
21
27
|
LHTML is used to build static websites and presentation slides, typically combined with Jinja2 templates.
|
|
22
28
|
|
|
23
29
|
## Installation
|
|
24
30
|
|
|
31
|
+
From PyPI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install lhtml-markup
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or from source:
|
|
38
|
+
|
|
25
39
|
```bash
|
|
40
|
+
git clone https://github.com/drohmer/lhtml.git
|
|
41
|
+
cd lhtml
|
|
26
42
|
pip install .
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
For development:
|
|
30
46
|
|
|
31
47
|
```bash
|
|
32
|
-
pip install -e .
|
|
48
|
+
pip install -e ".[dev]"
|
|
33
49
|
```
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
Dependencies (`lark`, `pygments`, `pyyaml`) are installed automatically.
|
|
36
52
|
|
|
37
53
|
|
|
38
54
|
## Quick Start
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
# LHTML — Lightweight HTML
|
|
2
2
|
|
|
3
|
+
[](https://github.com/drohmer/lhtml/actions/workflows/tests.yml)
|
|
4
|
+
[](https://pypi.org/project/lhtml-markup/)
|
|
5
|
+
|
|
3
6
|
LHTML is a markup language that simplifies HTML authoring with embedded CSS styling. It is designed to be **HTML-first**: raw HTML passes through untouched, and only a few shorthand symbols (`::`, `*`, `=`, `**`, `__`) trigger conversions.
|
|
4
7
|
|
|
5
8
|
LHTML is used to build static websites and presentation slides, typically combined with Jinja2 templates.
|
|
6
9
|
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
12
|
+
From PyPI:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install lhtml-markup
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or from source:
|
|
19
|
+
|
|
9
20
|
```bash
|
|
21
|
+
git clone https://github.com/drohmer/lhtml.git
|
|
22
|
+
cd lhtml
|
|
10
23
|
pip install .
|
|
11
24
|
```
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
For development:
|
|
14
27
|
|
|
15
28
|
```bash
|
|
16
|
-
pip install -e .
|
|
29
|
+
pip install -e ".[dev]"
|
|
17
30
|
```
|
|
18
31
|
|
|
19
|
-
|
|
32
|
+
Dependencies (`lark`, `pygments`, `pyyaml`) are installed automatically.
|
|
20
33
|
|
|
21
34
|
|
|
22
35
|
## Quick Start
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lhtml-markup"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.1.0"
|
|
8
8
|
description = "Lightweight HTML markup language — simplifies HTML authoring with shorthand syntax"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -15,6 +15,11 @@ dependencies = [
|
|
|
15
15
|
"pyyaml>=6.0",
|
|
16
16
|
]
|
|
17
17
|
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://github.com/drohmer/lhtml"
|
|
20
|
+
Repository = "https://github.com/drohmer/lhtml"
|
|
21
|
+
Issues = "https://github.com/drohmer/lhtml/issues"
|
|
22
|
+
|
|
18
23
|
[project.optional-dependencies]
|
|
19
24
|
dev = [
|
|
20
25
|
"pytest>=7.0",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""LHTML command-line interface.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
lhtml [-w] file.l.html # Single file → stdout
|
|
5
|
+
lhtml [-w] file.l.html -o output.html # Single file → output file
|
|
6
|
+
lhtml [-w] a.l.html b.l.html # Multiple files → .html next to sources
|
|
7
|
+
lhtml [-w] a.l.html b.l.html -o build/ # Multiple files → output directory
|
|
8
|
+
python -m lhtml [same options]
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import argparse
|
|
13
|
+
|
|
14
|
+
from .pipeline import ProcessingPipeline
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
_pipeline = ProcessingPipeline()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _ensure_trailing_newline(text):
|
|
21
|
+
if text and text[-1] != '\n':
|
|
22
|
+
return text + '\n'
|
|
23
|
+
return text
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _output_path_for(input_path, output_arg):
|
|
27
|
+
"""Determine the output path for a given input file.
|
|
28
|
+
|
|
29
|
+
If output_arg is a directory, write <dir>/<basename>.html.
|
|
30
|
+
If output_arg is a file path, return it directly (single-file mode).
|
|
31
|
+
If output_arg is None, derive .html from the input path.
|
|
32
|
+
"""
|
|
33
|
+
basename = os.path.basename(input_path)
|
|
34
|
+
name, _ = os.path.splitext(basename)
|
|
35
|
+
# Strip double extensions like .l.html → .html
|
|
36
|
+
if name.endswith('.l'):
|
|
37
|
+
name = name[:-2]
|
|
38
|
+
|
|
39
|
+
if output_arg is None:
|
|
40
|
+
# Write next to source
|
|
41
|
+
return os.path.join(os.path.dirname(input_path), name + '.html')
|
|
42
|
+
|
|
43
|
+
if os.path.isdir(output_arg) or output_arg.endswith('/'):
|
|
44
|
+
os.makedirs(output_arg, exist_ok=True)
|
|
45
|
+
return os.path.join(output_arg, name + '.html')
|
|
46
|
+
|
|
47
|
+
# Treat as a direct file path (single-file mode)
|
|
48
|
+
return output_arg
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _process_file(f_in, meta_base):
|
|
52
|
+
"""Process a single LHTML file and return the HTML output."""
|
|
53
|
+
meta = dict(meta_base)
|
|
54
|
+
dir_to_include = os.path.dirname(os.path.abspath(f_in))
|
|
55
|
+
if dir_to_include:
|
|
56
|
+
meta['directory_include'] = meta.get('directory_include', []) + [dir_to_include + '/']
|
|
57
|
+
|
|
58
|
+
with open(f_in) as fid:
|
|
59
|
+
txt = _ensure_trailing_newline(fid.read())
|
|
60
|
+
|
|
61
|
+
return _ensure_trailing_newline(_pipeline.run(txt, meta))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main():
|
|
65
|
+
"""CLI entry point."""
|
|
66
|
+
parser = argparse.ArgumentParser(description='Lightweight HTML')
|
|
67
|
+
parser.add_argument('inputFiles', nargs='+', help='Input file(s)')
|
|
68
|
+
parser.add_argument('-w', '--wrapAuto',
|
|
69
|
+
help='Wrap content in basic HTML template',
|
|
70
|
+
action='store_true')
|
|
71
|
+
parser.add_argument('-o', '--output',
|
|
72
|
+
help='Output file (single input) or directory (multiple inputs)')
|
|
73
|
+
args = parser.parse_args()
|
|
74
|
+
|
|
75
|
+
meta = {'directory_include': [os.getcwd() + '/']}
|
|
76
|
+
if args.wrapAuto:
|
|
77
|
+
meta['wrap-auto'] = True
|
|
78
|
+
|
|
79
|
+
single_file = len(args.inputFiles) == 1
|
|
80
|
+
single_to_stdout = single_file and args.output is None
|
|
81
|
+
|
|
82
|
+
for f_in in args.inputFiles:
|
|
83
|
+
if not os.path.isfile(f_in):
|
|
84
|
+
print(f'Error: file not found [{f_in}]')
|
|
85
|
+
continue
|
|
86
|
+
|
|
87
|
+
html = _process_file(f_in, meta)
|
|
88
|
+
|
|
89
|
+
if single_to_stdout:
|
|
90
|
+
print(html)
|
|
91
|
+
else:
|
|
92
|
+
out_path = _output_path_for(f_in, args.output)
|
|
93
|
+
with open(out_path, 'w') as f_out:
|
|
94
|
+
f_out.write(html)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if __name__ == '__main__':
|
|
98
|
+
main()
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lhtml-markup
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Lightweight HTML markup language — simplifies HTML authoring with shorthand syntax
|
|
5
5
|
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/drohmer/lhtml
|
|
7
|
+
Project-URL: Repository, https://github.com/drohmer/lhtml
|
|
8
|
+
Project-URL: Issues, https://github.com/drohmer/lhtml/issues
|
|
6
9
|
Requires-Python: >=3.10
|
|
7
10
|
Description-Content-Type: text/markdown
|
|
8
11
|
License-File: LICENSE.md
|
|
@@ -16,23 +19,36 @@ Dynamic: license-file
|
|
|
16
19
|
|
|
17
20
|
# LHTML — Lightweight HTML
|
|
18
21
|
|
|
22
|
+
[](https://github.com/drohmer/lhtml/actions/workflows/tests.yml)
|
|
23
|
+
[](https://pypi.org/project/lhtml-markup/)
|
|
24
|
+
|
|
19
25
|
LHTML is a markup language that simplifies HTML authoring with embedded CSS styling. It is designed to be **HTML-first**: raw HTML passes through untouched, and only a few shorthand symbols (`::`, `*`, `=`, `**`, `__`) trigger conversions.
|
|
20
26
|
|
|
21
27
|
LHTML is used to build static websites and presentation slides, typically combined with Jinja2 templates.
|
|
22
28
|
|
|
23
29
|
## Installation
|
|
24
30
|
|
|
31
|
+
From PyPI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install lhtml-markup
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or from source:
|
|
38
|
+
|
|
25
39
|
```bash
|
|
40
|
+
git clone https://github.com/drohmer/lhtml.git
|
|
41
|
+
cd lhtml
|
|
26
42
|
pip install .
|
|
27
43
|
```
|
|
28
44
|
|
|
29
|
-
|
|
45
|
+
For development:
|
|
30
46
|
|
|
31
47
|
```bash
|
|
32
|
-
pip install -e .
|
|
48
|
+
pip install -e ".[dev]"
|
|
33
49
|
```
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
Dependencies (`lark`, `pygments`, `pyyaml`) are installed automatically.
|
|
36
52
|
|
|
37
53
|
|
|
38
54
|
## Quick Start
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"""LHTML command-line interface.
|
|
2
|
-
|
|
3
|
-
Usage:
|
|
4
|
-
lhtml [-w] inputFile [-o outputFile]
|
|
5
|
-
python -m lhtml [-w] inputFile [-o outputFile]
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import os
|
|
9
|
-
import argparse
|
|
10
|
-
|
|
11
|
-
from .pipeline import ProcessingPipeline
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_pipeline = ProcessingPipeline()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def _ensure_trailing_newline(text):
|
|
18
|
-
if text and text[-1] != '\n':
|
|
19
|
-
return text + '\n'
|
|
20
|
-
return text
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def main():
|
|
24
|
-
"""CLI entry point."""
|
|
25
|
-
parser = argparse.ArgumentParser(description='Lightweight HTML')
|
|
26
|
-
parser.add_argument('inputFile', help='Input filepath')
|
|
27
|
-
parser.add_argument('-w', '--wrapAuto',
|
|
28
|
-
help='Wrap content in basic HTML template',
|
|
29
|
-
action='store_true')
|
|
30
|
-
parser.add_argument('-o', '--outputFile', help='Output filepath')
|
|
31
|
-
args = parser.parse_args()
|
|
32
|
-
|
|
33
|
-
meta = {}
|
|
34
|
-
if args.wrapAuto:
|
|
35
|
-
meta['wrap-auto'] = True
|
|
36
|
-
|
|
37
|
-
meta['directory_include'] = [os.getcwd() + '/']
|
|
38
|
-
f_in = args.inputFile
|
|
39
|
-
|
|
40
|
-
if os.path.isfile(f_in):
|
|
41
|
-
dir_to_include = os.path.dirname(f_in)
|
|
42
|
-
if dir_to_include:
|
|
43
|
-
meta['directory_include'].append(
|
|
44
|
-
os.path.join(os.getcwd(), dir_to_include) + '/'
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
with open(f_in) as fid:
|
|
48
|
-
txt = _ensure_trailing_newline(fid.read())
|
|
49
|
-
|
|
50
|
-
html = _ensure_trailing_newline(_pipeline.run(txt, meta))
|
|
51
|
-
|
|
52
|
-
if args.outputFile:
|
|
53
|
-
with open(args.outputFile, 'w') as f_out:
|
|
54
|
-
f_out.write(html)
|
|
55
|
-
else:
|
|
56
|
-
print(html)
|
|
57
|
-
else:
|
|
58
|
-
print(f'Error: unrecognized input file [{f_in}]')
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if __name__ == '__main__':
|
|
62
|
-
main()
|
|
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
|