emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [PATCH] Enhance org-html--build-meta-info


From: TEC
Subject: Re: [PATCH] Enhance org-html--build-meta-info
Date: Mon, 14 Dec 2020 14:34:28 +0800
User-agent: mu4e 1.4.13; emacs 27.1

Bastien <bzg@gnu.org> writes:

> Let's wait for Jens feedback on this patch, since he took care of
> testing it so far.

Assuming Jens responds as he usually has (relatively promptly), this
sounds good to me :)

> In a nutshell, can you restate what problem is this patch fixing?

There are two things I intend to achieve with this patch:
1. DRY* out the existing code. The existing code is quite repetitive in
   structure, and easily lends itself to being extracted to a function.
   This is easier to read, and work with IMO.
2. Make use of the DRYer code in (1) to provide a make the meta building
    function more versatile, and then add in the ability for user
    customisation at low-cost (again, thanks to (1)).

*DRY is an acronym for "Don't Repeat Yourself", in case there's a french
 equivalent you're more familiar with.

> Is a new option really necessary here?

Necessary? Not really, I mean the export /works/ without it. I'd argue
that it's desirable though, as it provides an easy way for a user (such
as myself) to add useful meta tags not included by default. For example
I currently make use of this to add information that parsed by a large
number of services/apps to create rich embeds for exported Org files I
link to (see
https://tecosaur.github.io/emacs-config/config.html#extra-header-content,code--2
).

Furthermore, I consider it to be very low cost, since it's basically
just taking advantage of the restructuring already performed for code
QOL reasons.

I expect most users not to have any reason to touch this, but for some
to find it handy.

> Are there backward compatibility considerations we should take care of?

None AFAIK. Barring this errors that Jens raised, and now have hopefully
been addressed, this should function /exactly/ as the current
implementation does, with a minor (beneficial) caveat, mentioned below.
Just with nicer-to-work-with code and a bit more versatility (IMO, of
course).

These are the two changes to be mentioned:
1. The (or {title} "Org Export") bit I added.
   I believe the current behaviour when no #+title is given is to have a
   blank one (""). I think "Org Export" is preferable, as it's more
   informative than ... nothing.
2. Using org-html-encode-plain-text for formatting the content of the
   meta tags. From Jens, I take it that the current org-export-data can
   cause nested HTML tags, which are invalid in this context. Plain text
   should be safer.

>> +(defun org-html--build-meta-entry (label identity &optional content-format 
>> &rest content-formatters)
>> +  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from 
>> CONTENT-FORMAT and CONTENT-FORMATTER."
>
> The first line of this defun is too long.  You can try M-x checkdoc
> RET on your elisp files to catch those issues.
>
> Thanks,

I see, I'm guessing I'll just need to add a line break.

I hope that clarifies things!

Timothy



reply via email to

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