home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pub / public_html / ksitemap.html < prev    next >
Encoding:
Extensible Markup Language  |  2020-01-01  |  21.1 KB  |  719 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html lang="en">
  3. <head>
  4. <title>
  5. Kermit sitemap script
  6. </title>
  7. <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  8. <META http-equiv="Content-Style-Type" content="text/css">
  9. <LINK REL=STYLESHEET TYPE="text/css" HREF="kermit.css">
  10. <LINK REL="shortcut icon" href="favicon.ico" >
  11. <style type="text/css">
  12.   ul li { padding-bottom:9;padding-right:64;line-height:12.5pt; }
  13.   h2, h3 { font-family: sans-serif }
  14.   h3 { margin-left:-8; border-top: 2px solid #999999 }
  15.   ul.contents li { line-height:10pt; font-family:sans-serif; }
  16.   .nu { text-decoration:none }
  17.   tt,pre { font-size:10.5pt }
  18.   dl.loose dd { padding:0 0 8 0 }
  19.   blockquote.example { margin-top:6; margin-bottom:8 }
  20.   blockquote.boxed { border:1px solid grey; padding:0 12 8 12 }
  21.   body { color:black; background:white; margin:0; font-size:12pt">
  22.   
  23.  
  24. </style>
  25. </head>
  26.  
  27. <body>
  28.  
  29. <table cellpadding=0 cellspacing=0 width="100%"
  30.  style="border:1px solid darkmagenta; background-color:white;">
  31.  
  32. <tr style="background-image:url('lb3.jpg');">
  33. <td style="padding:8 8 8 8">
  34. <a style="text-decoration:none"
  35.  href="http://www.columbia.edu"><img
  36.  border=0
  37.  alt="The Columbia Crown"
  38.  title="The Columbia Crown (crown of King George II)"
  39.  height=105
  40.  src="crownico.gif"></a>
  41. <td align="left" style="padding-top:23">
  42. <tt style="font-size:24pt"><b>The Kermit Project</b></tt> |
  43. <span style="font-family:Ariel,times; font-size:18pt"><i>Columbia
  44.  University</i></span>
  45. <br><span style="font-family:Ariel,times; font-size:14pt">
  46. 612 West 115th Street, New York NY 10025 USA •
  47. <a href="mailto:kermit@columbia.edu">kermit@columbia.edu</a>
  48. </span>
  49. <table width="100%">
  50. <tr>
  51. <td style="font-size:12pt; font-style:italic">…since
  52.  <small>1981</small></div>
  53. </table>
  54.  
  55. <tr>
  56. <td colspan=2 style="padding:0">
  57. <table class=menu cellpadding=0 cellspacing=0
  58.  width="100%" style="border-top:1px solid darkmagenta">
  59. <tr>
  60. <td onClick="document.location.href='index.html';"
  61.  title="Kermit Project Home Page"
  62.  style="cursor:pointer"><a href="index.html">Home</a>
  63. <td onClick="document.location.href='k95.html';"
  64.  title="Kermit 95 for Windows"
  65.  style="cursor:pointer"><a href="k95.html">Kermit 95</a>
  66. <td class=this onClick="document.location.href='ckermit.html';"
  67.  title="C-Kermit for Unix and VMS"
  68.  style="cursor:pointer"><a href="ckermit.html">C-Kermit</a>
  69. <td onClick="document.location.href='ckscripts.html';"
  70.  title="Kermit Script Language and Tutorial"
  71.  style="cursor:pointer"><a href="ckscripts.html">Scripts</a>
  72. <td onClick="document.location.href='current.html';"
  73.  title="Current Versions of Kermit Software"
  74.  style="cursor:pointer"><a href="current.html">Current</a>
  75. <td onClick="document.location.href='whatsnew.html';"
  76.  title="What's New"
  77.  style="cursor:pointer"><a href="whatsnew.html">New</a>
  78. <td onClick="document.location.href='faq.html';"
  79.  title="Frequently Asked Questions"
  80.  style="cursor:pointer"><a href="faq.html">FAQ</a>
  81. <td onClick="document.location.href='support.html';"
  82.  style="border-right:0"
  83.  title="Kermit Software Support"
  84.  style="cursor:pointer"><a href="support.html">Support</a>
  85. </table>
  86. </table>
  87.  
  88. <div style="font-family:calibri,sans-serif,times">
  89. <div class=normalmargins style="padding-top:4">
  90.  
  91. <h2>C-Kermit 9.0 Sitemap Script</h2>
  92.  
  93. <blockquote style="margin-top:8">
  94. Frank da Cruz<br>
  95. The Kermit Project<br>
  96. Columbia University<br>
  97. <i>Last update:</i>
  98. Tue Jun 28 12:22:01 2011
  99. </blockquote>
  100.  
  101. <!--
  102. <form class=contents>
  103. <fieldset>
  104. <legend>Contents</legend>
  105. <ul>
  106. <li><a href="#record"><b>Reading a CSV or TSV Record and Converting it
  107.  to an Array</b></a>
  108. <li><a href="#join"><b>Using \fjoin() to create a
  109.  Comma- or Tab-Separated Value List from an Array</b></a>
  110. <li><a href="#file"><b>Using CSV or TSV Files</b></a>
  111. </ul>
  112. </fieldset>
  113. </form>
  114. <p>
  115. -->
  116.  
  117.  
  118.  
  119. <blockquote class=boxed style="background:#eeeeee">
  120. <table>
  121. <tr>
  122. <td><b>Download</b>:  
  123. <td><a href="http://kermit.columbia.edu/ftp/scripts/ckermit/ksitemap">http://kermit.columbia.edu/ftp/scripts/ckermit/ksitemap</a>
  124. <tr>
  125. <td><b>Requires</b>:  
  126. <td><a href="ck90.html"><b>C-Kermit 9.0</b></a>.
  127. </table>
  128. </blockquote>
  129.  
  130. <p>
  131. <div class=normalmargins>
  132.  
  133. The <b>ksitemap</b> script builds a sitemap.xml file for a website based on
  134. a data file that you provide listing the files and (using <a
  135. href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636">Google
  136. Sitemap Image Extensions</a>) images you wish to include in your sitemap,
  137. along with their properties, so that search engines like Google, Yahoo,
  138. Bing, and Ask can index them better.  Read about sitemaps <a
  139. href="http://sitemaps.org/protocol.php">here</a>.  
  140.  
  141. <p>
  142.  
  143. Totally data driven, ksitemap reads a file-list file (or
  144. “filelist” for short) containing the names and attributes of the
  145. pages and images to be included in the sitemap.  The filelist file is kept
  146. in the web directory itself, but it need not be world readable.
  147.  
  148. <p>
  149.  
  150. The ksitemap script should work under any Unix operating system (Linux, Mac
  151. OS X, NetBSD, Solaris, etc) that has C-Kermit 9.0 installed (but the <a
  152. href="http://kermit.columbia.edu/ftp/scripts/ckermit/ksitemap">top line</a>,
  153. which indicates the pathname of the C-Kermit executable, might need to be
  154. changed).  In Unix the ksitemap script must, of course, also be given
  155. execute permission (chmod +x).  Ksitemap has not yet been tested in
  156. VMS.
  157.  
  158. <h3>Invocation</h3>
  159.  
  160. Ksitemap is invoked with the pathname of the filelist as its first and only
  161. command-line argument, for example:
  162.  
  163. <p>
  164. <blockquote>
  165. <table>
  166. <tr>
  167. <td style="padding-right:24">$ <u>ksitemap /www/filelist</u>
  168. <td><i>(absolute)</i>
  169. <tr>
  170. <td>$ <u>ksitemap ~/web/filelist</u>
  171. <td><i>(symbolic)</i>
  172. <tr>
  173. <td>$ <u>ksitemap web/filelist</u>
  174. <td><i>(relative)</i>
  175. <tr>
  176. <td>$ <u>ksitemap ../web/filelist</u>
  177. <td><i>(relative)</i>
  178. <tr>
  179. <td>$ <u>ksitemap /www/</u>
  180. <td><i>(absolute directory, no filename)</i>
  181. <tr>
  182. <td>$ <u>ksitemap</u>
  183. <td><i>(no argument, see just below)</i>
  184. </table>
  185. </blockquote>
  186.  
  187. If you give a directory name without a filename, 'filelist' is used
  188. as the filename.
  189.  
  190. <p>
  191.  
  192. If you invoke ksitemap without a command-line argument then:
  193.  
  194. <ul style="padding-bottom:0;margin-bottom:8">
  195.  
  196. <li>If the environment variable KSITEMAPDIR is defined, it will be used
  197. as the pathname of the website directory;
  198.  
  199. <li>Otherwise, your current directory will be assumed as the website
  200. directory.
  201.  
  202. </ul>
  203.  
  204. In both cases the filename will default to 'filelist'.  Thus, if you have
  205. the KSITEMAPDIR environment variable defined in your Unix profile (e.g.
  206. <tt>.bash_profile</tt> for the Bash shell); for example:
  207.  
  208. <p>
  209. <blockquote>
  210. <tt>export KSITEMAPDIR=/net/w/0/htdocs/<i>username</i>/web/</tt>
  211. </blockquote>
  212. <p>
  213.  
  214. and the name of the file-list file is 'filelist', then you can run ksitemap
  215. from any directory any time without any command-line argument.
  216.  
  217. <p>
  218.  
  219. To invoke for debugging and testing, do:
  220.  
  221. <p>
  222. <blockquote>
  223. <tt>$ <u>DEBUG=1 ksitemap <i>args</i></tt></u>
  224. </blockquote>
  225. <p>
  226.  
  227. This gives progress messages and it writes the sitemap.xml file in a "tmp"
  228. directory.
  229.  
  230. <h3>The filelist file</h3>
  231.  
  232. The filelist file contains names of HTML and image files relative to the web
  233. directory.  It can contain comment lines that begin with '<tt>#</tt>':
  234.  
  235. <p>
  236. <blockquote>
  237. <tt># This is a comment line</tt>
  238. </blockquote>
  239. </p>
  240.  
  241. And it can contain blank lines, which are ignored.
  242. Nonblank, non-comment lines are in this format:
  243.  
  244. <p>
  245. <blockquote>
  246. <tt><i>tag</i>=<i>value</i></tt>
  247. </blockquote>
  248. <p>
  249.  
  250. An <b>equal sign</b> (=) separates the tag from the value.  If you include
  251. <b>whitespace</b> (blanks or tabs) before and after the equal sign and they
  252. are ignored.  The following three lines have identical effect:
  253.  
  254. <p>
  255. <blockquote>
  256. <pre>
  257. home=http://www.xyzcorp.com/
  258. home = http://www.xyzcorp.com/
  259. home=          http://www.xyzcorp.com/
  260. </pre>
  261. </blockquote>
  262. <p>
  263.  
  264.  
  265.  
  266. If you need to include an equal sign in the value itself,
  267. surround the value with ASCII doublequotes.  If you want the value itself
  268. to be enclosed in doublequotes, put three of them on each end (see the
  269. <a href="#programming">section on programming considerations</a> for an
  270. explanation).  Examples:
  271.  
  272. <p>
  273. <blockquote>
  274. <pre>
  275. cap=View from the Empire State Building looking East
  276. cap="A+B=C"
  277. cap="""Caption within doublequotes"""
  278. </pre>
  279. </blockquote>
  280. <p>
  281.  
  282. The first few lines define parameters for the whole website:
  283.  
  284. <p>
  285. <blockquote>
  286. <table class=compact>
  287. <tr>
  288. <th>Tag
  289. <th>Status
  290. <th>Value
  291. <tr>
  292. <td>encoding
  293. <td><i>Depends</i>
  294. <td style="padding-bottom:4">
  295.  
  296. sitemap.xml files are encoded in <a
  297. href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a>.  If your filelist file
  298. is encoded in some other character set (such as ISO-8859-1) for the purpose
  299. of including non-ASCII characters (such as accented letters or non-Roman
  300. letters), you must declare its encoding so ksitemap can convert the text to
  301. UTF-8.  If your file-list file is ASCII, or it is already UTF-8, this item
  302. is
  303. <b>optional</b>.  Otherwise this item is <b>required</b>, and it should come
  304. first, so ksitemap can convert all the lines in the file appropriately.  The
  305. <i>value</i> is the <a
  306. href="http://www.iana.org/assignments/character-sets">MIME
  307. name of the character set</a> used in the file-list file.  For a list of
  308. supported encodings, see <a href="csetnames.html">this page</a>).
  309.  
  310. <tr>
  311. <td>home
  312. <td>Required
  313. <td>The URL of the website's home directory (with no filename part)
  314. <tr>
  315. <td>geo
  316. <td>Optional
  317. <td>The default geographical location for images, if any
  318. <tr>
  319. <td>lic
  320. <td>Optional
  321. <td style="padding-bottom:4">The default filename, if any, for a page
  322. containing copyright or license information for the site's original images
  323. <tr>
  324. <td>.<i>macroname</i>
  325. <td>Optional
  326. <td style="padding-bottom:4">Definition for macro with given name
  327. </table>
  328. </blockquote>
  329. <p>
  330.  
  331. These items should come before any of the page-specific items that are
  332. described below.  If you include a <b>geo</b> or <b>lic</b> tag before any
  333. <b>url</b> tag (see below), these will be used for any image for which you
  334. do not specify a <b>geo</b> or <b>lic</b> tag.  In other words the ones in
  335. the top section are <i>global</i> and the ones in an img section are
  336. <i>local</i> to that image.
  337.  
  338. <p>
  339.  
  340. The "home" line's value is the URL of the website root
  341. directory, ending with slash, for example:
  342.  
  343. <p>
  344. <blockquote>
  345. <tt>home:http://kermit.columbia.edu/</tt>
  346. </blockquote>
  347. <p>
  348.  
  349. This is used to form the full URLs of the files and images in the website.
  350. Example:
  351.  
  352. <p>
  353. <blockquote>
  354. <pre>
  355. home:http://kermit.columbia.edu/
  356. lic:copyright.html
  357. </pre>
  358. </blockquote>
  359. <p>
  360.  
  361. This results in the URL of the license file being:
  362.  
  363. <p>
  364. <blockquote>
  365. <pre>
  366. http://kermit.columbia.edu/copyright.html
  367. </pre>
  368. </blockquote>
  369. <p>
  370.  
  371. <b>Macros</b> allow you to use variables in value strings.  For example,
  372. given:
  373.  
  374. <p>
  375. <blockquote>
  376. <pre>
  377. .year=2010
  378. </pre>
  379. </blockquote>
  380. <p>
  381.  
  382. Then any ocurrence of <q><tt>\m(year)</tt></q> in a value string is replaced by
  383. <q><tt>2010</tt></q>.
  384.  
  385. <p>
  386.  
  387. The <b>remainder of the file list</b> contains lines for each file and image
  388. you want to include in your sitemap.  For each page, the lines should appear
  389. in the following order:
  390.  
  391. <p>
  392. <blockquote>
  393. <table class=compact>
  394. <tr>
  395. <th>Tag
  396. <th>Status
  397. <th>Value
  398. <tr>
  399. <td>url
  400. <td>Required
  401. <td>Name of an html file relative to the website's root directory.
  402. <tr>
  403. <td>pri
  404. <td>Optional
  405. <td>Priority of the page, 0.0 to 1.0
  406. </table>
  407. </blockquote>
  408. <p>
  409.  
  410. For each URL, the <b>page date</b> is supplied automatically based on the
  411. modification date of the file and the <b>change frequency</b> (daily, weekly,
  412. monthly, yearly) is supplied based on when the file was last modifed.
  413.  
  414. <p>
  415.  
  416. For <b>redirects</b>, a URL entry can have two values; for example:
  417.  
  418. <p>
  419. <blockquote>
  420. <pre>
  421. url=index.html=index-en.html
  422. </pre>
  423. </blockquote>
  424. <p>
  425.  
  426. This means that the first filename is an HTTP Redirect to the second
  427. filename; that is, the first name is a pointer to a file having the second
  428. name.  For example, suppose you have a website with calendars for different
  429. years: <tt>cal-2009.html</tt>, <tt>cal-2010.html</tt>,
  430. <tt>cal-2011.html</tt>, etc, and the calendar for the current year should
  431. always be available as simply <tt>cal.html</tt>.  In that case your
  432. <tt>.htaccess</tt> file redirects the name <tt>cal.html</tt> to (say)
  433. <tt>cal-2011.html</tt> because you want the <tt>cal.html</tt> name to be
  434. indexed by Web crawlers even though no file exists with that name in your
  435. site.  This way, each year you only have to change your <tt>.htaccess</tt>
  436. and you don't have to wait for the web crawlers to index a file that didn't
  437. exist before:
  438.  
  439. <p>
  440. <blockquote>
  441. <pre>
  442. url=cal.html=cal-2011.html
  443. </pre>
  444. </blockquote>
  445. <p>
  446.  
  447. If you have a lot of files using this naming convention, you can use a macro
  448. so the variable string can be defined (and changed) in just one place
  449. instead of lots of places:
  450.  
  451. <p>
  452. <blockquote>
  453. <pre>
  454. .year=2011
  455. url=cal.html=cal-\m(year).html
  456. url=jan.html=jan-\m(year).html
  457. url=feb.html=feb-\m(year).html
  458. <i>etc...</i>
  459. </pre>
  460. </blockquote>
  461. <p>
  462.  
  463.  
  464.  
  465.  
  466.  
  467. If there are <b>images</b> on the page that you want to include in the sitemap:
  468.  
  469. <p>
  470. <blockquote>
  471. <table class=compact>
  472. <tr>
  473. <th>Tag
  474. <th>Status
  475. <th>Value
  476. <tr>
  477. <td>img
  478. <td>Required
  479. <td>Name file an image file in the root directory or in a subdirectory.
  480. <tr>
  481. <td>cap
  482. <td>Optional
  483. <td>A text caption for the image
  484. <tr>
  485. <td>title
  486. <td>Optional
  487. <td>A text title for the image
  488. <tr>
  489. <td>geo
  490. <td>Optional
  491. <td>The geographical localization of this image only
  492. <tr>
  493. <td>lic
  494. <td>Optional
  495. <td style="padding-bottom:4">The URL of a license page for this image only
  496.  
  497. </table>
  498. </blockquote>
  499. <p>
  500.  
  501. Here's a brief example that has three files.  For the first file
  502. (index.html), a priority is specified; for the others, the default priority
  503. is accepted.  The second file is in a subdirectory.  The third file has
  504. images.  Comments, blank lines, and indentation are used for clarity, but
  505. they do not do not affect the result.  Note that there may be, but need not
  506. be, whitespace around the equal sign.
  507.  
  508.  
  509. <p>
  510. <blockquote class=boxed>
  511. <pre>
  512. # ksitemap filelist for building sitemap.xml
  513.  
  514. encoding = ISO-8859-1
  515. home=http://kermit.columbia.edu/
  516. geo=New York City USA
  517. lic=copyright.html
  518.  
  519. url=index.html
  520. pri=1.0
  521.  
  522. url=cudocs/ilosetup.html
  523.  
  524. url=cable.html
  525. img=connectors-340.jpg
  526.   cap=Male and Female RS-232 Connectors
  527.   title=Serial Data Connectors
  528. img=modemcable.jpg
  529.   cap=Modem Cable Schematic
  530.   geo=Bedford MA
  531. img=nullmodem-480.jpg
  532.   cap=Null Modem Cable Schematic
  533.   lic=special.html
  534.   geo=Batey Ca±o - Yamasß
  535. </pre>
  536. </blockquote>
  537. <p>
  538.  
  539. The resulting sitemap.xml looks like this:
  540.  
  541. <p>
  542. <blockquote class=boxed>
  543. <pre>
  544.  
  545. <?xml version="1.0" encoding="UTF-8"?>
  546. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  547.  xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  548. <url>
  549.   <loc>http://kermit.columbia.edu/</loc>
  550.   <lastmod>2010-12-07</lastmod>
  551.   <changefreq>daily</changefreq>
  552.   <priority>1.0</priority>
  553. </url>
  554. <url>
  555.   <loc>http://kermit.columbia.edu/cudocs/ilosetup.html</loc>
  556.   <lastmod>2010-12-07</lastmod>
  557.   <changefreq>daily</changefreq>
  558.   <priority>0.5</priority>
  559. </url>
  560. <url>
  561.   <loc>http://kermit.columbia.edu/cable.html</loc>
  562.   <lastmod>2010-12-07</lastmod>
  563.   <changefreq>daily</changefreq>
  564.   <priority>0.5</priority>
  565.   <image:image>
  566.     <image:loc>http://kermit.columbia.edu/connectors-340.jpg</image:loc>
  567.     <image:caption>Male and Female RS-232 Connectors</image:caption>
  568.     <image:title>Serial Data Connectors</image:title>
  569.     <image:geo_location>New York City USA</image:geo_location>
  570.     <image:license>http://kermit.columbia.edu/copyright.html</image:license>
  571.   </image:image>
  572.   <image:image>
  573.     <image:loc>http://kermit.columbia.edu/modemcable.jpg</image:loc>
  574.     <image:caption>Modem Cable Schematic</image:caption>
  575.     <image:geo_location>Bedford MA</image:geo_location>
  576.     <image:license>http://kermit.columbia.edu/copyright.html</image:license>
  577.   </image:image>
  578.   <image:image>
  579.     <image:loc>http://kermit.columbia.edu/nullmodem-480.jpg</image:loc>
  580.     <image:caption>Null Modem Cable Schematic</image:caption>
  581.     <image:geo_location>Batey Ca±o - Yamasß</image:geo_location>
  582.     <image:license>http://kermit.columbia.edu/special.html</image:license>
  583.   </image:image>
  584. </url>
  585. </urlset>
  586. </pre>
  587. </blockquote>
  588.  
  589. <a name="programming"> </a>
  590. <h3>Programming considerations</h3>
  591.  
  592. The key to parsing the filelist is Kermit's <tt>\fsplit()</tt> function, and
  593. in particular some new features added to it in <a href="ck90.html">C-Kermit
  594. 9.0</a>: a straightforward way of handling strings containing non-ASCII
  595. characters, and the "comma-separated values" list (CSV) feature described in
  596. <a href="csv.html">this page</a>.  The statement:
  597.  
  598. <blockquote>
  599. <pre>
  600. .\%9 := \fsplit(\m(line),&x,=,CSV) # Split line on '='
  601. </pre>
  602. </blockquote>
  603.  
  604. splits a filelist line into two pieces, the tag and the value:
  605.  
  606. <ul style="margin-bottom:0">
  607.  
  608. <li><tt>\%9</tt> is a kind of all-purpose temporary local variable, a usually
  609. unused command-line or macro argument number 9, which in this case receives
  610. the number of items that were obtained by splitting (the <tt>\%1-9</tt>
  611. variables are local by definition, meaning if you use them in a macro,
  612. changing their values won't affect variables of the same name anywhere else).
  613.  
  614. <li><tt>\fsplit()</tt> is a built-in function for splitting a string into
  615. pieces based on all sorts of breaking, including, and grouping criteria.
  616.  
  617. <li>The first argument, <tt>\m(line)</tt>, is the variable holding the
  618. current line from the filelist.
  619.  
  620. <li><tt>&x</tt> is the name of the array to put the result in.
  621.  
  622. <li><tt>= </tt> is the break set, composed of one character in this case,
  623. the equal sign.
  624.  
  625. <li><tt>CSV</tt> means it is a "comma-separated values" list, but since the
  626. break character is equal sign and not comma, it is really an "equal-sign
  627. separated list", but with the same rules as a CSV, such as:
  628.  
  629. <ol style="padding-top:8">
  630.  
  631. <li>All characters other than the break character itself are in the include
  632. set. 
  633.  
  634. <li>Except that the separator can, but need not be, surrounded by
  635. whitespace, in which case the whitespace characters are discarded (not
  636. included).
  637.  
  638. <li>A field containing the separator character as data must be surrounded
  639. by doublequotes, which will be removed in the final result.
  640.  
  641. <li>A field that contains doublequotes must be enclosed in doublequotes,
  642. and then all interior doublequotes must be doubled.
  643.  
  644. </ol>
  645. </ul>
  646.  
  647. The complete set of CSV rules is <a href="csv.html#rules">here</a>.
  648.  
  649. <p>
  650.  
  651. Another observation about <tt>\fsplit()</tt> is worth making.  Its result
  652. goes into an array, and array elements in the Kermit language, just like
  653. <tt>\%a</tt> variables, are evaluated <i>recursively</i>.  The array
  654. elements contain the literal pieces of the original string, but when you
  655. refer to an array element whose value contains any backslashes, the string
  656. is evaluated recursively, "all the way down".  This is why the array element
  657. values are referenced through <tt>\fcontents()</tt>, which forces a simple
  658. "one-level-deep" evaluation.
  659.  
  660. <p>
  661.  
  662. A more serious problem was noted when adding the macro capability to
  663. ksitemap, namely that <tt>\fsplit()</tt> itself was stripping out backslash
  664. characters.  This is appropriate behavior for some of its other uses
  665. (e.g. parsing <a href="ckermit80.html#x9">S-Expressions</a>), but is not
  666. appropriate for parsing external data, such as data lines read from files.
  667. This explains the "Quoting Hell" trick just before the <tt>\fsplit()</tt>
  668. invocation.  This will be unnecessary (and, in fact, harmful) in the next
  669. build of C-Kermit after 9.0.299 Alpha.09, where in CSV and TSV invocations
  670. of <tt>\fsplit()</tt>, backslashes will be treated just as any other
  671. character.
  672.  
  673. <p>
  674.  
  675. Finally it should be noted that ksitemap takes pains to expand macros only
  676. after verifying that a line contains “<tt>\m(<i>xxx</i>)</tt>”
  677. (where <tt><i>xxx</i></tt> would be the name of the macro).  It could very
  678. easily have simply evaluated each line without all the testing and checking,
  679. but then files that contained backslashes for other reasons would be
  680. wrecked.
  681.  
  682.  
  683. <h3>References</h3>
  684.  
  685. <table callpadding=0 cellspacing=0 width="100%">
  686. <tr>
  687. <td>
  688. <ul>
  689. <li><a href="http://sitemaps.org/protocol.php">Sitemap definition</a>
  690. (Sitemaps.org)
  691. <li><a
  692. href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=178636">Google Sitemap Image Extensions</a> (Google)
  693. <li><a href="http://unicode.org/faq/utf_bom.html#UTF8">UTF-8 FAQ</a>
  694. (Unicode Consortium)
  695. <li><a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> (Wikipedia)
  696. <li> <a href="http://www.iana.org/assignments/character-sets">MIME Character
  697. Set Names</a> (IETF)
  698. </ul>
  699. <td>
  700. <ul style="padding-left:0">
  701. <li><a href="csetnames.html">Character Sets Supported in Kermit</a> (Kermit Project)
  702. <li><a href="utf8.html">UTF-8 Sampler</a> (Kermit Project)
  703. <li><a href="ckermit.html">C-Kermit</a> (Kermit Project)
  704. <li><a href="ck90.html">C-Kermit 9.0</a> (Kermit Project)
  705. <li><a href="csv.html">CSV Files</a> (Kermit Project)
  706. </ul>
  707. </table>
  708. <p>
  709. </div>
  710. <hr>
  711. <address style="padding:0 0 12 0">
  712. ksitemap / Kermit sitemap script / <a href="index.html">The Kermit Project</a>
  713. / Columbia University / December 2010
  714. </address>
  715. </div>
  716.  
  717. </body>
  718. </html>
  719.