MCPcopy Create free account
hub / github.com/scanny/python-pptx / relative_ref

Method relative_ref

src/pptx/opc/packuri.py:86–94  ·  view source on GitHub ↗

Return string containing relative reference to package item from `baseURI`. E.g. PackURI("/ppt/slideLayouts/slideLayout1.xml") would return "../slideLayouts/slideLayout1.xml" for baseURI "/ppt/slides".

(self, baseURI: str)

Source from the content-addressed store, hash-verified

84 return self[1:]
85
86 def relative_ref(self, baseURI: str) -> str:
87 """Return string containing relative reference to package item from `baseURI`.
88
89 E.g. PackURI("/ppt/slideLayouts/slideLayout1.xml") would return
90 "../slideLayouts/slideLayout1.xml" for baseURI "/ppt/slides".
91 """
92 # workaround for posixpath bug in 2.6, doesn't generate correct
93 # relative path when `start` (second) parameter is root ("/")
94 return self[1:] if baseURI == "/" else posixpath.relpath(self, baseURI)
95
96 @property
97 def rels_uri(self) -> PackURI:

Callers 2

target_refMethod · 0.80

Calls

no outgoing calls

Tested by 1