emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* question about links, macros + org-publish and "parametrization"
@ 2024-05-28 10:02 Martin Steffen
  2024-05-29  8:44 ` Fraga, Eric
  2024-05-29 13:35 ` Ihor Radchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Martin Steffen @ 2024-05-28 10:02 UTC (permalink / raw)
  To: emacs-orgmode



Hi,

I got a question whether the following is possible, when using
org-publish. Concretely I generate with org-publish markdown-files (that
ultimately are turned to HTML), but I guess the question is not specific
for this choice of a ``publication-process''.'


The whole content consists of quite a number of files, and in particular
has quite many html-links, and the links change (each year, each
semester) and they change in ``systematic ways''


What has been  for instance

   https://www.gitpages.io/somelecture/fall23/exercises

will have to be changed for the next round to

   https://www.gitpages.io/somelecture/fall24/exercises

(and there are links for many things beside exercises, and also they
have to be changed analogously).


The way I make that smooth is I define

#LINK: exercises-web https://www.gitpages.io/somelecture/fall23/exercises


and then, When the semester comes, replace all occurrences of fall23 to
fall24. Even if there are quite a number of such link definitions (for
all kind of information), it's straightforward. It's systematically
organized, and if all the link definitions are centralized in some file
collectionoflinks.org or similar that is #INCLUDE:-ed into all the
other files that work with this links, then ``porting'' of the whole
set-up to a new semester is quite easy and robust.

So I am happy with that, but I wonder if I could make it even more
parametrized. Like


      combining macros with links


like that "fall23" is an argument to a macros, which then builds up a
link. But that does not to work in a naive way, like


#+MACRO: semester fall24
#+LINK: https://www.gitpages.io/somelecture/{{{semester}}}/exercises


since macros do replacement in "text" (not in those #+-"meta-commands").

I tried parametrized macros_

#+MACRO: parametricexercizes  https://www.gitpages.io/somelecture/$1/exercises


and that half-way works. I.e., if I do

               parametricexercizes(fall24)  (*)

it works in that it results in a page with a correct link, but that's
not quite what I want, for 2 reasons. Really useful would the
parametrization if one could do

  parametricexercizes(semester)

where semester is a macro, not a literal "fall24". The second reason is
that the use as in (*) is not really useful, what I am  really after is
something like

       [[parametricexercizes(fall24)][the exercises are here]]

and the combination of macros inside [[ .... ]] does not work either.



Maybe there are other ways to achieve ``parametrization'' (or maybe not,
I have not worked much with macros in Org), any ideas?

best, Martin













^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-05-31 10:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 10:02 question about links, macros + org-publish and "parametrization" Martin Steffen
2024-05-29  8:44 ` Fraga, Eric
2024-05-30  3:52   ` Martin Steffen
2024-05-30  5:03     ` Martin Steffen
2024-05-30  8:40       ` Fraga, Eric
2024-05-30 11:25         ` Martin Steffen
2024-05-30 16:28       ` Max Nikulin
2024-05-30 16:33         ` Ihor Radchenko
2024-05-31 10:29           ` Max Nikulin
2024-05-29 13:35 ` Ihor Radchenko

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