Adding an array of same variable names in yaml file - yaml

for this website, it takes information from a authors.Yaml file.
this file holds the detail for the demo author.
authors:
- slug: wutali
name: Takahiro Fujiwara
introduction:
Co-founder and CTO at Fuller, Inc. / Software & Data Engineer /
Python / Golang / React
however, I wish to put in my information.
- slug: Hemming
name: Alexander Hemming
introduction:
Developer, React, Node, Sveltekit, Goland.
- slug: Owner
name: John Doe
introduction:
Founder and CEO at a company.
adding this to the end doesn't seem to work. How would I make it some that this information is accessible for additional potential authors?

You have two indentation errors:
- slug: Hemming
name: Alexander Hemming
introduction:
Developer, React, Node, Sveltekit, Goland.
- slug: Owner # fixed indentation to be on par with previous item
name: John Doe
introduction: # next line must be more indented to be the value
# of this key.
Founder and CEO at a company.

Related

Quarto: unnumbering Preface in TOC; output both PDF and html

I have put together a Quarto book by collecting a few articles I wrote previously. I didn't use the Quarto book template. Instead, I wrote a simple yaml for the book. The book compiled fine to html. Three questions:
The Preface in the sidebar is numbered (picture below). It is not supposed to. The first chapter should be "Atlas".
I have tried "# Preface {.unnumbered}" in the Preface. It didn't stop the numbering in the sidebar.
In RStudio, I have only one output option: html. What should I put in the yaml to have the pdf option? Here's the _quarto.yaml of the book:
project:
type: book
output-dir: _book
book:
title: "The World"
reader-mode: true
chapters:
- index.qmd ## this is the Preface
- Chap1.qmd ## Chapter 1: Atlas
- Chap2.qmd ## Chapter 2: Titan
- Chap3.qmd ## Chapter 3: Goliath
- Chap4.qmd ## Chapter 4: Am Fear Liath Mòr
format:
html:
theme:
- darkly
In the book, all the references to chapters/sections/pictures are underscored hyperlinks. How to remove those underscores? Including "code-link: false" in the format section didn't seem working.
I figured out question #2. To turn on the PDF build option, add:
output: pdf_document
in _quarto.yml.

yaml syntax for an object list

so we use yaml for translations at the moment.
So imagine the following list as an idea (not the real one)
# Employee records
- martin:
name: Martin D'vloper
job: Developer
skills: "Preferred skills"
mostPreferred: python
leastPreferred: perl
notImportant: pascal
- tabitha:
name: Tabitha Bitumen
job: Developer
skills:
- lisp
- fortran
- erlang
So what I want to know is, in the case of skills for Martin, I want to define skills, and then it needs to have a subgroup of itself for the other keys.
explaining how it works, site checks for the keys on the translation file, and there is a key that would be employee.martin.skills.mostPreferred for which it retrieves the variable, but for the label of that section it also wants to get the variable saved for the workd employee.martin.skills.
how would this be achieved on yaml?
at the moment I see the code doing this
- martin:
name: Martin D'vloper
job: Developer
skills: "Preferred skills"
"skills":
mostPreferred: python
leastPreferred: perl
notImportant: pascal
is this correct and necessary?

Ansible - recursive argument_spec

I'm trying to create a role with argument validation via the meta/arguments_spec.yml file, and I'd like a user to be able to pass in a tree of arbitrary depth as one of the arguments. In other words, a valid family_tree argument might look like:
family_tree:
name: Sarah
children:
- name: John
- name: Jimmy
- name: Billy
But it may also look like:
family_tree:
name: Bob
children:
- name: Bob, Jr.
children:
- name: Bob, III
children:
- name: Bob, IV
children:
# and so on...
This would require a recursive reference of some kind, however, I can't seem to find anything that supports this in the native argument_spec options. I know how to create recursive references via JSON Schema, and I'm aware the ansible.utils.validate supports JSON Schema as well, but as far as I can tell, this would mean manually adding a task to the beginning of my role's tasks list, which defeats the purpose of a dedicated argument_spec file and makes things harder to reason about, so not my preferred option.

Writing YAML files in Ruby: lack of pretty printing formatting options

Considering writing/reading files in YAML format (http://yaml.org/)
I'm just surprised by apparent lack of output formatting options in default YAML.dump (Ruby 2.2.3). Without any pretty printing option, the YAML.dump appears really ugly. I explain:
Consider this hand-written YAML configuration file 'config/bots.yml' where I have a list of items (hashes, each one with keys 'token' and 'comment':
input file:
- token: 070743004:yuSJJdB5L354Zq41iGIggSdYGJ1IhVh8XSrA
comment: ROSPOshop.com
- token: 998001334:zAFo4dBdd3ZZtqKiGdPqkkYGJ1ppVW8pUZ
comment: pagoSALDO.com bot
- token: 184679990:BBBBBBBBBCCCCCCCGIDDDDDDDHHHHHHHHHH
comment: SOLYARISoftware demo bot
- token: 184679990:BBBBBBBBBCCCCCCUUUUUUUUUUHHHHHHHHHH
comment: Another demo bot
- token: 184679990:BBBBBBBBBCCCCCCCGHGGHHGHGHHHHHHHHHH
comment: Yet Another demo bot
No elaboration: just a load and a successive dump script as:
config = YAML.load(File.open('config/bots.yml'))
File.open('config/bots.yml', "w") { |f| f.write(YAML.dump(config)) }
output file:
---
- token: 070743004:yuSJJdB5L354Zq41iGIggSdYGJ1IhVh8XSrA
comment: ROSPOshop.com
- token: 998001334:zAFo4dBdd3ZZtqgKiGdPqkkYGJ1ppVW8pUZ
comment: pagoSALDO.com bot
- token: 184679990:BBBBBBBBBCCCCCCCGIDDDDDDDHHHHHHHHHH
comment: SOLYARISoftware demo bot
- token: 184679990:BBBBBBBBBCCCCCCUUUUUUUUUUHHHHHHHHHH
comment: Another demo bot
- token: 184679990:BBBBBBBBBCCCCCCCGHGGHHGHGHHHHHHHHHH
comment: Yet Another demo bot
I'm unhappy because all array items are now collapsed (the line break is removed). That's very sad if the numbers of items is long and/or data structures for each item isa variable: a messy reading!
Question (1)
There is any YAML option do do some more pretty printing for YAML.dump ?
By example to separate with a blank line each item in an Array ?
Question (2)
I found this very helpfull tutorial ("YAML Cookbook"):
http://www.yaml.org/YAML_for_ruby.html#yaml_for_ruby
There is any more recent update / official Ruby doc about explaining YAML tips&tricks (data conversions, etc.) ?
Question (3)
Any possible YAML alternative ? I mean maybe an alternative gem to read/write YAML ? BTW, of course I considered JSON, but I prefer the more clear YAML format when reading texts data!
UPDATED
BTW, A lot of info/useful YAML format tips here:
https://en.wikipedia.org/wiki/YAML
You can write your own pretty-print solution, if that's all you're looking for. For example:
config = YAML.load(File.open('bots.yml'))
puts config.to_yaml.gsub("\n-", "\n\n-")
Output:
---
- token: 070743004:yuSJJdB5L354Zq41iGIggSdYGJ1IhVh8XSrA
comment: ROSPOshop.com
- token: 998001334:zAFo4dBdd3ZZtqKiGdPqkkYGJ1ppVW8pUZ
comment: pagoSALDO.com bot
- token: 184679990:BBBBBBBBBCCCCCCCGIDDDDDDDHHHHHHHHHH
comment: SOLYARISoftware demo bot
- token: 184679990:BBBBBBBBBCCCCCCUUUUUUUUUUHHHHHHHHHH
comment: Another demo bot
- token: 184679990:BBBBBBBBBCCCCCCCGHGGHHGHGHHHHHHHHHH
comment: Yet Another demo bot

Citeproc YAML for a legal case citation

I am using Pandoc and want to cite a legal case. I want to enter the necessary data in YAML, similar to this:
- title: One-click science marketing
volume: '11'
URL: http://dx.doi.org/10.1038/nmat3283
DOI: 10.1038/nmat3283
issue: '4'
container-title: Nature Materials
publisher: Nature Publishing Group
author:
- family: Fenner
given: Martin
orcid: 0000-0003-1419-2405
page: 261-263
id: fenner2012a
type: article-journal
issued:
date-parts:
- 2012
- 3
(Cited: Blog entry by Martin Fenner)
After lengthy research I still don't know which fields I can use for a legal case. There are several CLS for legal cases, but I don't find any information what fields they expect. How I do find them out without reading through the CLS file, which I hardly understand?
Thanks for any help!
Some of the fields you can use for a legal case are shown in this Zotero entry exported to CSL JSON and then converted to CSL YAML. You will still have to find out which of the CSL files support these fields. https://forums.zotero.org/11/ may provide further assistance.
---
references:
- id: a
type: legal-case
author:
- family: Author
given: Al
issued:
- year: 1999
title: Title
container-title: Reporter
authority: Court
page: 123-456
volume: 9
number: Docket Number
references: History
abstract: Abstract
language: en-US
...

Resources