emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag


From: Nicolas Goaziou
Subject: Re: ox-html Incorrectly (?) Puts HTML Into the `<title>` Tag
Date: Thu, 22 Apr 2021 17:36:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

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
user?

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-html-plain-text
   (org-element-interpret-data (plist-get info :title)) info)

with

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

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
                                  (org-export-create-backend
                                   :transcoders
                                   '((bold . (lambda (_ c _) c))
                                     (italic . (lambda (_ c _) c))))
                                  info))

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.

Regards,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]