Skip to content
This repository was archived by the owner on Oct 19, 2020. It is now read-only.
This repository was archived by the owner on Oct 19, 2020. It is now read-only.

Add support for parse less strict ordering Toml file #97

Description

@qianz2

Currently while we use Toml.ReadString(tomlContent), it will throw an exception if the toml file content has a less strict ordering. For example, here will throw an exception since params.plugins come before params .

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "ananke"

[params.plugins]
  # CSS Plugins
  [[params.plugins.css]]
  URL = "plugins/bootstrap/bootstrap.min.css"

[params]
home = "Home"

I agree that logically it has no problem, params should come before params.plugins.
However, in some cases, we try to detect a Hugo app, we still want to identify this file as a valid toml file and get TomlTable from it, because it contains valid configurations for a Hugo app. The ordering is a user mistakes, not necessary to fail the build.

So wondering if it's possible to support it? Add a setting option for us to parse Toml file less strictly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions