Hello, Rasmus <ras...@gmx.us> writes:
> I'd quite like to be able to pass a formatting argument to {{{date}}}, > much like {{{time(FMT)}}}. This patch allows this. I think macros don't > normally have optional arguments, but I find it OK here since it's time > and modification-time works anyway... > > On the other hand there might be a good reason that I have overlooked for > why this isn't already accepting a formatting argument. > > Any objections? I have no objection, but please document it in the manual and add appropriate tests. > (cons "date" > - (org-element-interpret-data (plist-get info :date))) > + (let* ((date (plist-get info :date)) > + (date-string (org-element-interpret-data date))) > + ;; Interpret only single time-stamps. > + (case (and (not (cdr date)) > + (org-element-type (car date))) > + (timestamp > + (format > + "(eval (if (org-element-property :args macro) > + (org-export-get-date info \"$1\") > + \"%s\"))" > + date-string)) > + (t date-string)))) I suggest (cons "date" (format "(eval (if (org-string-nw-p \"$1\") %s %S))" "(org-export-get-date info \"$1\")" (or (org-element-interpret-data (plist-get info :date)) ""))) instead. Regards, -- Nicolas Goaziou