module documentation

_zreferableitem.py - ZMS Referable Item Mixin for Internal Reference Handling and Link Validation

Defines ZReferableItem for object persistence, Zope integration, and container protocols. It implements Zope's ObjectManager interface, handles acquisition, and manages object lifecycle.

License: GNU General Public License v2 or later, Organization: ZMS Publishing

Class ZReferableItem Mixin for internal reference handling in ZMS objects.
Function getInlineRefs Extracts internal link references from inline HTML content.
Function getInternalLinkDict Resolves an internal link and returns a dictionary with link metadata.
Function getInternalLinkUrl Resolves the internal index_html URL for a given object and internal link.
Function isInternalLink Checks if the given URL is an internal link.
Function isMailLink Checks if the given URL is a mailto link.
Constant _INLINE_LINK_ATTR_RE Undocumented
Constant _INLINE_LINK_TAGS Undocumented
def getInlineRefs(text): (source)

Extracts internal link references from inline HTML content.

Parameters
text:strThe HTML content.
Returns
listInternal link identifiers found in anchor tags.
def getInternalLinkDict(self, url): (source)

Resolves an internal link and returns a dictionary with link metadata.

Parameters
self:objectThe object context.
url:strThe internal link to resolve.
Returns
dictMetadata about the internal link such as data-id, data-url, and data-target.
def getInternalLinkUrl(self, url, ob): (source)

Resolves the internal index_html URL for a given object and internal link.

Parameters
self:objectThe object context.
url:strThe internal link.
ob:objectThe referenced object.
Returns
strThe resolved index_html URL.
def isInternalLink(url): (source)

Checks if the given URL is an internal link.

Parameters
url:strThe URL to check.
Returns
boolTrue if the URL is in the internal link format {$...}, False otherwise.
def isMailLink(url): (source)

Checks if the given URL is a mailto link.

Parameters
url:strThe URL to check.
Returns
boolTrue if the URL starts with mailto:, False otherwise.
_INLINE_LINK_ATTR_RE = (source)

Undocumented

Value
re.compile(r'\s(.*?)="(.*?)"')
_INLINE_LINK_TAGS = (source)

Undocumented

Value
((re.compile(r'<a(.*?)>'), 'href', '<a'),
 (re.compile(r'<img(.*?)>'), 'src', '<img'))