emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Nathan Nichols <nathannichols454@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Ability to specify :html-head as a function
Date: Sat, 22 Jun 2024 12:35:19 +0000	[thread overview]
Message-ID: <87a5jdi29k.fsf@localhost> (raw)
In-Reply-To: <CACJZKxi4z1x_6r2AqnxODJf9sOrCUj0+_Mj051-YdwsRVuyvLA@mail.gmail.com>

Nathan Nichols <nathannichols454@gmail.com> writes:

>> This looks like a copy-paste of `org-element-normalize-string'.
>> Why not simply calling `org-element-normalize-string'?
>
> I changed it at one point, but then changed it back and didn't realize that
> it was ultimately unchanged.
> Here's a patch that uses `org-element-normalize-string` instead.

Thanks!

> +(defun org-html-normalize-str-or-fn (input &rest trailing)
> +  "If INPUT is a string, it is passed to `org-element-normalize-string'.

Ideally, the first line of the docstring should fully describe what
function does.

Maybe you can add something like

   Normalize INPUT function or string.  Return a string or nil.

> +If INPUT is a function, it is applied to arguments TRAILING, and the result is
> +passed to `org-element-normalize-string'."
> +  (let ((s (if (functionp input) (format "%s" (apply input trailing)) input)))
> +    (org-element-normalize-str s)))
       ^org-element-normalize-string

TRAILING name is confusing because it is not what one expects to be a
name of function arguments.  Maybe

    (defun org-html-normalize-str-or-fn (input &rest args)


Also, you need to update docstrings and type definitions for
`org-html-head' and `org-html-head-extra', update the Org manual, and
announce the new allowed values in etc/ORG-NEWS.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


      reply	other threads:[~2024-06-22 12:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13  0:04 [PATCH] Ability to specify :html-head as a function Nathan Nichols
2024-05-13 15:23 ` Ihor Radchenko
     [not found]   ` <CACJZKxjn-z2g81zJ2N1_-GMxd2stqC-4wZPVpNSiwtMj1V+jKQ@mail.gmail.com>
     [not found]     ` <87zfriscml.fsf@localhost>
     [not found]       ` <CACJZKxgwmRd_CewmqQX8e+PEM=XX=93zasL3JsAovwgSAgRguQ@mail.gmail.com>
     [not found]         ` <87v824904a.fsf@localhost>
     [not found]           ` <CACJZKxgjLizWkJ6qpoh759mmM5XjCviJiPbCmuRHiJph2Hbddg@mail.gmail.com>
     [not found]             ` <87bk3v78zq.fsf@localhost>
     [not found]               ` <CACJZKxgSGUikb8ecGjtVXi05gYfme8-POAiEWq-6cyWDnXozRg@mail.gmail.com>
     [not found]                 ` <87jziiptoh.fsf@localhost>
2024-06-21 19:21                   ` Nathan Nichols
2024-06-22 12:35                     ` Ihor Radchenko [this message]

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=87a5jdi29k.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=nathannichols454@gmail.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).