-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This project now uses HTML as the base languages instead of XML.
XML is too strict.
- Loading branch information
Showing
6 changed files
with
37 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,15 @@ build-backend = "setuptools.build_meta" | |
[project] | ||
name = "auxml" | ||
version = "0.1.0" | ||
dependencies = [ "lxml", "pytest", "pudb", "pytest-watcher", "xmldiff", "livereload" ] | ||
dependencies = [ | ||
"lxml", | ||
"pytest", | ||
"pudb", | ||
"pytest-watcher", | ||
"xmldiff", | ||
"livereload", | ||
"beautifulsoup4", | ||
] | ||
requires-python = ">=3.8" | ||
authors = [ {name = "Derek A. Rhodes", email = "[email protected]"} ] | ||
description = "An author friendly macro system for XML" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
from lxml import etree | ||
|
||
from bs4 import BeautifulSoup | ||
_html_parser = etree.HTMLParser(remove_blank_text=True, remove_comments=True) | ||
_xml_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True) | ||
|
||
def parse_html_file(fname): | ||
tree = etree.parse(fname, _html_parser) | ||
return tree.getroot() | ||
text = open(fname).read() | ||
soup = BeautifulSoup(text, "html.parser") | ||
tree = etree.fromstring(str(soup), _xml_parser) | ||
return tree | ||
|
||
def parse_xml_file(fname): | ||
tree = etree.parse(fname, _xml_parser) | ||
return tree.getroot() | ||
# def parse_xml_file(fname): | ||
# tree = etree.parse(fname, _xml_parser) | ||
# return tree.getroot() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<macros> | ||
<define-macro name="weird"> | ||
<head> | ||
<div>&</div> | ||
<div></div> | ||
</head> | ||
</define-macro> | ||
</macros> | ||
|