MCPcopy Create free account
hub / github.com/PageBot/PageBot / node_caption

Method node_caption

Lib/pagebot/base/typesetter.py:412–425  ·  view source on GitHub ↗

If self.currentImage is set, then redirect output of the caption nodes into the image, instead of the self.galley. Otherwise just output as plain text, ignoring the caption tag. Multiple captions are added to the the current image until it is changed. The caption tag is trigg

(self, node, e)

Source from the content-addressed store, hash-verified

410 context=self.context)
411
412 def node_caption(self, node, e):
413 """If self.currentImage is set, then redirect output of the caption
414 nodes into the image, instead of the self.galley. Otherwise just output
415 as plain text, ignoring the caption tag. Multiple captions are added to
416 the the current image until it is changed. The caption tag is triggered
417 by *[[...]]* in MarkDown.
418 """
419 if self.currentImage is not None: # In a current image exists, attach caption to it.
420 savedGalley = self.galley # Temporary redirect node parent
421 self.galley = self.currentImage
422 self.typesetNode(node, e)
423 self.galley = savedGalley
424 else:
425 self.typesetNode(node, e)
426
427 def node_code(self, node, e):
428 """Creates a NodeBlock element that contains the code source, to be

Callers

nothing calls this directly

Calls 1

typesetNodeMethod · 0.95

Tested by

no test coverage detected