emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Tim Visher <tim.visher@gmail.com>
Cc: Jens Lechtenboerger <lechten@wi.uni-muenster.de>,
	"Dr. Arne Babenhauserheide" <arne_bab@web.de>,
	Emacs Org Mode mailing list <emacs-orgmode@gnu.org>,
	Kyle Meyer <kyle@kyleam.com>
Subject: Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
Date: Thu, 22 Apr 2021 17:36:04 +0200	[thread overview]
Message-ID: <87bla649i3.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAHa53uxERrGDk=emzqAfQG5JmMsessQfMgoOtFUQTccAi4aYxQ@mail.gmail.com> (Tim Visher's message of "Thu, 22 Apr 2021 10:08:55 -0400")

Tim Visher <tim.visher@gmail.com> writes:

> Thanks for the tip. What I'm thinking more is somehow getting the heading
> pre-output generation, stripping any characters that `org` would consider
> special (I'm hoping there's already a function that can at least mark
> 'markup' text in a given org string), and _then_ passing it to whatever ox
> function is responsible for using the title. That way it's as generic as it
> can possibly be.

What format has "heading pre-output generation"? Is a string or is it
parsed data? The first part of your paragraph sounds like you want to
rewrite an Org parser.

How do you pass it to ox function responsible for using the title? I.e.,
who/what is responsible for making the change to the title? Is it the

You may need to clarify your specifications.

> I confess though that I don't follow exactly what you're talking about
> defining a temporary export back-end.

In `org-html--build-meta-info' from "ox-html.el", replace the following

   (org-element-interpret-data (plist-get info :title)) info)


  (org-export-data-with-backend (plist-get info :title)
                                 '((bold . (lambda (_ c _) c))
                                   (italic . (lambda (_ c _) c))))

Now re-evaluate the function `org-html--build-meta-info' and try
exporting a document to HTML with a title containing bold and italic
syntax, even nested, e.g.

  #+title: /Some *bold* text/

> Why would that be necessary or beneficial to the end of teaching org
> how to use only the 'plain text' of a heading for the title in N ox
> backends?

Adding the function `org-export-strip-syntax below to "ox.el"

  (defun org-export-strip-syntax (data info)
    (org-export-data-with-backend data
                                   '((bold . (lambda (_ c _) c))
                                     (italic . (lambda (_ c _) c))))

you can now call it from any export back-end whenever its needs to
remove syntax from a piece of code.

You can also drop the info argument and add it to "org-element.el". But
it depends on what you want to obtain. Also, some syntax is not obvious
to strip, as I suggested in my previous message.


  reply	other threads:[~2021-04-22 15:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 15:32 ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag Tim Visher
2021-01-12  1:19 ` Kyle Meyer
2021-01-12 14:51   ` Tim Visher
2021-01-13  3:43     ` Kyle Meyer
2021-01-13 15:26       ` Tim Visher
2021-01-21  4:10         ` Kyle Meyer
2021-03-30 22:58           ` Tim Visher
2021-04-11 15:11             ` Tim Visher
2021-04-20  3:01             ` Kyle Meyer
2021-04-20  4:58               ` Jens Lechtenboerger
2021-04-20 21:29                 ` Tim Visher
2021-04-21  5:21                   ` Jens Lechtenboerger
2021-04-21  6:39                     ` Dr. Arne Babenhauserheide
2021-04-21 15:05                       ` Tim Visher
2021-04-22 13:52                         ` Nicolas Goaziou
2021-04-22 14:08                           ` Tim Visher
2021-04-22 15:36                             ` Nicolas Goaziou [this message]
2021-04-22 17:34                               ` Tim Visher

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:

  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=87bla649i3.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=arne_bab@web.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    --cc=lechten@wi.uni-muenster.de \
    --cc=tim.visher@gmail.com \


* 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


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).