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

Add support for parse less strict ordering Toml file #97

Open
qianz2 opened this issue Oct 16, 2020 · 0 comments
Open

Add support for parse less strict ordering Toml file #97

qianz2 opened this issue Oct 16, 2020 · 0 comments

Comments

@qianz2
Copy link

qianz2 commented Oct 16, 2020

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant