Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: ci

on:
pull_request:
branches: [ master ]
branches:
- master
- develop
push:
branches:
- master
Expand All @@ -17,11 +19,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
Expand Down
28 changes: 15 additions & 13 deletions tests/unitutil/cxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pyparsing import (
Combine,
DelimitedList,
Forward,
Group,
Literal,
Expand All @@ -18,10 +19,9 @@
Word,
alphanums,
alphas,
dblQuotedString,
delimitedList,
removeQuotes,
stringEnd,
dbl_quoted_string,
remove_quotes,
string_end,
)

from pptx.oxml import parse_xml
Expand All @@ -43,8 +43,8 @@ def element(cxel_str: str) -> BaseOxmlElement:

def xml(cxel_str: str) -> str:
"""Return the XML generated from `cxel_str`."""
root_node.parseWithTabs()
root_token = root_node.parseString(cxel_str)
root_node.parse_with_tabs()
root_token = root_node.parse_string(cxel_str)
xml = root_token.element.xml
return xml

Expand Down Expand Up @@ -254,28 +254,30 @@ def grammar():
attr_name = Word(alphas + ":")
attr_val = Word(alphanums + " %-./:_")
attr_def = Group(attr_name + equal + attr_val)
attr_list = open_brace + delimitedList(attr_def) + close_brace
attr_list = open_brace + DelimitedList(attr_def) + close_brace

text = dblQuotedString.setParseAction(removeQuotes)
text = dbl_quoted_string.set_parse_action(remove_quotes)

# w:jc{val=right} ----------------------------
element = (
tagname("tagname")
+ Group(Optional(attr_list))("attr_list")
+ Optional(text, default="")("text")
).setParseAction(Element.from_token)
).set_parse_action(Element.from_token)

child_node_list = Forward()

node = Group(
element("element") + Group(Optional(slash + child_node_list))("child_node_list")
).setParseAction(connect_node_children)
).set_parse_action(connect_node_children)

child_node_list << (open_paren + delimitedList(node) + close_paren | node)
child_node_list << (open_paren + DelimitedList(node) + close_paren | node)

root_node = (
element("element") + Group(Optional(slash + child_node_list))("child_node_list") + stringEnd
).setParseAction(connect_root_node_children)
element("element")
+ Group(Optional(slash + child_node_list))("child_node_list")
+ string_end
).set_parse_action(connect_root_node_children)

return root_node

Expand Down