mrbaseman / parse_yaml

a simple yaml parser implemented in bash
GNU General Public License v3.0
165 stars 37 forks source link

double separator #5

Closed docsAsCode closed 4 years ago

docsAsCode commented 4 years ago

Hello,

Your script is very useful !

I don't know why but sometimes your script generates a double separator. It's very diffuclt for me to understand why because the same file can has single separator ou double.

Do you know this problem ?

yaml file :

table:
    stripes: even
    caption_prefix: Table
code:
    linenums: false
    theme: monokai_sublime
toc:
    display: true
    levels: 1
    title: Table OF Contents
    align: right
image:
    caption_prefix: Figure
heading:
    numbered: false
    chapter_prefix: Chapter
output:
    prefix: ~

the call :

parse_yaml config.yml "dac_" "_"

the result :

dac_table__stripes="even"
dac_table__caption_prefix="Table"
dac_code__linenums="false"
dac_code__theme="monokai_sublime"
dac_toc__display="true"
dac_toc__levels="1"
dac_toc__title="Table OF Contents"
dac_toc__align="right"
dac_image__caption_prefix="Figure"
dac_heading__numbered="false"
dac_heading__chapter_prefix="Chapter"
dac_output__prefix="~"
dac__=" dac_table dac_code dac_toc dac_image dac_heading dac_output"
dac_output__=" dac_output__prefix"
dac_toc__=" dac_toc__display dac_toc__levels dac_toc__title dac_toc__align"
dac_heading__=" dac_heading__numbered dac_heading__chapter_prefix"
dac_image__=" dac_image__caption_prefix"
dac_code__=" dac_code__linenums dac_code__theme"
dac_table__=" dac_table__stripes dac_table__caption_prefix"
mrbaseman commented 4 years ago

this double separator is because you are using 4 spaces for indentation. Default indentation in yaml is two spaces for each level.

mrbaseman commented 4 years ago

I think we can close this issue since an explanation has been provided