<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Example</title><link>https://sourceforge.net/p/markup-referent/wiki/Example/</link><description>Recent changes to Example</description><atom:link href="https://sourceforge.net/p/markup-referent/wiki/Example/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 16 May 2013 18:52:08 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/markup-referent/wiki/Example/feed" rel="self" type="application/rss+xml"/><item><title>Example modified by OmniMark Code</title><link>https://sourceforge.net/p/markup-referent/wiki/Example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,7 +1,7 @@
 Example 
 ========

-Let us now see how this [interface](../Interface) could be used. For an example problem, suppose we have an marked-up input  document containing a sequence of sections. We need to enrich each section by prepending to its content two links  to the previous and the following section.  
+Let us now see how this [interface](../Interface) could be used. For an example problem, suppose we have a marked-up input document containing a sequence of sections. We need to enrich each section by prepending to its content two links  to the previous and the following section.  

 Here is what the main function would look like:  

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">OmniMark Code</dc:creator><pubDate>Thu, 16 May 2013 18:52:08 -0000</pubDate><guid>https://sourceforge.net2ded1e3e846e56a45a8817c70d001ea9d31e9e0b</guid></item><item><title>WikiPage Example modified by OmniMark Code</title><link>https://sourceforge.net/p/markup-referent/wiki/Example/</link><description>&lt;pre&gt;--- v2 
+++ v3 
@@ -5,61 +5,61 @@
 
 Here is what the main function would look like:  
 
-&lt;pre&gt;
-global integer section-count
-
-define markup source function
-   insert-neighbour-links (value markup source sections)
-as
-   using output as resolve-referents into #current-output
-   do markup-parse sections
-      output "%c"
-      using output as referent ("Section " || "d" % section-count + 1)
-         output ""
-   done
-    
-&lt;/pre&gt;
-
+&lt;div class="codehilite"&gt;&lt;pre&gt;
+&lt;span class="kr"&gt;global&lt;/span&gt; &lt;span class="kr"&gt;integer&lt;/span&gt; section-count
+&amp;nbsp;
+&lt;span class="kr"&gt;define&lt;/span&gt; &lt;span class="kr"&gt;markup&lt;/span&gt; &lt;span class="kr"&gt;source&lt;/span&gt; &lt;span class="kr"&gt;function&lt;/span&gt;
+   insert-neighbour-links (&lt;span class="kr"&gt;value&lt;/span&gt; &lt;span class="kr"&gt;markup&lt;/span&gt; &lt;span class="kr"&gt;source&lt;/span&gt; sections)
+&lt;span class="kr"&gt;as&lt;/span&gt;
+   &lt;span class="kr"&gt;using&lt;/span&gt; &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="kr"&gt;as&lt;/span&gt; resolve-referents &lt;span class="kr"&gt;into&lt;/span&gt; &lt;span class="nb"&gt;#current-output&lt;/span&gt;
+   &lt;span class="kr"&gt;do&lt;/span&gt; &lt;span class="kr"&gt;markup-parse&lt;/span&gt; sections
+      &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="s"&gt;"%c"&lt;/span&gt;
+      &lt;span class="kr"&gt;using&lt;/span&gt; &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="kr"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;referent&lt;/span&gt; (&lt;span class="s"&gt;"Section "&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s"&gt;"d"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; section-count &lt;span class="o"&gt;+&lt;/span&gt; 1)
+         &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;
+   &lt;span class="kr"&gt;done&lt;/span&gt;
+    
+&lt;/pre&gt;&lt;/div&gt;
+
 The `resolve-referents` function call establishes the referent resolution scope and begins buffering all the  referents written into its result sink. These referents will be written and their values set by the rules invoked  by the `output "%c"` action. The following `using output as referent` action sets one referent value that has not  been set by the rules.  
 
 This filter function could be invoked in the following way:  
 
-&lt;pre&gt;
-global dtd target-dtd
-
-process
-   do xml-parse document scan #main-input
-      set target-dtd to #current-dtd
-      output xml.written from insert-neighbour-links (#content)
-   done
-    
-&lt;/pre&gt;
+&lt;div class="codehilite"&gt;&lt;pre&gt;
+&lt;span class="kr"&gt;global&lt;/span&gt; &lt;span class="kr"&gt;dtd&lt;/span&gt; target-dtd
+&amp;nbsp;
+&lt;span class="kr"&gt;process&lt;/span&gt;
+   &lt;span class="kr"&gt;do&lt;/span&gt; &lt;span class="kr"&gt;xml-parse&lt;/span&gt; &lt;span class="kr"&gt;document&lt;/span&gt; &lt;span class="kr"&gt;scan&lt;/span&gt; &lt;span class="nb"&gt;#main-input&lt;/span&gt;
+      &lt;span class="kr"&gt;set&lt;/span&gt; target-dtd &lt;span class="kr"&gt;to&lt;/span&gt; &lt;span class="nb"&gt;#current-dtd&lt;/span&gt;
+      &lt;span class="kr"&gt;output&lt;/span&gt; xml.written &lt;span class="kr"&gt;from&lt;/span&gt; insert-neighbour-links (&lt;span class="nb"&gt;#content&lt;/span&gt;)
+   &lt;span class="kr"&gt;done&lt;/span&gt;
+    
+&lt;/pre&gt;&lt;/div&gt;
 
 Since the function `insert-neighbour-links` operates on a markup stream, we could just as easily invoke it on an  SGML document, simply by replacing `xml-parse` by `sgml-parse` in the above rule.  
 
 The rule that emits all the referents and sets their values would be the following one:  
 
-&lt;pre&gt;
-element "section"
-   local markup-element-event link initial { create-element-event (declared-elements of target-dtd){"link"}
-                                                       attributes { attribute "id" with key "link-end" }
-                                           }
-
-   increment section-count
-   using output as referent ("Section " || "d" % section-count)
-   do
-       signal throw #markup-start link
-       output "Section %d(section-count): %v(title)"
-       signal throw #markup-end link
-   done
-
-   signal throw #markup-start #current-markup-event
-   output referent ("Section " || "d" % section-count - 1)
-      when section-count &gt; 1
-   output referent ("Section " || "d" % section-count + 1)
-   output #content
-   signal throw #markup-end #current-markup-event
-    
-&lt;/pre&gt;
+&lt;div class="codehilite"&gt;&lt;pre&gt;
+&lt;span class="kr"&gt;element&lt;/span&gt; &lt;span class="s"&gt;"section"&lt;/span&gt;
+   &lt;span class="kr"&gt;local&lt;/span&gt; markup-element-event link &lt;span class="kr"&gt;initial&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="kr"&gt;create-element-event&lt;/span&gt; (&lt;span class="kr"&gt;declared-elements&lt;/span&gt; &lt;span class="kr"&gt;of&lt;/span&gt; target-dtd)&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s"&gt;"link"&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
+                                                       &lt;span class="kr"&gt;attributes&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="kr"&gt;attribute&lt;/span&gt; &lt;span class="s"&gt;"id"&lt;/span&gt; &lt;span class="kr"&gt;with&lt;/span&gt; &lt;span class="kr"&gt;key&lt;/span&gt; &lt;span class="s"&gt;"link-end"&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
+                                           &lt;span class="o"&gt;}&lt;/span&gt;
+&amp;nbsp;
+   &lt;span class="kr"&gt;increment&lt;/span&gt; section-count
+   &lt;span class="kr"&gt;using&lt;/span&gt; &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="kr"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;referent&lt;/span&gt; (&lt;span class="s"&gt;"Section "&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s"&gt;"d"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; section-count)
+   &lt;span class="kr"&gt;do&lt;/span&gt;
+       &lt;span class="kr"&gt;signal&lt;/span&gt; &lt;span class="kr"&gt;throw&lt;/span&gt; &lt;span class="nb"&gt;#markup-start&lt;/span&gt; link
+       &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="s"&gt;"Section %d(section-count): %v(title)"&lt;/span&gt;
+       &lt;span class="kr"&gt;signal&lt;/span&gt; &lt;span class="kr"&gt;throw&lt;/span&gt; &lt;span class="nb"&gt;#markup-end&lt;/span&gt; link
+   &lt;span class="kr"&gt;done&lt;/span&gt;
+&amp;nbsp;
+   &lt;span class="kr"&gt;signal&lt;/span&gt; &lt;span class="kr"&gt;throw&lt;/span&gt; &lt;span class="nb"&gt;#markup-start&lt;/span&gt; &lt;span class="nb"&gt;#current-markup-event&lt;/span&gt;
+   &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="kr"&gt;referent&lt;/span&gt; (&lt;span class="s"&gt;"Section "&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s"&gt;"d"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; section-count &lt;span class="o"&gt;-&lt;/span&gt; 1)
+      &lt;span class="kr"&gt;when&lt;/span&gt; section-count &lt;span class="o"&gt;&gt;&lt;/span&gt; 1
+   &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="kr"&gt;referent&lt;/span&gt; (&lt;span class="s"&gt;"Section "&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s"&gt;"d"&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; section-count &lt;span class="o"&gt;+&lt;/span&gt; 1)
+   &lt;span class="kr"&gt;output&lt;/span&gt; &lt;span class="nb"&gt;#content&lt;/span&gt;
+   &lt;span class="kr"&gt;signal&lt;/span&gt; &lt;span class="kr"&gt;throw&lt;/span&gt; &lt;span class="nb"&gt;#markup-end&lt;/span&gt; &lt;span class="nb"&gt;#current-markup-event&lt;/span&gt;
+    
+&lt;/pre&gt;&lt;/div&gt;
 
 The referent-related parts of this rule look the same as they would with the built-in OmniMark referents. The  only difference is in the body of the `using output as referent` scope: it emits a stream not only of plain  strings like `"Section"`, but markup events as well. In other words, it produces a markup stream, and this stream  becomes the new referent value. 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">OmniMark Code</dc:creator><pubDate>Mon, 14 May 2012 15:25:51 -0000</pubDate><guid>https://sourceforge.netf9f60ad44517092cfdf0e91b6d0e40de69de5d29</guid></item><item><title>WikiPage Example modified by OmniMark Code</title><link>https://sourceforge.net/p/markup-referent/wiki/Example/</link><description>&lt;pre&gt;--- v1 
+++ v2 
@@ -1,7 +1,7 @@
 Example 
 ========
 
-Let us now see how this interface could be used. For an example problem, suppose we have an marked-up input  document containing a sequence of sections. We need to enrich each section by prepending to its content two links  to the previous and the following section.  
+Let us now see how this [interface](../Interface) could be used. For an example problem, suppose we have an marked-up input  document containing a sequence of sections. We need to enrich each section by prepending to its content two links  to the previous and the following section.  
 
 Here is what the main function would look like:  
 
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">OmniMark Code</dc:creator><pubDate>Fri, 11 May 2012 17:49:12 -0000</pubDate><guid>https://sourceforge.net9f5ce095b9138e10fdb89c4147610ef07ab5a2fe</guid></item><item><title>WikiPage Example modified by OmniMark Code</title><link>https://sourceforge.net/p/markup-referent/wiki/Example/</link><description>Example 
========

Let us now see how this interface could be used. For an example problem, suppose we have an marked-up input  document containing a sequence of sections. We need to enrich each section by prepending to its content two links  to the previous and the following section.  

Here is what the main function would look like:  

&lt;pre&gt;
global integer section-count

define markup source function
   insert-neighbour-links (value markup source sections)
as
   using output as resolve-referents into #current-output
   do markup-parse sections
      output "%c"
      using output as referent ("Section " || "d" % section-count + 1)
         output ""
   done
    
&lt;/pre&gt;

The `resolve-referents` function call establishes the referent resolution scope and begins buffering all the  referents written into its result sink. These referents will be written and their values set by the rules invoked  by the `output "%c"` action. The following `using output as referent` action sets one referent value that has not  been set by the rules.  

This filter function could be invoked in the following way:  

&lt;pre&gt;
global dtd target-dtd

process
   do xml-parse document scan #main-input
      set target-dtd to #current-dtd
      output xml.written from insert-neighbour-links (#content)
   done
    
&lt;/pre&gt;

Since the function `insert-neighbour-links` operates on a markup stream, we could just as easily invoke it on an  SGML document, simply by replacing `xml-parse` by `sgml-parse` in the above rule.  

The rule that emits all the referents and sets their values would be the following one:  

&lt;pre&gt;
element "section"
   local markup-element-event link initial { create-element-event (declared-elements of target-dtd){"link"}
                                                       attributes { attribute "id" with key "link-end" }
                                           }

   increment section-count
   using output as referent ("Section " || "d" % section-count)
   do
       signal throw #markup-start link
       output "Section %d(section-count): %v(title)"
       signal throw #markup-end link
   done

   signal throw #markup-start #current-markup-event
   output referent ("Section " || "d" % section-count - 1)
      when section-count &gt; 1
   output referent ("Section " || "d" % section-count + 1)
   output #content
   signal throw #markup-end #current-markup-event
    
&lt;/pre&gt;

The referent-related parts of this rule look the same as they would with the built-in OmniMark referents. The  only difference is in the body of the `using output as referent` scope: it emits a stream not only of plain  strings like `"Section"`, but markup events as well. In other words, it produces a markup stream, and this stream  becomes the new referent value. 
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">OmniMark Code</dc:creator><pubDate>Fri, 11 May 2012 17:26:33 -0000</pubDate><guid>https://sourceforge.netd37fba3a44403efc8240f9e4376db0b5d1efda77</guid></item></channel></rss>