yaml 格式不正确

模板
Title: "Covid19 Digest"
Section1: "What's new in this issue?"
Heading 1:
  - "North America"
  - Content:
    - "abc"
    - "def"
  - "Asia-Pacific"
  - Content:
    - "jkl"
    - subcontent:
      - "apples"
      - "oranges"
      - "oranges"
    - "mnop"

这个 Yaml 文件模仿了一个 docx 文档。我们有文档的标题,然后是不同的部分。每个部分都有标题 1,标题 1 下是项目符号内容。问题在于它说格式不正确。我看到了这个教程https://www.cloudbees.com/blog/yaml-tutorial-everything-you-need-get-started

它似乎对他们有用。如何在密钥下创建密钥而不将其作为列表的一部分?例如标题 1 应该在第 1 部分下。我不能对内容进行硬编码,因为标题 1 和部分的数量是动态的,内容也是如此

西尔维奥·马约洛

如果您希望 `"Heading1" 成为顶级键,则需要对其进行 dedent

Title: "Covid19 Digest"
Section1: "What's new in this issue?"
Heading 1:
         - "North America"
         - Content:
             - "abc"
             - "def"
         - "Asia-Pacific"
         - Content:
            - "jkl"
            - subcontent:
                - "apples"
                - "oranges"
                - "oranges"
            - "mnop"

如果你想让它成为“Section 1”的一部分,你需要“Section 1”下的东西是一个对象。现在,它是一个字符串。考虑类似

Title: "Covid19 Digest"
Section1:
  Title: "What's new in this issue?"
  Heading 1:
         - "North America"
         - Content:
             - "abc"
             - "def"
         - "Asia-Pacific"
         - Content:
            - "jkl"
            - subcontent:
                - "apples"
                - "oranges"
                - "oranges"
            - "mnop"

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章