emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Thomas Morgan <tlm@ziiuu.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: unconverted dashes in HTML export
Date: Sat, 08 Feb 2014 10:29:54 +0100	[thread overview]
Message-ID: <87ha8aymst.fsf@gmail.com> (raw)
In-Reply-To: <87d2iykpwo.fsf@azha.ziiuu.com> (Thomas Morgan's message of "Sat, 01 Feb 2014 17:29:17 -0500")

Hello,

Thomas Morgan <tlm@ziiuu.com> 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 <tlm@ziiuu.com>
> 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.

> -    ("---\\([^-]\\)" . "&#x2014;\\1")	; mdash
> -    ("--\\([^-]\\)" . "&#x2013;\\1")	; ndash
> +    ("---\\([^-]?\\)" . "&#x2014;\\1")	; mdash
> +    ("--\\([^-]?\\)" . "&#x2013;\\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:

  ("---" . "&#x2014;")

or

  ("\\([^-]\\|^\\)---\\([^-]\\|$\\)" . "\\1&#x2014;\\2")

I think the former is on par with LaTeX behaviour.


What do you think?


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2014-02-08  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01 22:29 Bug: unconverted dashes in HTML export Thomas Morgan
2014-02-08  9:29 ` Nicolas Goaziou [this message]
2014-02-10  9:33   ` Thomas Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ha8aymst.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tlm@ziiuu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).