Skip to content

Commit

Permalink
Merge pull request #72 from Starou/ticket_71_border_color
Browse files Browse the repository at this point in the history
Ticket 71 border color
  • Loading branch information
Starou committed Jan 11, 2024
2 parents 3c38b38 + a399e8f commit 5315527
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.rst
Expand Up @@ -457,6 +457,11 @@ installed in your PATH.
Revisions
=========

1.1.7
-----

- Manage border color in styles when composing documents.

1.1.5
-----

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -9,7 +9,7 @@

setup(
name="SimpleIDML",
version="1.1.6",
version="1.1.7",
license='BSD Licence',
author='Stanislas Guerra',
author_email='stanislas.guerra@gmail.com',
Expand Down
2 changes: 1 addition & 1 deletion src/simple_idml/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

VERSION = "1.1.6"
VERSION = "1.1.7"
IdPkgNS = "http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging"
BACKINGSTORY = "XML/BackingStory.xml"

Expand Down
10 changes: 9 additions & 1 deletion src/simple_idml/components.py
Expand Up @@ -51,6 +51,10 @@ class IDMLXMLFile():
"NextTextFrame",
"PreviousTextFrame",
)
prefixable_content_tags = (
'ParagraphShadingColor',
'ParagraphBorderColor',
)

def __init__(self, idml_package, working_copy_path=None):
self.idml_package = idml_package
Expand Down Expand Up @@ -141,6 +145,8 @@ def prefix_references(self, prefix):
for elt in self.dom.iter():
if elt.tag in self.excluded_tags_for_prefix:
continue
if elt.tag in self.prefixable_content_tags and elt.text:
elt.text = f"{prefix}{elt.text}"
for attr in self.prefixable_attrs:
if elt.get(attr):
if attr in ['NextTextFrame', 'PreviousTextFrame'] and elt.get(attr) == 'n':
Expand Down Expand Up @@ -900,13 +906,15 @@ def clone_style_range(self):
"Ligatures",
"OTFContextualAlternate",
"BaselineShift",
"ParagraphShadingColor",
"ParagraphBorderColor",
]

for attr in attrs:
if style_node.get(attr) is not None:
style_range_node.set(attr, style_node.get(attr))

for attr in ("Leading", "AppliedFont"):
for attr in ("Leading", "AppliedFont", "ParagraphShadingColor", "ParagraphBorderColor"):
path = f"Properties/{attr}"
attr_node = style_node.find(path)
if attr_node is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/simple_idml/idml.py
Expand Up @@ -334,7 +334,7 @@ def _apply_parent_style_range(style_range_node, applied_style_node, parent):
if parent_style_node.get(attr) is not None and (applied_style_node is None or not applied_style_node.get(attr)):
style_range_node.set(attr, parent_style_node.get(attr))

for attr in ("Leading", "AppliedFont"):
for attr in ("Leading", "AppliedFont", "ParagraphShadingColor", "ParagraphBorderColor"):
path = f"Properties/{attr}"
parent_attr_node = parent_style_node.find(path)
attr_node = applied_style_node.find(path) is not None if applied_style_node is not None else None
Expand Down

0 comments on commit 5315527

Please sign in to comment.