XMLified Characters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XMLified Characters

puneet goel-3
Greetings

OK, let me first confess that I am not expert in XML-RPC etc. So what
I am talking about here might have some obvious solution which I might
not be aware of.

I have been using weblogger for a while to maintain a couple of tech
blogs. And since these are tech blogs, they do have a lot of code
snippets thrown in. I am using wordpress with SyntaxHighlighter
evolved plugin to maintain these blogs.

When I use weblogger to edit my blog entry, all the special characters
in the blog, mainly <,>,&, and " appear XML-escaped like &lt, &gt,
&amp etc. And since these characters appear a lot in the code snippets
that I put on my blogs, this becomes a big nuisance.

So I am using the following hack in my configuration to help solve the
problem ....

(add-hook 'weblogger-start-edit-entry-hook
          (lambda()
            (let* ((old-contents (buffer-string))
                   (new-contents (xml-substitute-special old-contents)))
              (delete-region (buffer-end -1) (buffer-end 1))
              (insert new-contents))
            (flyspell-mode 1)
            (flyspell-buffer) ; spell check the fetched post
            (auto-fill-mode -1)
            (visual-line-mode 1)
            ))

The operative part here is the use of xml-substitute-special to
de-escape the XMLified characters.

I am wondering if other people who use weblogger, also face this
problem and if this hack could be imported as part of the weblogger-el
itself.

Regards
- Puneet


_______________________________________________
Emacsweblogs mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacsweblogs
Reply | Threaded
Open this post in threaded view
|

Re: XMLified Characters

puneet goel-3
>
> and if this hack could be imported as part of the weblogger-el itself.
>

I mean something to _this effect_ could be imported as part of
weblogger -- my code is just a dirty hack.

Regards
- Puneet


_______________________________________________
Emacsweblogs mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacsweblogs
Reply | Threaded
Open this post in threaded view
|

Re: XMLified Characters

Mark A. Hershberger
In reply to this post by puneet goel-3
puneet goel <[hidden email]> writes:

> When I use weblogger to edit my blog entry, all the special characters
> in the blog, mainly <,>,&, and " appear XML-escaped like &lt, &gt,
> &amp etc. And since these characters appear a lot in the code snippets
> that I put on my blogs, this becomes a big nuisance.

Since XML-RPC wraps your content with XML, any XML characters
(especially <) has to be escaped.

Complicating this is the fact that (right now) weblogger.el thinks your
content is pure HTML.  Which means that if you're writing content that
contains HTML characters that should be treated as source code, then
you should write them in an escaped fashion.

Wrapping content in CDATA might help here, but it won't solve the
problem completely.

In the end, weblogger.el needs to have some understanding of your
content.  It needs to know if you are intending to write pure HTML or if
you're expecting the server to format the code.

This is definitely worth doing, but I can't do it right now.  Could you
file a bug at https://bugs.launchpad.net/weblogger-el requesting this
feature?


Mark.

--
http://hexmode.com/

The world is a dangerous place, not because of those who do evil, but
because of those who look on and do nothing.
                                            — Albert Einstein


_______________________________________________
Emacsweblogs mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacsweblogs