emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Thibault Marin <thibault.marin@gmx.com>
Cc: Uwe Brauer <oub@mat.ucm.es>, emacs-orgmode@gnu.org
Subject: Re: Bug: org-mime-htmlize generates unwanted equations numbers in mail [9.2.5 (release_9.2.5-521-gdea0c7 @ /home/oub/emacs/site-lisp/packages/org/)]
Date: Sun, 08 Dec 2019 21:40:54 +0100	[thread overview]
Message-ID: <87pngytusp.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87muc2snas.fsf@dell-desktop.WORKGROUP> (Thibault Marin's message of "Sun, 08 Dec 2019 13:08:11 -0500")

Hello,

Thibault Marin <thibault.marin@gmx.com> writes:

> Following-up on this bug report regarding the handling of unnumbered
> equation environments in HTML export, I would like to propose the
> attached patch.  The patch simply removes the caption for unnumbered
> environments.

Thank you.

> Could you please let me know whether this could be considered for a
> merge and if there any comments or suggestions to improve it?

Some comments follow.

> +(defun org-html--latex-environment-numbered-p (latex-frag)
                                                  ^^^^^^^^^^
                                                  latex-env

> +  "Return t if LATEX-ENV contains a numbered environment.

Non-nil if...

> +Environments with a star (*) character and displaymath are not
> numbered."

I think that "starred environments and displaymath" is enough.

However, I suggest to make this function operate on the element itself,
not its value, much like `org-html--math-environment-p'.

> +  (not (some 'identity
> +	     (mapcar (lambda (el)
> +		       (string-match el latex-frag))
> +		     '("\\`[ \t]*\\\\begin{[^*}]+?[*]}"
> +		       "\\`[ \t]*\\\\begin{displaymath}")))))

I suggest merging the two regexps into a single one, and use:

    (not (string-match-p REGEXP latex-env))

> +  (let* ((processing-type (plist-get info :with-latex))
> +	 (latex-frag (org-remove-indentation
> +		      (org-element-property :value latex-environment)))
> +         (attributes (org-export-read-attribute :attr_html latex-environment))
> +         (label (and (org-element-property :name latex-environment)
> +                     (org-export-get-reference latex-environment info)))
> +	 (caption (when (org-html--latex-environment-numbered-p
> +			 latex-frag)
> +		    (number-to-string
> +		     (org-export-get-ordinal
> +		      latex-environment info nil
> +		      (lambda (l info)
> +			(and (org-html--math-environment-p l)
> +			     (org-html--latex-environment-numbered-p
> +			      (org-remove-indentation
> +			       (org-element-property :value l))))))))))

Operating directly on the element will be a bit nicer. Why do you need
`org-remove-indentation'?

Could you send an updated patch and provide an ORG-NEWS entry (on top of
master)?

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2019-12-08 20:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  7:52 Bug: org-mime-htmlize generates unwanted equations numbers in mail [9.2.5 (release_9.2.5-521-gdea0c7 @ /home/oub/emacs/site-lisp/packages/org/)] Uwe Brauer
2019-11-01  8:49 ` Fraga, Eric
2019-11-01 13:55   ` Uwe Brauer
2019-11-02  6:22     ` Thibault Marin
2019-11-02  9:38       ` Uwe Brauer
2019-11-02 10:22         ` Fraga, Eric
2019-11-02 17:13           ` Uwe Brauer
2019-12-08 18:08         ` Thibault Marin
2019-12-08 20:40           ` Nicolas Goaziou [this message]
2019-12-08 23:44             ` Thibault Marin
2019-12-09 20:34               ` Nicolas Goaziou
2019-11-01 13:01 ` John Kitchin
2019-11-01 13:59   ` Uwe Brauer
2019-11-01 15:12     ` John Kitchin
2019-11-01 15:32       ` Uwe Brauer
2019-11-01 16:07       ` Uwe Brauer
2019-11-01 16:16         ` [debugger] (was: Bug: org-mime-htmlize generates unwanted equations numbers in mail [9.2.5 (release_9.2.5-521-gdea0c7 @ /home/oub/emacs/site-lisp/packages/org/)]) Uwe Brauer
2019-11-01 18:33         ` Bug: org-mime-htmlize generates unwanted equations numbers in mail [9.2.5 (release_9.2.5-521-gdea0c7 @ /home/oub/emacs/site-lisp/packages/org/)] John Kitchin
2019-11-02  9:18           ` Uwe Brauer
2020-02-11  8:20 ` Bastien
2020-02-11  9:24   ` Uwe Brauer
2020-02-11  9:45     ` Bastien

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=87pngytusp.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=oub@mat.ucm.es \
    --cc=thibault.marin@gmx.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).