[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Bug: unconverted dashes in HTML export
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Bug: unconverted dashes in HTML export |
Date: |
Sat, 08 Feb 2014 10:29:54 +0100 |
Hello,
Thomas Morgan <address@hidden> writes:
> I started Emacs with `emacs -Q -l setup.el test-case.org', then typed
> `C-c C-e h o' to export to HTML and open the result. The setup file
> (`setup.el'), test case (`test-case.org'), HTML output (`lose.html'),
> and a PDF printed by the web browser (`lose.pdf'), are attached.
>
> The test case contains a one-cell table with three hyphens (`---').
> I expected this to be converted to an em-dash in the HTML output,
> but it remained three hyphens.
Indeed.
> A patch fixing the problem is attached, along with the HTML and PDF
> produced after the patch was applied (`win.html', `win.pdf').
>
> I started preparing this report last May (sorry for the delay)
> but just confirmed the bug again with Org-mode version 8.2.5g
> (`release_8.2.5g-663-g24a213' @ `/src/org-mode/lisp/') and GNU Emacs
> 24.3.1 (`x86_64-unknown-linux-gnu', X toolkit, Xaw3d scroll bars)
> of 2013-09-24.
Thank you for the patch. A few remarks below.
>>From bd14cdce80a610a5eadbf563ac12472fbed542a5 Mon Sep 17 00:00:00 2001
> From: Thomas Morgan <address@hidden>
> Date: Mon, 13 May 2013 11:06:52 +0200
> Subject: [PATCH] Convert dashes in HTML export even when at end of string.
>
> * lisp/ox-html.el (org-html-special-string-regexps): Convert dashes
> even when at end of string.
You need to add TINYCHANGE at the end of the commit message.
> - ("---\\([^-]\\)" . "—\\1") ; mdash
> - ("--\\([^-]\\)" . "–\\1") ; ndash
> + ("---\\([^-]?\\)" . "—\\1") ; mdash
> + ("--\\([^-]?\\)" . "–\\1") ; ndash
The new regexps still don't look right, as they can match an additional
dash:
(string-match "---\\([^-]?\\)" "----") => 0
I'm not sure about the intent of this regexp, that is whether
consecutive mdashes or ndashes are allowed or not.
A correct version could be either:
("---" . "—")
or
("\\([^-]\\|^\\)---\\([^-]\\|$\\)" . "\\1—\\2")
I think the former is on par with LaTeX behaviour.
What do you think?
Regards,
--
Nicolas Goaziou