Skip to content

Seperate content and display #20

@edwardabraham

Description

@edwardabraham

I am using pubmatter to help with making a template for organisational reports. At the moment pubmatter mixes together content and display, for example looking at the show-title function below

  • it relies on a globally defined theme
  • It puts the title and subtitle within boxes that have insets and fill defined
#let show-title(fm) = {
  with-theme(theme => {
    set text(font: theme.font)
    let title = if (type(fm) == dictionary and "title" in fm) {fm.title} else if (type(fm) == str or type(fm) == content) { fm } else { none }
    let subtitle = if (type(fm) == dictionary and "subtitle" in fm) {fm.subtitle} else { none }
    if (title != none) {
      box(inset: (bottom: 2pt), width: 100%, text(17pt, weight: "bold", fill: theme.color, title))
    }
    if (subtitle != none) {
      parbreak()
      box(width: 100%, text(12pt, fill: gray.darken(30%), subtitle))
    }
  })
}

I would like to have content and display separated so that pubmatter returned blocks that would inherit styles from the rest of the document. For example, if show-title was defined as below, then it would be possible to style the title and subtitle from elsewhere in the template, through a show command show label("pm-subtitle"): set text(blue)

#let show-title(fm) = {
  let title = if (type(fm) == dictionary and "title" in fm) { fm.title } else if (
    type(fm) == str or type(fm) == content
  ) { fm } else { none }
  let subtitle = if (type(fm) == dictionary and "subtitle" in fm) { fm.subtitle } else { none }
  if (title != none) {
    text([#title <pm-title>])
  }
  if (subtitle != none) {
    parbreak()
    text([#subtitle <pm-subtitle>])
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions