I have a yaml configuration file that looks something similar to this:
# This file is placed at _data/snakemake_config.yaml
control: "controls/master_control.csv"
results_dir: "results"
generation:
genome_save_dir: "genome/star"
gtf_file: "genome/Homo_sapiens.105.gtf"
I'd like to output the contents of this file on the screen as a sort of "live-updater", so if I change something in the config file (say, updating control: to control: "controls/new_default_file.csv"), its changes will also be reflected in the Jekyll/Liquid markdown page. This is what I've done so far, but it places an extra newline on every line:
{% comment %}
This can be under index.md
Note: indentation is intentional, read further for reasoning
{% endcomment %}
```yaml
{% for line in site.data.snakemake_config %}
{% if line[0] == "generation" %}
{{- line[0] }}:
{% for element in site.data.snakemake_config.generation %}
{{- element[0] -}}: {{ element[1] }}
{% endfor %}
{% else %}
{{- line[0] -}}: {{ line[1] }}
{% endif %}
{% endfor %}
```
This is the output I get:
control: controls/master_control.csv
results_dir: results
generation:
genome_save_dir: genome/star
gtf_file: genome/Homo_sapiens.105.gtf
I'm able to remove a few of the newlines by placing various lines of the Liquid code on the same line, but then readability is extremely difficult (not to mention maintaining in the future). Even now, the Liquid portion isn't easily readable - no indentation on nested for/if statements, etc.
Ideally, I would effectively "copy and paste" the contents of the snakemake_config.yaml file info index.md
Does anyone have an idea on how I can go about doing this? Thanks for any help!