* Bug: can't use square brackets in link descriptions;
@ 2012-01-31 16:19 Christoph LANGE
2012-01-31 21:43 ` Christian Moe
0 siblings, 1 reply; 3+ messages in thread
From: Christoph LANGE @ 2012-01-31 16:19 UTC (permalink / raw)
To: Orgmode Mailing List
Dear org-mode developers,
I am desperately trying to get a square bracket into the description of
a link.
That is, in an org file that I want to export to HTML, I would like to
have the source
<a href="http://example.org">foo [bar]</a>
and of course I would like to avoid using XML character entities such as
b; for [, for two reasons:
1. It is painful.
2. I might eventually want to export my org file to some other format
than HTML.
I noticed this post on escaping in org links
(http://article.gmane.org/gmane.emacs.orgmode/37888), but apparently I
didn't understand it.
I thought that escaping as %5B might work – not only in the "link"
component of a link, where it works due to the specification of URIs,
but also in the "description" component, but in the description it
doesn't work.
Quite generally, I wonder whether there is (or, why there is not) a
generic escape character (e.g. the backslash), which would also allow
for escaping other characters of the org markup syntax, such as * or /.
So far this was something like a feature request, but there is also one
actual bug:
When I insert or edit a link with org-insert-link (C-c C-l) and insert
square brackets into the link description, they are rewritten to {...},
which I do not consider acceptable. If there is any escape syntax, they
should rather be rewritten using that escape syntax.
Thanks in advance for any pointers,
Christoph
--
Christoph Lange, http://www.facebook.com/ch.lange, Skype duke4701
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug: can't use square brackets in link descriptions;
2012-01-31 16:19 Bug: can't use square brackets in link descriptions; Christoph LANGE
@ 2012-01-31 21:43 ` Christian Moe
0 siblings, 0 replies; 3+ messages in thread
From: Christian Moe @ 2012-01-31 21:43 UTC (permalink / raw)
To: Christoph LANGE; +Cc: Orgmode Mailing List
Hi,
One way to solve it would be with org entities. I don't think they
exist for square brackets, but you could make a user-defined one.
You could put something like this in your .emacs (I think plain
bracket characters should work in every export format, so I haven't
bothered to look up HTML entities or LaTeX commands):
(setq org-entities-user
'(("lbr" "[" nil "[" "[" "[" "[") ; left square bracket
("rbr" "]" nil "]" "]" "]" "]"))) ; right square bracket
Then try the following -- ugly as sin, and as painful as XML entities,
but it gives the output you want in whatever format:
Here is a [[http://foobar.org][foo \lbr{}bar\rbr{}]]
The curly bracket replacement (which I think is very reasonable,
really) is currently hardcoded in org-make-link-string. If it were
made customizable, that would take the pain (but not the ugliness) out
of making links like the above.
A backslash escape would have been nice to have, but \[...\] is
already interpreted as a math environment.
Yours,
Christian
On 1/31/12 5:19 PM, Christoph LANGE wrote:
> Dear org-mode developers,
>
> I am desperately trying to get a square bracket into the description
> of a link.
>
> That is, in an org file that I want to export to HTML, I would like to
> have the source
>
> <a href="http://example.org">foo [bar]</a>
>
> and of course I would like to avoid using XML character entities such
> as b; for [, for two reasons:
>
> 1. It is painful.
> 2. I might eventually want to export my org file to some other format
> than HTML.
>
> I noticed this post on escaping in org links
> (http://article.gmane.org/gmane.emacs.orgmode/37888), but apparently I
> didn't understand it.
>
> I thought that escaping as %5B might work – not only in the "link"
> component of a link, where it works due to the specification of URIs,
> but also in the "description" component, but in the description it
> doesn't work.
>
> Quite generally, I wonder whether there is (or, why there is not) a
> generic escape character (e.g. the backslash), which would also allow
> for escaping other characters of the org markup syntax, such as * or /.
>
> So far this was something like a feature request, but there is also
> one actual bug:
>
> When I insert or edit a link with org-insert-link (C-c C-l) and insert
> square brackets into the link description, they are rewritten to
> {...}, which I do not consider acceptable. If there is any escape
> syntax, they should rather be rewritten using that escape syntax.
>
> Thanks in advance for any pointers,
>
> Christoph
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Bug: can't use square brackets in link descriptions;
@ 2012-01-31 16:20 Christoph LANGE
0 siblings, 0 replies; 3+ messages in thread
From: Christoph LANGE @ 2012-01-31 16:20 UTC (permalink / raw)
To: Orgmode Mailing List
Dear org-mode developers,
I am desperately trying to get a square bracket into the description of
a link.
That is, in an org file that I want to export to HTML, I would like to
have the source
<a href="http://example.org">foo [bar]</a>
and of course I would like to avoid using XML character entities such as
b; for [, for two reasons:
1. It is painful.
2. I might eventually want to export my org file to some other format
than HTML.
I noticed this post on escaping in org links
(http://article.gmane.org/gmane.emacs.orgmode/37888), but apparently I
didn't understand it.
I thought that escaping as %5B might work – not only in the "link"
component of a link, where it works due to the specification of URIs,
but also in the "description" component, but in the description it
doesn't work.
Quite generally, I wonder whether there is (or, why there is not) a
generic escape character (e.g. the backslash), which would also allow
for escaping other characters of the org markup syntax, such as * or /.
So far this was something like a feature request, but there is also one
actual bug:
When I insert or edit a link with org-insert-link (C-c C-l) and insert
square brackets into the link description, they are rewritten to {...},
which I do not consider acceptable. If there is any escape syntax, they
should rather be rewritten using that escape syntax.
Thanks in advance for any pointers,
Christoph
--
Christoph Lange, http://www.facebook.com/ch.lange, Skype duke4701
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-31 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31 16:19 Bug: can't use square brackets in link descriptions; Christoph LANGE
2012-01-31 21:43 ` Christian Moe
-- strict thread matches above, loose matches on Subject: below --
2012-01-31 16:20 Christoph LANGE
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).