* How to insert apostrophe (') into code and verbatim text?
@ 2010-02-04 16:48 Uriel Avalos
2010-02-04 16:53 ` Nick Dokos
2010-02-04 17:31 ` Carsten Dominik
0 siblings, 2 replies; 5+ messages in thread
From: Uriel Avalos @ 2010-02-04 16:48 UTC (permalink / raw)
To: emacs-orgmode
Here's an easy one for the guru's, why does an apostrophe at the beginning of a =code= not work? When I export the following text to HTML, the "'life" variable isn't set as code (and the = symbols show up):
Select ='life= for the x variable.
If I escape the apostrophe, I course get back the escape character in the HTML:
Select =\'life= for the x variable.
--
--Thanks!
Uriel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to insert apostrophe (') into code and verbatim text?
2010-02-04 16:48 How to insert apostrophe (') into code and verbatim text? Uriel Avalos
@ 2010-02-04 16:53 ` Nick Dokos
2010-02-05 16:09 ` Uriel Avalos
2010-02-04 17:31 ` Carsten Dominik
1 sibling, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2010-02-04 16:53 UTC (permalink / raw)
To: Uriel Avalos; +Cc: emacs-orgmode
Uriel Avalos <amscopub-mail@yahoo.com> wrote:
> Here's an easy one for the guru's, why does an apostrophe at the beginning of a =code= not work? When I export the following text to HTML, the "'life" variable isn't set as code (and the = symbols show up):
>
> Select ='life= for the x variable.
>
> If I escape the apostrophe, I course get back the escape character in the HTML:
>
> Select =\'life= for the x variable.
>
Emphasis is applied by matching against a regular expression stored in the variable
org-emph-re. I get
,----
| org-emph-re is a variable defined in `org.el'.
| Its value is
| "\\([ ('\"{]\\|^\\)\\(\\([*/_=~+]\\)\\([^
\n,\"']\\|[^
\n,\"'].*?\\(?:\n.*?\\)\\{0,1\\}[^
\n,\"']\\)\\3\\)\\([- .,:!?;'\")}\\]\\|$\\)"
|
| Documentation:
| Regular expression for matching emphasis.
`----
which is way too complicated for my simple mind to wrap around without
some guidance. But the doc for org-export-with-emphasize says:
,----
| org-export-with-emphasize is a variable defined in `org-exp.el'.
| Its value is t
|
| Documentation:
| Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
| If the export target supports emphasizing text, the word will be
| typeset in bold, italic, or underlined, respectively. Works only for
| single words, but you can say: I *really* *mean* *this*.
| Not all export backends support this.
|
| This option can also be set with the +OPTIONS line, e.g. "*:nil".
`----
so *words* are emphasized[1].
Can you write
Select '=life= for the x variable.
instead? The quote is not part of the <code> block, but does that
make much difference? And if it does, a little postprocessing on the
HTML might be all that is needed[2].
HTH,
Nick
[1] although after staring at it for a while and with the hindsight
provided by the org-export-with-emphasize doc, the part that goes [^ ^M\n,\"']
specifically excludes spaces, tabs, carriage returns, newlines,
commas, double quotes and single quotes as components of words.
[2] You might try changing the RE (it is constructed in
org.el:org-set-emph-re()) - but regular expressions are very unforgiving
beasts: you forget one character or add one too many and the whole thing
goes to hell in a handbasket, faster than a bat out of hell - choose
your own cliche' :-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to insert apostrophe (') into code and verbatim text?
2010-02-04 16:48 How to insert apostrophe (') into code and verbatim text? Uriel Avalos
2010-02-04 16:53 ` Nick Dokos
@ 2010-02-04 17:31 ` Carsten Dominik
1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-02-04 17:31 UTC (permalink / raw)
To: Uriel Avalos; +Cc: emacs-orgmode
On Feb 4, 2010, at 5:48 PM, Uriel Avalos wrote:
> Here's an easy one for the guru's, why does an apostrophe at the
> beginning of a =code= not work? When I export the following text to
> HTML, the "'life" variable isn't set as code (and the = symbols show
> up):
>
> Select ='life= for the x variable.
>
> If I escape the apostrophe, I course get back the escape character
> in the HTML:
>
> Select =\'life= for the x variable.
That is because '=life=' was considered more likely than what you are
using.
Org-mode is using a heuristic method to figure out what is a normal
equal sign, and what introduces code. Feel free to play with the
variable `org-emphasis-regexp-components' and see if you can come up
with something that works for you.
- Carsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to insert apostrophe (') into code and verbatim text?
2010-02-05 16:09 ` Uriel Avalos
@ 2010-02-05 15:07 ` Nick Dokos
0 siblings, 0 replies; 5+ messages in thread
From: Nick Dokos @ 2010-02-05 15:07 UTC (permalink / raw)
To: Uriel Avalos; +Cc: emacs-orgmode
Uriel Avalos <amscopub-mail@yahoo.com> wrote:
> So I guess it's too complicated for the gurus. :-)
>
> I'm already doing '=life= but I thought perhaps there was a quick hack
> to get ='life= to work. Oh well, not a biggie, life moves on...
>
Too complicated for me, perhaps: I'm no guru :-)
Carsten had a suggestion of playing around with the various components
of the RE (see the variable org-emphasis-regexp-components) - did you
see that? But you will have to experiment and set them for *your*
purposes.
Cheers,
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to insert apostrophe (') into code and verbatim text?
2010-02-04 16:53 ` Nick Dokos
@ 2010-02-05 16:09 ` Uriel Avalos
2010-02-05 15:07 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: Uriel Avalos @ 2010-02-05 16:09 UTC (permalink / raw)
To: emacs-orgmode
So I guess it's too complicated for the gurus. :-)
I'm already doing '=life= but I thought perhaps there was a quick hack to get ='life= to work. Oh well, not a biggie, life moves on...
On Thu, 04 Feb 2010 11:53:30 -0500
Nick Dokos <nicholas.dokos@hp.com> wrote:
> Uriel Avalos <amscopub-mail@yahoo.com> wrote:
>
> > Here's an easy one for the guru's, why does an apostrophe at the beginning of a =code= not work? When I export the following text to HTML, the "'life" variable isn't set as code (and the = symbols show up):
> >
> > Select ='life= for the x variable.
> >
> > If I escape the apostrophe, I course get back the escape character in the HTML:
> >
> > Select =\'life= for the x variable.
> >
>
> Emphasis is applied by matching against a regular expression stored in the variable
> org-emph-re. I get
>
> ,----
> | org-emph-re is a variable defined in `org.el'.
> | Its value is
> | "\\([ ('\"{]\\|^\\)\\(\\([*/_=~+]\\)\\([^
> \n,\"']\\|[^
> \n,\"'].*?\\(?:\n.*?\\)\\{0,1\\}[^
> \n,\"']\\)\\3\\)\\([- .,:!?;'\")}\\]\\|$\\)"
> |
> | Documentation:
> | Regular expression for matching emphasis.
> `----
>
> which is way too complicated for my simple mind to wrap around without
> some guidance. But the doc for org-export-with-emphasize says:
>
> ,----
> | org-export-with-emphasize is a variable defined in `org-exp.el'.
> | Its value is t
> |
> | Documentation:
> | Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
> | If the export target supports emphasizing text, the word will be
> | typeset in bold, italic, or underlined, respectively. Works only for
> | single words, but you can say: I *really* *mean* *this*.
> | Not all export backends support this.
> |
> | This option can also be set with the +OPTIONS line, e.g. "*:nil".
> `----
>
> so *words* are emphasized[1].
>
> Can you write
>
> Select '=life= for the x variable.
>
> instead? The quote is not part of the <code> block, but does that
> make much difference? And if it does, a little postprocessing on the
> HTML might be all that is needed[2].
>
> HTH,
> Nick
>
> [1] although after staring at it for a while and with the hindsight
> provided by the org-export-with-emphasize doc, the part that goes [^ ^M\n,\"']
> specifically excludes spaces, tabs, carriage returns, newlines,
> commas, double quotes and single quotes as components of words.
>
> [2] You might try changing the RE (it is constructed in
> org.el:org-set-emph-re()) - but regular expressions are very unforgiving
> beasts: you forget one character or add one too many and the whole thing
> goes to hell in a handbasket, faster than a bat out of hell - choose
> your own cliche' :-)
--
--Thanks!
Uriel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-05 15:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04 16:48 How to insert apostrophe (') into code and verbatim text? Uriel Avalos
2010-02-04 16:53 ` Nick Dokos
2010-02-05 16:09 ` Uriel Avalos
2010-02-05 15:07 ` Nick Dokos
2010-02-04 17:31 ` Carsten Dominik
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).