nmfs-opensci / quarto_titlepages

A Quarto extension for making title and cover pages for PDF output.
https://nmfs-opensci.github.io/quarto_titlepages/
Creative Commons Zero v1.0 Universal
115 stars 20 forks source link

PandocLuaError "Cannot get Attr from TypeNil" #32

Closed DamonCharlesRoberts closed 1 year ago

DamonCharlesRoberts commented 1 year ago

I am running quarto 1.2.269 on Windows 11 in VSCode.

I have a book project where I am trying to add an image to my coverpage.

However, I am running into an issue where it looks like the titlepage extension is having issues with my metadata that I am passing in my _qarto.yml file for the project. Here is the meta data for the project.

project:
  type: book

book:
  title: "The Shape and Color of Politics"
  subtitle: "How citizens process political information and its consequences"
  author: "Damon C. Roberts"
  #date: today
  #date-format: long
  chapters:
    - index.qmd
    - chapter_1.qmd
    - chapter_2.qmd
    - chapter_3.qmd
    - chapter_4.qmd
    - conclusion.qmd
    - references.qmd
  appendices:
    - chapter_1_appendix.qmd
    - chapter_2_appendix.qmd
  #output-file: book

bibliography: "../../assets/references.bib"

format:
  titlepage-pdf:
    coverpage: true
    documentclass: scrbook
    classoption: ["oneside", "open=any"]
    #include-in-header: 
    #  text: |
    #    \usepackage{makeidx}
    #    \makeindex
    #include-after-body: 
    #  text: |
    #    \printindex

#geometry:
#  - right = 2.5cm
#  - left = 2.5cm

jupyter: python3
execute:
  echo: false
  cache: true

When I run:

quarto render

It runs into an error that seems to indicate its a problem with my meta data. Perhaps because I am running this in a project rather than a single qmd file?

Error running filter C:/Users/damon/Dropbox/current_projects/dissertation/drafts/main_draft/_extensions/nmfs-opensci/titlepage/titlepage-theme.lua:
PandocLuaError "Cannot get Attr from TypeNil"
stack traceback:
        ...t/_extensions/nmfs-opensci/titlepage/titlepage-theme.lua:11: in upvalue 'getVal'
        ...t/_extensions/nmfs-opensci/titlepage/titlepage-theme.lua:396: in function 'Meta'

Any advice?

eeholmes commented 1 year ago

Hi,

It is complaining because you didn't specify 'titlepage'. I thought I had fixed it so it would use "none" if titlepage was missing, but it looks like I didn't. So, just pass in "none" so it knows not to include the titlepage. Or if want it, choose one of the values such as "plain" or "vline" etc.

format:
  titlepage-pdf:
    titlepage: "none"
    coverpage: true
DamonCharlesRoberts commented 1 year ago

That fixed it! Thanks, @eeholmes. This is a wonderful resource!!

eeholmes commented 1 year ago

I patched the bug also. Now defaults to titlepage = "plain" if titlepage is missing.