tractatus/pptx-env/lib/python3.12/site-packages/pptx/oxml/action.py
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

53 lines
1.6 KiB
Python

"""lxml custom element classes for text-related XML elements."""
from __future__ import annotations
from pptx.oxml.simpletypes import XsdString
from pptx.oxml.xmlchemy import BaseOxmlElement, OptionalAttribute
class CT_Hyperlink(BaseOxmlElement):
"""Custom element class for <a:hlinkClick> elements."""
rId: str = OptionalAttribute("r:id", XsdString) # pyright: ignore[reportAssignmentType]
action: str | None = OptionalAttribute( # pyright: ignore[reportAssignmentType]
"action", XsdString
)
@property
def action_fields(self) -> dict[str, str]:
"""Query portion of the `ppaction://` URL as dict.
For example `{'id':'0', 'return':'true'}` in 'ppaction://customshow?id=0&return=true'.
Returns an empty dict if the URL contains no query string or if no action attribute is
present.
"""
url = self.action
if url is None:
return {}
halves = url.split("?")
if len(halves) == 1:
return {}
key_value_pairs = halves[1].split("&")
return dict([pair.split("=") for pair in key_value_pairs])
@property
def action_verb(self) -> str | None:
"""The host portion of the `ppaction://` URL contained in the action attribute.
For example 'customshow' in 'ppaction://customshow?id=0&return=true'. Returns |None| if no
action attribute is present.
"""
url = self.action
if url is None:
return None
protocol_and_host = url.split("?")[0]
host = protocol_and_host[11:]
return host