From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: Directional quotes in html Date: Tue, 06 Dec 2011 23:55:02 +0100 Message-ID: <4EDE9D46.2020509@christianmoe.com> References: <4EDE684C.7000801@christianmoe.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RY3pV-00022y-04 for emacs-orgmode@gnu.org; Tue, 06 Dec 2011 17:49:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RY3pT-0002lX-8P for emacs-orgmode@gnu.org; Tue, 06 Dec 2011 17:49:40 -0500 Received: from b1.hitrost.net ([91.185.211.67]:30151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RY3pS-0002l6-SW for emacs-orgmode@gnu.org; Tue, 06 Dec 2011 17:49:39 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Herbert Sitz Cc: emacs-orgmode@gnu.org On 12/6/11 9:37 PM, Herbert Sitz wrote: > Question: Does this work only if quotes both appear on the same line of Org-mode > text? Or is the regex applied to paragraph as a whole after it's been assembled > as part of export? Oops, that's embarrassing. I never even noticed. I'm not sure why it doesn't work -- the regexp /does/ catch multiline quotes. Anyway, after some experimenting, the following mess seems to work in most cases: #+begin_src (setq org-export-html-special-string-regexps (append '(("\\(^\\|[ \"(]\\)'" . "\\1‘") ("\\([^ ]\\)'" . "\\1’") ("\\(^\\|[ (]\\)\"" . "\\1“") ("\"\\([ [:punct:]]\\|$\\)" . "”\\1")) org-export-html-special-string-regexps)) #+end_src At least, it should work - if the opening single or double quotation mark comes at the beginning of the line, after a space, or after opening parenthesis, - or if the opening single quotation mark comes after an opening double quotation mark, - and if the closing double quotation mark comes before a space, before punctuation, including a closing parenthesis, or at the end of the line. It will work if you put the period /after/ the closing quotation mark, "like this". Typographically, though, you should do it "like this." > > It looks like it does only double-quotes; makes me realize single quotes are a > bit harder because they're often used alone as apostrophes. The above now also handles single quotes, including apostrophes between word characters ("it's"). The rule is that any single quote that is not an opening quote is turned into a closing quote, which works for apostrophes too. It also handles nested quotes (single quotes within double quotes). The following example should illustrate parentheses and nested quotes: #+begin_example Philosophy ain't easy ("being" is a surprisingly difficult concept, but not as hard as "non-being"). Who said: "'Being' is a surprisingly difficult concept, but not as hard as 'non-being'"? #+end_example > It seems like even > single-quote pairs could work well if you put beginning-of-word (\<) and > end-of-word (\<) regex anchors in there. I've experimented with those anchors, but ended up doing without them; punctuation mixes with quotation marks in odd ways. Yours, Christian