Interpolating Metadata

Hello,

I am new to quarto extensions and I was going through the process of creating one.

I wanted to add a header with the following fields: Project, Task, Calc by, and Check by.and it look something like this:
image

I would like to just provide the following in the yml file :

title: Untitled
format:
  hdr-pdf: default
date: last-modified
project: project info
task: task info
designer: ABC
checker: XYZ

Then I would like to interpolate this info in the latex file. I have something like this currently in the _extention.yml file:

title: Hdr
author: co1emi11er2
version: 1.0.0
quarto-required: ">=1.4.0"
contributes:
  formats:
    pdf:
      toc: true
      include-in-header: header.tex
      include-before-body: pagestyle.tex

Here is the relevant code from header.tex file:

%% Style the page number
\fancypagestyle{mystyle}{
  \fancyhf{}
  \renewcommand\headrulewidth{0.4pt}
  \fancyfoot[R]{\thepage}
  \fancyfootoffset{3.5cm}

  % Left Header
  \fancyhead[L]{%
      \textbf{Project:} \@project  \\ 
      \textbf{Task:} \@task
    }%

  % Right Header
  \fancyhead[R]{%
    \textbf{Calc by:} \@designer \\
    \textbf{Check by:}  \@checker
    }%
}

Is this something that can be done? Thanks!

I believe this can be done, though this is quite advanced. I say this because you need to know about how Pandoc is working, and how Lua filters works also.

Basically you need to play with Pandoc's template, and Quarto partials system : Article Templates – Quarto

You custom metadata should be available as variable to use in the template. You can use also Lua to tweak them more, or do processing on those.

I let you play with this.