YAML sequence block doesn't need to indent

0 votes
asked Feb 5 in Bug by Martin (5,640 points)

According to the spec

"Since people perceive the “-” indicator as indentation, nested block sequences may be indented by one less space to compensate

So the following is valid:

@startyaml
A:
  B:
  - item 1
  - item 2
@endyaml
But PlantUML loses B

I noticed this because it is used on https://yaml.org

@startyaml
Projects:
  Delphi:
  - Neslib.Yaml        # YAML 1.1 Delphi binding to libyaml                                | YTS
  Golang:
  - Go-yaml            # YAML support for the Go language.
  - Go-gypsy           # Simplified YAML parser written in Go.
  - goccy/go-yaml      # YAML 1.2 implementation in pure Go.
  Haskell:
  - HsYAML             # YAML 1.2 implementation in pure Haskell                           | YTS
  - YamlReference      # Haskell 1.2 reference parser
  - yaml               # YAML 1.1 parser/renderer for Haskell (based on libyaml)
@endyaml

Note the missing Delphi/GoLang/Haskell layer:

(The YAML spec is ridiculously complicated for what it actually achieves!)

1 Answer

0 votes
answered Feb 7 by Martin (5,640 points)
selected Feb 7 by Martin
 
Best answer
This is fixed now!
commented Feb 8 by albert (3,120 points)
edited Feb 8 by albert

I'm not sure, it looks like the first example:

@startyaml
A:
  B:
  - item 1
  - item 2
@endyaml

doesn't work.

By accident I made a typo (note the extra p in the @endyampl but the same accounts that it is OK when using just @end):

@startyaml
A:
  B:
  - item 1
  - item 2
@endyampl

and this looks like to work!!

NOTE: locally both versions worked the wrong part I saw was on the plantuml webserver

OK: http://www.plantuml.com/plantuml/uml/SoWkIImggKpCpU5ojE9IK7024ReAcIMfkGg62AOHbqDgNWe0

Wrong: http://www.plantuml.com/plantuml/uml/SoWkIImggKpCpU5ojE9IK7024ReAcIMfkGg62AOHbqDgNWf86G00

commented Feb 9 by Martin (5,640 points)
Hi albert, you've fallen into the same trap I fell into recently.  It's a browser caching issue - hence why a small tweak fixes it.  In my browser (Opera) "control-F5" forces a page reload without cache, there's probably something similar available in whatever browser you use (...then it's just a case of remembering to use it!).
commented Feb 9 by albert (3,120 points)
Sounds logical. I cleared my cache (FireFox), restarted the browser and the problem still happened. I also tried it with Google Chrome and Microsoft Edge but in both cases I saw the wrong image (and here it cannot be cached as I didn't use these ones for a while).
commented Feb 9 by Martin (5,640 points)
strange.  makes it sound like the caching is on the Plantuml server side then, or at your ISP.

All I can say is that the two examples you posted above render identically (and correctly showing "B") for me...
commented Feb 9 by albert (3,120 points)
Very weird problem as the svg and ascii art versions on the server look OK.
...