0.92.2 config parsing regression?

I admit my config.toml is a bit of a mess, having went through several theme changes and never bothering to properly clean it up, but up until and including 0.92.1 everything worked as expected.

Trying to build with 0.92.2 results in

Error: "/[path]/config.toml:1:1": unmarshal failed: toml: table en already exists
Total in 0 ms

Here’s the offending TOML in full:

## Basic Configuration
baseurl = "https://evgenykuznetsov.org/"
languageCode = "ru"

title = "DIMV"
theme = ["hugo-video", "loveit"]

DefaultContentLanguage = "ru"

# summarylength = 30

#paginate = 5

rssLimit = 20

enableGitInfo = true
enableRobotsTXT = true

enableInlineShortcodes = false

[author]
  name = "Evgeny Kuznetsov"
  email = "evgeny@kuznetsov.md"
  link = "https://evgenykuznetsov.org"
  image = "/img/avatar.jpg"
  nickname = "nekr0z"
  sex = "M"
  
[languages.ru.author]
  name = "Евгений Кузнецов"
  email = "evgeny@kuznetsov.md"
  link = "https://evgenykuznetsov.org"
  image = "/img/avatar.jpg"
  nickname = "nekr0z"
  sex = "M"
  
## Site Settings
[params]
    title = "DIMV"
    description = "Evgeny Kuznetsov"
    authorimage = "/img/avatar.jpg"
    dateformat = "January 2, 2006"
    mainSections = ["posts"]

    paginate = 20

    # sidebar, copyright & license
    copyright = "Evgeny Kuznetsov"
    showBuiltWith = true
    poweredBy = '<a rel="external nofollow" href="https://m.do.co/c/f1458b17f038" title="Digital Ocean referral link">Digital Ocean</a>'

    defaultTheme = "auto"

    WebmentionAccount = "evgenykuznetsov.org"

    websubHub = [
        "https://switchboard.p3k.io/",
        "https://evgenykuznetsov.superfeedr.com/",
    ]
    feedFiles = [
        "comments.xml",
        "index.xml",
        "single-language.xml",
    ]
    # Table of contents
    #toc = none, "hugo", or "tocbot"
    toc = "hugo"

    # LoveIt version
    version = "0.2.X"
    fingerprint = "sha384"
  
  [params.header]
    desktopMode = "fixed"
    mobileMode = "auto"

  [params.search]
    enable = true
    type = "lunr"
    contentLength = 4000
    placeholder = ""
    maxResultLength = 10
    snippetLength = 30
    highlightTag = "em"
    absoluteURL = false

  [params.footer]
    since = 2003
    license = '<a rel="license external" href="https://creativecommons.org/licenses/by-sa/4.0" title="License CC BY-SA 4.0 (where not otherwise specified)."><i class="fab fa-creative-commons"></i> <i class="fab fa-creative-commons-by"></i> <i class="fab fa-creative-commons-sa"></i></a>'

  [languages.ru.params.footer]
    since = 2003
    license = '<a rel="license external" href="https://creativecommons.org/licenses/by-sa/4.0/deed.ru" title="Лицензия CC BY-SA 4.0 (где не указано иное)."><i class="fab fa-creative-commons"></i> <i class="fab fa-creative-commons-by"></i> <i class="fab fa-creative-commons-sa"></i></a>'

  [languages.ru.params.home]
    rss = 20

  [languages.en.params.home]
    rss = 20

    [languages.ru.params.home.posts]
      enable = true
      paginate = 10

    [languages.en.params.home.posts]
      enable = true
      paginate = 10

    [languages.ru.params.home.profile]
      title = "Евгений Кузнецов"
      avatarURL = "/img/avatar.jpg"
      social = true

    [languages.en.params.home.profile]
      title = "Evgeny Kuznetsov"
      avatarURL = "/img/avatar.jpg"
      social = true

  [params.section]
    rss = 20

  [params.list]
    rss = 20

  [params.typeit]
    duration = -1

  [params.page]
    rssFullText = true
    lightgallery = true

    [params.page.toc]
      enable = false

    [params.page.comment]
      enable = true

    [params.page.code]
      copy = true
      maxShownLines = 100

[permalinks]
    # posts = "/:year/:slug"

[webmentions]
    excludesources = [
        "/tags/*",
        "/en/tags/*",
        "/categories/*",
        "/en/categories/*",
        "/feeds/*",
        "/awstats/*",
        "/repo/*",
        "/baikal/*",
        "/hfeed*",
        "/en/hfeed*",
        "/single-language*",
        "/en/single-language*",
        "/page/*",
        "/en/page/*",
        "/index.html",
        "/en/index.html",
        "/go/index.html",
        "/en/go/index.html",
        "/go/single-language.html",
        "/en/go/single-language.html",
    ]
    excludedestinations = [
        "https://evgenykuznetsov.org",
        "mailto:",
        "/tags/",
        "/en/tags/",
        "/categories/",
        "/en/categories/",
    ]
    alsoWatch = ["#webmentions"]
    excludeSelectors = ["#comments", ".post-nav", ".back-home-nav"]
    oldDir = "old/public"
    newDir = "public"
    concurrentFiles = 2
    concurrentRequests = 5

## Social Accounts
[params.social]
    GitHub = "nekr0z"
    Twitter = "nekr0z"
    # facebook = "evgkuz"
    orcid = "0000-0002-0343-0589"
    microblog = "nekr0z"
    wishlistr = "nekr0z"
    Email = "evgeny@kuznetsov.md"
    RSS = false
    PGPkey = "/key.asc"
    # gravatar = "your-email@example.com"
    
#  App icon config
[params.app]
    # optional site title override for the app when added to an iOS home screen or Android launcher
    title = "DIMV"
    # whether to omit favicon resource links
    noFavicon = false
    # modern SVG favicon to use in place of older style .png and .ico files
    svgFavicon = "/favicon.svg"
    # Android browser theme color
    themeColor = "#ffffff"
    # Safari mask icon color
    iconColor = "#6d2b2b"
    # Windows v8-10 tile color
    tileColor = "#ffc40d"

## Main Menu
[[languages.en.menu.main]]
    name = "Posts"
    weight = 100
    identifier = "posts"
    url = "/en/posts/"
[[languages.ru.menu.main]]
    name = "Записи"
    weight = 100
    identifier = "posts"
    url = "/posts/"
[[languages.en.menu.main]]
    name = "Reactions"
    weight = 200
    identifier = "reactions"
    url = "/en/reactions/"
[[languages.ru.menu.main]]
    name = "Реакции"
    weight = 200
    identifier = "reactions"
    url = "/reactions/"
[[languages.ru.menu.main]]
    name = '<i class="fas fa-tags fa-fw"></i>'
    weight = 370
    identifier = "tags"
    url = "/tags/"
[[languages.ru.menu.main]]
    name = '<i class="far fa-folder fa-fw"></i><i class="far fa-folder fa-fw"></i>'
    weight = 360
    identifier = "categories"
    url = "/categories/"
[[languages.en.menu.main]]
    name = '<i class="fas fa-tags fa-fw"></i>'
    weight = 370
    identifier = "tags"
    url = "/tags/"
[[languages.en.menu.main]]
    name = '<i class="far fa-folder fa-fw"></i><i class="far fa-folder fa-fw"></i>'
    weight = 360
    identifier = "categories"
    url = "/categories/"
[[languages.en.menu.main]]
    name = "About"
    identifier = "about"
    weight = 350
    url = "/en/about/"
[[languages.ru.menu.main]]
    name = "О сайте"
    identifier = "about"
    weight = 350
    url = "/about/"

[outputs]
    page = ["HTML", "htaccess", "commentsRSS"]
    home = ["HTML", "RSS", "hfeed", "lang", "langRSS", "JSON"]
    section = ["HTML", "RSS", "lang", "langRSS"]
    taxonomy = ["HTML", "lang"]
    term = ["HTML", "RSS", "lang", "langRSS"]

[mediaTypes]
  [mediaTypes."text/htaccess"]
    suffixes = ["htaccess"]

[outputFormats]
  [outputFormats.htaccess]
    mediaType = "text/htaccess"
    baseName = ""
    isPlainText = false
    notAlternative = true
  [outputFormats.hfeed]
    mediaType = "text/html"
    baseName = "hfeed"
    rel = "feed"
    permalinkable = true
  [outputFormats.lang]
    mediaType = "text/html"
    baseName = "single-language"
    permalinkable = true
  [outputFormats.langRSS]
    mediaType = "application/rss+xml"
    baseName = "single-language"
    permalinkable = false
    noUgly = true
  [outputFormats.commentsRSS]
    mediaType = "application/rss+xml"
    baseName = "comments"
    permalinkable = false
    noUgly = true

[markup]
  [markup.highlight]
    lineNos = true
    style = "github"
    noClasses = false
    guessSyntax = true
    lineNumbersInTable = true
  [markup.goldmark.renderer]
    # whether to use HTML tags directly in the document
    unsafe = true

[services]
  [services.youtube]
    privacyEnhanced = true

[privacy]
  [privacy.youtube]
    privacyEnhanced = true

[languages]
  [languages.en]
    languageName = "In English"
    weight = 2
    description = "Evgeny Kuznetsov's personal website"
    copyright = "Evgeny Kuznetsov"

  [languages.ru]
    languageName = "По-русски"
    weight = 1
    description = "Личный сайт Евгения Кузнецова"
    copyright = "Евгений Кузнецов"

[imaging]
quality = 90

[frontmatter]
  publishDate = [":default", ":fileModTime"]

This bit needs to be located before the rest of the language config:

[languages]
  [languages.en]
    languageName = "In English"
    weight = 2
    description = "Evgeny Kuznetsov's personal website"
    copyright = "Evgeny Kuznetsov"

  [languages.ru]
    languageName = "По-русски"
    weight = 1
    description = "Личный сайт Евгения Кузнецова"
    copyright = "Евгений Кузнецов"

We recently upgrade the TOML library (GitHub - pelletier/go-toml: Go library for the TOML file format) to address other issues.

See https://github.com/pelletier/go-toml/issues/739

1 Like

I see, so it’s a regression in a dependency. Let’s hope it gets resolved soon, thank you!

1 Like

I do not believe that it’s a “regression in a dependency”. The way TOML works you are re-defining the table langues.en if the less deep level call comes AFTER a deeper call.

False:

[languages.en.params.home]
something = value
[languages.en]
something = value

Right

[languages.en]
something = value
[languages.en.params.home]
something = value

Technically speaking to write

[languages.en.params.home]

implies the following:

[languages]
[languages.en]
[languages.en.params]
[languages.en.params.home]

if none of the sections before is specifically named BEFORE.

Always go from lower to deeper nesting. Also, indentation in TOML has no meaning other than being more readable, other than in YAML.

see TOML: English v1.0.0

I believe it is explicitly stated in the spec that “defining a super-table afterward is ok”, so treating [foo.bar] that comes after [foo.bar.baz] as an attempt to re-define [foo] or [foo.bar] is an error and a breach of spec.

That this is not the case anymore. And I linked the documents where tables in TOML are explained. The specific note says:

Likewise, using dotted keys to redefine tables already defined in [table] form is not allowed. The [table] form can, however, be used to define sub-tables within tables defined via dotted keys.

Careful what documentation you believe. The current valid TOML is 1.0.

I can’t deep-link to the sample in question, but it’s in the paragraph above this link here: TOML: English v1.0.0

The part of the documentation you’re referring to is referring to inline tables and is not relevant here. The relevant part of the TOML v1.0.0 spec is “Table”, and I quote:

You don’t need to specify all the super-tables if you don’t want to. TOML knows how to do it for you.

# [x] you
# [x.y] don't
# [x.y.z] need these
[x.y.z.w] # for this to work

[x] # defining a super-table afterward is ok

Confer the last line in the quoted code snippet, it explicitly and unambiguosly covers the case at hand.

Ok, last answer. I wrote “I can’t deep-link to the sample in question, but it’s in the paragraph above this link here” . ABOVE. Screenshot for you:

Let’s just say you are right, I am wrong. Just wait for it to be fixed upstream.

Sorry, I misread that. Still, the part on your screenshot is not relevant here. :wink:

In this example (on the screenshot), [fruit.apple] declaration would be invalid because it attempts to redefine an explicitly defined (and non-empty) table which already has color = "red" key-value pair in it. In the example I’ve quoted, [x] is an implicit empty table that had not been explicitly defined, and that’s ok to explicitly define it later, either empty or with key-value contents.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.