catch name

#markup-point event


Use #markup-point to signal a markup-point-event to a do markup-parse.

In the following example, page breaks are inserted following every section element. The page breaks are represented as processing instructions. In the function insert-page-breaks, a markup-point-event containing the necessary processing instruction is prepared by invoking do xml-parse on an otherwise empty input instance, and storing the markup-point-event that is created. The element rule for section inserts this markup-point-event after every section element. The result is a markup event stream which is identical to the original, save that every section element event is followed by a processing instruction event (that is, a markup-point-event) representing a page break.

  global markup-point-event page-break-instruction
  define markup source function
     insert-page-breaks value markup source input-markup
     do xml-parse scan "<?page-break?>"
        void #content take any*
      catch #markup-point event
        void #content
        set page-break-instruction to event
     do markup-parse input-markup
        output "%c"
  element "section"
     signal throw #markup-start #current-markup-event
     output #content
     signal throw #markup-end #current-markup-event
     signal throw #markup-point page-break-instruction
  element #implied
     signal throw #markup-start #current-markup-event
     output "%c"
     signal throw #markup-end #current-markup-event

Related Syntax
Related Concepts