|  | Posted by Curtis on 12/17/05 06:49 
We're writing a markup language, which naturally entails alot of text substitution. We use / to do italics, for
 example, /like so./  The basics are not unlike Textile.
 
 That means, of course, that links would get clobbered and
 wind up looking like www.mysite.com<it>subdir</it>subdir.
 You get the picture. Percent signs are another common one in
 URL's.
 
 We're using double brackets to signify links, with displayed
 text after a bar, like this: [[www.mysite.com/here/there |
 my site]]
 
 Unless someone has a better suggestion, we were thinking of
 simply pulling all the text out of the brackets and placing
 it in an array, processing the paragraphs without the link
 text, the links in the array to the appropriate HTML, then
 replacing each [[]] sequentially with a HTMLified array
 item.
 
 
 if (strstr($parags[$i], "[["))
 
 
 preg_match_all("/
 
 [
 ([^\[]{1,200})
 \]\]/x",
 $parags[$i], &$brackets);
 foreach ($brackets[1] as $link)
 {
 $linkarray[] = $link;       # $linkarray global.
 $parags[$i] = str_replace($link, "", $parags[$i]);
 }
 }
 
 We wind up with [[]] in the text as as marker, and the contents of each in the array. Is pulling the text out, then serially restoring it after we've created the HTML link in the array the fastest approach, do you think?
 
 Too, we've maxed out the link at 200 characters to write the code. Any thoughts on a more appropriate figure?
 
 --
 
 Curtis
 
 Visit We the Thinking
 www.wethethinking.com
 An online magazine/forum
 devoted to philosophical
 thought.
 [Back to original message] |