# HG changeset patch
# User Bryan O'Sullivan <bos@serpentine.com>
# Date 1238527102 25200
# Node ID c82ff69f0935062cbf1820d3896e1f554a4262af
# Parent  c17f8bffc9e50022296d3ce507616dd743cf6371
Add markers to flag included snippets of code.

diff -r c17f8bffc9e5 -r c82ff69f0935 en/examples/run-example
--- a/en/examples/run-example	Tue Mar 31 09:04:23 2009 -0700
+++ b/en/examples/run-example	Tue Mar 31 12:18:22 2009 -0700
@@ -127,9 +127,11 @@
         s = open(self.name).read().rstrip()
         s = s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
         ofp = wopen(result_name(self.name + '.tmp'))
+        ofp.write('<!-- BEGIN %s -->\n' % self.name)
         ofp.write('<programlisting>')
         ofp.write(s)
         ofp.write('</programlisting>\n')
+        ofp.write('<!-- END %s -->\n' % self.name)
         ofp.close()
         self.rename_output(self.name)
         norm = self.name.replace(os.sep, '-')
@@ -309,6 +311,7 @@
                             assert os.sep not in out
                             if ofp is not None:
                                 ofp.write('</screen>\n')
+                                ofp.write('<!-- END %s -->\n' % ofp_basename)
                                 ofp.close()
                                 err |= self.rename_output(ofp_basename, ignore)
                             if out:
@@ -320,6 +323,7 @@
                                     % (norm, norm)] = 1
                                 read_hint = ofp_basename + ' '
                                 ofp = wopen(result_name(ofp_basename + '.tmp'))
+                                ofp.write('<!-- BEGIN %s -->\n' % ofp_basename)
                                 ofp.write('<screen>')
                             else:
                                 ofp = None
@@ -333,7 +337,8 @@
                         # first, print the command we ran
                         if not hunk.startswith('#'):
                             nl = hunk.endswith('\n')
-                            hunk = ('<prompt>%s</prompt> <userinput>%s</userinput>' %
+                            hunk = ('<prompt>%s</prompt> '
+                                    '<userinput>%s</userinput>' %
                                     (prompts[ps],
                                      xml_escape(hunk.rstrip('\n'))))
                             if nl: hunk += '\n'
@@ -353,6 +358,7 @@
                     if ofp is not None:
                         ofp.write(output)
                         ofp.write('</screen>\n')
+                        ofp.write('<!-- END %s -->\n' % ofp_basename)
                         ofp.close()
                         err |= self.rename_output(ofp_basename, ignore)
                     os.close(self.cfd)
@@ -379,7 +385,7 @@
     print >> sys.stderr, 'Options:'
     print >> sys.stderr, '  -a --all       run all examples in this directory'
     print >> sys.stderr, '  -h --help      print this help message'
-    print >> sys.stderr, '     --help      keep new output as desired output'
+    print >> sys.stderr, '     --keep      keep new output as desired output'
     print >> sys.stderr, '  -v --verbose   display extra debug output'
     sys.exit(exit)