• Documentation
  • Grimm
  • API References

API References

Functions

clean_syntax(content)

This function is used to clean the syntax of the content (for Wikipedia markup only).

from grimm import clean_syntax
 
text, external_links, internal_links, images = clean_syntax(content)

Parameters

NameTypeDescription
contentstrThe content to clean.

Returns

This function will return a tuple of four items.

NameTypeDescription
textstrThe cleaned text.
external_linkslist[[int, int, any]]The external links in the text.
internal_linkslist[[int, int, any]]The internal links in the text.
imageslist[[int, int, any]]The links of images in the text.

For external_links, internal_links, and images, the third item in the tuple is the link itself (generally string). The first two items in the tuple are the start index (inclusive) and end index (exclusive) of the link in the text.

Last updated on December 7, 2022