swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax    
built-in data type  

markup-region-event

 
 

Purpose

A markup-region-event triggers a rule when encountered by do markup-parse in a markup source. It is a markup-event that includes content; the most common example is an element with data content. A markup-region-event can be signalled as an argument of a pair of catch labels:

A markup region always starts with a #markup-start signal, and ends with a #markup-end signal. The markup-region-event argument of a pair of signals must be reference-equal. All data between the #markup-start and #markup-end signals is the markup region's content.

The following markup constructs are all represented by region events:

If a rule is fired from a markup region (using do markup-parse) the markup-region-event will be available from the rule as #current-markup-event, and the region's content as #content.

Example

Function wrap-content produces a new markup source from the markup source argument region-content and the markup-region-event argument region-boundary. The two arguments are combined into a new markup region, where region-content forms its content.

  define markup source function
     wrap-content           value markup source       region-content
                  in-region value markup-region-event region-boundary
  as
     signal throw #markup-start region-boundary
     output region-content
     signal throw #markup-end region-boundary
  
  
  ; This process rule prepares a markup-region-event for wrapping content.
  
  global markup-region-event root-element
  process
     using group "capture root element"
     do xml-parse scan "<wrapper/>"
        suppress
     done
  
  
  ; This process rule demonstrates a use of wrap-content
  
  process
     do xml-parse scan #main-input
        using group "process wrapped document"
        do markup-parse wrap-content #content in-region root-element
           output "%c"
        done
     done
  
  
  group "capture root element"
  element #implied
     set root-element to #current-markup-event
     suppress
  
  group "process wrapped document"
  element #implied
     output "<%q>%c></%q>%n"

    Related Syntax
 
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:51:21 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.