From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Add figure/table numbers to HTML captions Date: Fri, 28 Jun 2013 11:23:41 +0200 Message-ID: <87ppv6r3ky.fsf@gmail.com> References: <20130627.195226.131243714189666347.nom@cs.okayama-u.ac.jp> <87li5vsjb8.fsf@gmail.com> <20130628.101530.1683355082328893107.nom@quickhack.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsUu7-0000eQ-Ju for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 05:23:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsUu4-0007ny-01 for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 05:23:43 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:65510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsUu3-0007ng-QM for emacs-orgmode@gnu.org; Fri, 28 Jun 2013 05:23:39 -0400 Received: by mail-we0-f171.google.com with SMTP id m46so1331940wev.2 for ; Fri, 28 Jun 2013 02:23:39 -0700 (PDT) In-Reply-To: <20130628.101530.1683355082328893107.nom@quickhack.net> (Yoshinari Nomura's message of "Fri, 28 Jun 2013 10:15:30 +0900 (JST)") 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: Yoshinari Nomura Cc: emacs-orgmode@gnu.org Hello, Yoshinari Nomura writes: > Thanks, you encouraged me. Also, while I made this patch, I was in > the mood for consolidating some exporter-local functions around the > captions. Especially, ox-odt and ox-ascii seem to have rich functions to > add ordinal numbers to captions. It might be over-killing, though. ox-odt caption handling is more complex because it handles more elements (e.g., links to ODF files). ox-ascii provides the bare minimum wrt caption numbering. This is what your patch provides. > I'm afraid I made some misunderstand, but without this hunk, > Tables/Figures without captions are mistakenly counted as a part of > numbered staffs. As shown below, Figure[[fig:manual]] makes Figure3 > instead of Figure2. Of course, you're right. I realized that just after sending the message. Though, in the following snippet, (setq caption-predicate (if (org-element-property :caption destination) (lambda (elem &optional info) (org-element-property :caption elem)) (lambda (elem &optional info) (not (org-element-property :caption elem))))) I suggest to drop the "else" part. If destination hasn't got any caption, numbering doesn't make much sense anyway. You can re-use `org-html--has-caption-p'. > >>> - ("es" :default "Figura")) >>> + ("es" :default "Figura") >>> + ("ja" :html "図" :utf-8 "=E5=9B=B3")) >>> + ("Figure %d:" >>> + ("de" :default "Abbildung %d:") >>> + ("es" :default "Figura %d:") >>> + ("ja" :html "図%d:" :utf-8 "=E5=9B=B3%d:")) >>=20 >> Maybe you should also provide a :default value, otherwise it will use >> "Figure %d:" for latex, texinfo, ascii... > > Let me confirm, do you mean I should have add :default value to the ``ja'' > entry like: ("ja" :default "=E5=9B=B3" :html "図" :utf-8 "=E5=9B=B3= ")? In this > case, is the `:utf-8' meaning-less? Also, can I put UTF-8 word in > `:default'? :utf-8 will be used for ODT export and UTF-8 export. LaTeX export will try to use, in this order, :latex, :default and "Figure %d:". Plain ASCII will use, in this order, :ascii, :default and "Figure %d:". I suggest to use a simple entry for :default, maybe romanji, if it makes sense. You can also use UTF-8 encoding as :default, and provide some meaningful translation for :ascii. > I'll revise my patch in this weekend. thanks. Thank you. Regards, --=20 Nicolas Goaziou