ragynotes / ragynotes.github.io

๐ŸŒฟ Ragy Notes ๐Ÿ“š https://ragynotes.github.io
https://ragynotes.github.io
1 stars 0 forks source link

mdnotes-generates pages have bad yaml #25

Closed pskyhx closed 2 years ago

pskyhx commented 2 years ago

attempting to build

Error: Error building site: ".../ragynotes.github.io/content/testing/Nov22/document-1912botanicalsurveyofindia-mdn.md:3:1": failed to unmarshal YAML: yaml: line 2: mapping values are not allowed in this context
pskyhx commented 2 years ago

this in the template:

tags:                               # โš ๏ธ check how does this output
 - {{tags}}
#summary:                           # โ—

produces this:

tags:                               # โš ๏ธ check how does this output
 - #summary:                            # โ—

because there are no tags.

pskyhx commented 2 years ago

There is a colon in the title which breaks the YAML:

failed to unmarshal YAML: yaml: mapping values are not allowed in this context

Enclosing it in quotes seems to fix.

pskyhx commented 2 years ago

tags still displaying wrong possibly due to my irrational love of emojis:

tags:
 - mdnotes
 ๐Ÿ““-Academic-Periodicals

very weird, how the emoji gets put before the dash. If it is changed like this:

 - ๐Ÿ““Academic-Periodicals

the way it should be, it works.

Emoji in the middle of tag causes no problem.

Leading space added to front of tag gets removed

enclosing in brackets (๐Ÿ““)-Academic-Periodicals has original behaviour.

enclosing the name of the tag in double quotes in zotero has an interesting effect a suggesting maybe the emoji isn't actually the problem:

tags:
 - mdnotes
 zztest-tag  <<<<<<
 - delete-the-tag
 - but-don't-delete-the-file
 - how-about-๐Ÿ““-emojis?
 - "๐Ÿ““-Academic-Periodicals"

addressed in 37f6a3c:

{"content":"tags: \n{{field_contents}}", "field_contents": " - {{content}}", "link_style": "no-links", "list_separator": "\n", "remove_spaces": "true"}

and in the template file, just have {{tags}}.

The problem was not the emoji, it was the malformed json and yaml combo.

yaml spec: YA-ML Ainโ€™t Markup Language (YAMLโ„ข) revision 1.2.2

pskyhx commented 2 years ago

Problem: when values are missing

---
title: "{{title}}"
title-short: "{{shortTitle}}"
originalyear: {{date}}
type: "{{itemType}}"

alias: "{{citekey}}"
lang: "{{language}}"

draft: true

date: {{accessDate}}
---

becomes in a files with minimal metadata:

---
title: "ZZZZ test fake file"
title-short: ""
originalyear: type: ""

alias: "zotero-1405"
lang: ""

draft: true

date: ---

Problems:

  1. missing originalyear squashes next line into it
  2. end of yaml --- is not on own line.

solution to both: trailing space at end of line after }} retains the structure. Is trailing space in violation of yaml? If that ended up being the case, could solve similarly to tags above by re-integrating the whole line into the mdnotes output. for now it looks fine.

All my test files can now pass through mdnotes batch export without breaking hugo. :)