[geeklog-devel] My favorite topic: \ > < characters...

Rob Griffiths robg at macosxhints.com
Mon Mar 10 19:04:43 EST 2003


[Caution - long detailed explanation and example follow...]

GL Dev Team:

First, let me say that these 'special characters' are handled much nicer
in the current release of Geeklog than they were in 1.1.  And I don't
want to look a gift horse in the mouth, and I value the amazing amount
of work that's been put into this project -- without it, I wouldn't be
where I'm at with macosxhints.com.  With all that said, however, the
NUMBER ONE thing I'd like out of GL2 (or sooner ;-), above and beyond
any new feature, is a fully functional method of handling <, >, and \
(and $ as well, perhaps).  I'm not necessarily talking about a visual
editor, just a much better standard editor.

This problem hits me every single day on my site, as myself and my users
post a lot of code and XML snippets.  It's really important to my future
use of Geeklog that a better solution be found than what currently
exists.  That's not supposed to sound like a threat (but it probably
does), just a realization that this glitch affects someone using my site
nearly every day, including yours truly, and I'm wasting a lot of time
because of it.

I've told my users about the [code] tag, but not all of them use it, and
even it's not perfect (see below).  The [code] tag is also admittedly
non-standard and hard to remember if you're an HTML coder.  There are
also <pre>, <code>, and <tt> tags available, all of which have their own
practical set of problems.  In the following example, I'll denote what
would be bold formatting with *b* and monospaced font with *m*.  Let's
say I want to post a story that ends up being published looking like
this (it's contrived, I know, but it demonstrates my problems with the
special characters):

--- DESIRED OUTPUT ---
Greetings, readers.  I'm *b*<very pleased>*/b* to announce today that
the new XML plug-in is ready to use on macosxhints.com.  To use it,
insert these lines into your *m*macosxhints.xml*/m* file using your
favorite text editor:

   *m*<dict>
        <key>user\flag</key>
        <value>123</value>
      </dict>*/m*

Once you are done, save the file.  You'll now be able to post stories to
macosxhints.com using all of the special characters in code snippets
(*m*\ > <*/m*) without any need to worry about special formatting
options.
--- DESIRED OUTPUT ---

My first take at creating this article (using geeklog.net) looked like
this (and I think everyone would agree this would be the easiest input
style):

--- INPUT ---
Greetings, readers.  I'm <b><very pleased></b> to announce today that
the new XML plug-in is ready to use on macosxhints.com.  To use it,
insert these lines into your <tt>macosxhints.xml</tt> file using your
favorite text editor:[code]<dict>
  <key>user\flag</key>
  <value>123</value>
</dict>[/code]Once you are done, save the file.  You'll now be able to
post stories to macosxhints.com using all of the special characters in
code snippets (<tt>< > \</tt>) without any need to worry about special
formatting options.
--- INPUT ---

The output resulting from this input string is:

--- OUTPUT ---
Greetings, readers. I'm  to announce today that the new XML plug-in is
ready to use on macosxhints.com. To use it, insert these lines into your
macosxhints.xml file using your favorite text editor:

<dict>
  <key>userflag</key>
  <value>123</value>
</dict>

Once you are done, save the file. You'll now be able to post stories to
macosxhints.com using all of the special characters in code snippets ( )
without any need to worry about special formatting options.
--- OUTPUT ---

There are some problems:
   - The *b*<very pleased>*/b* string is missing entirely
   - 'user\flag' string has lost its backslash, even though it was in
[code] tags
   - '(< > \)' has turned into '( )' (and it will do so, even if it's
not within a <tt> tag)

So you have to revise it, and experiment with HTML character entities,
and eventually you wind up with something like this:

--- INPUT ---
Greetings, readers.  I'm <b><very pleased></b> to announce today
that the new XML plug-in is ready to use on macosxhints.com.  To use it,
insert these lines into your <tt>macosxhints.xml</tt> file using your
favorite text editor:[code]<dict>
  <key>user\flag</key>
  <value>123</value>
</dict>[/code]Once you are done, save the file.  You'll now be able to
post stories to macosxhints.com using all of the special characters in
code snippets (<tt>< > \</tt>) without any need to worry
about special formatting options.
--- INPUT ---

This creates the correct output, with all special characters intact ...
however there's a big problem!!  If you now view the text in the submit
area, you'll see it looks like this:

--- REVISED INPUT AFTER PREVIEW ---
Greetings, readers.  I'm <b><very pleased></b> to announce today that
the new XML plug-in is ready to use on macosxhints.com.  To use it,
insert these lines into your <tt>macosxhints.xml</tt> file using your
favorite text editor:[code]<dict>
  <key>user\flag</key>
  <value>123</value>
</dict>[/code]Once you are done, save the file.  You'll now be able to
post stories to macosxhints.com using all of the special characters in
code snippets (<tt>< > \</tt>) without any need to worry about special
formatting options.
--- REVISED INPUT AFTER PREVIEW ---

If you preview the above, of course, you'll be back to step one -- all
the special characters will be gone, along with anything between < and >
that's not in a [code] tag.  So in order to publish a story like this,
here's the song and dance I do every single day:

Open submission, copy all text, paste in text editor, revise as
necessary (hoping submitter got the special character codes right),
select all in editor, copy, select all in input area in Geeklog, paste,
hit Preview, notice fixes that need to be done, switch to editor, make
changes, select all, copy, switch to Geeklog, select all in input area,
paste, hit Preview button.  Repeat until the Preview looks right.  Then,
do this one last time, pasting the raw input in from the text editor,
and then hit save without hitting preview (so the special characters
make it to the database).  Whew, and hardly something I can expect of my
readers.

After all that, if I notice >after< publication that I missed an error
in the story, I'm in trouble -- the special characters are all gone
already (their codes are gone; the characters are there but that's no
good as shown above).  So to edit the story, I now have to open it in
Geeklog, select all, copy, paste into a text editor, then run a bunch of
very careful search and replaces (looking for < > \ where < and > are
not used in HTML tags!), then edit, then paste back into Geeklog,
repeating the process as shown above.  Fugly.

I know I've tried to explain this problem in the past, and perhaps I
miscommunicated what I was trying to say.  But I think this message
explains it well -- posting a story that involves any of those three
characters in a mixture of monospaced and inline snippets is a major
pain in the ass -- even in the latest version of Geeklog.  I'd love to
be proven wrong on this one, but I've experimented with it quite a bit,
and it still seems like a pervasive issue...

regards;
-rob.




More information about the geeklog-devel mailing list