golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.03k stars 17.67k forks source link

html/template: unexpected semantic differences compared to text/template #40075

Open rsc opened 4 years ago

rsc commented 4 years ago

I ported the text/template tests over to html/template and discovered some semantic differences between the two that I did not expect.

In html/template:

The <no value> change looks like it may possibly be intentional. All the others look like bugs.

/cc @robpike

gopherbot commented 4 years ago

Change https://golang.org/cl/241084 mentions this issue: html/template: add tests from text/template

cfiderer commented 4 years ago

Hi Go experts, is there any news on these behavioral differences? We'd like to have missing values rendered as "<no value>" in HTML templates, too...

rsc commented 4 years ago

@cfiderer My guess is that at this point adding <no value> to HTML templates would break Hugo users quite badly. /cc @bep

In general I think it would make sense to track down why these differences exist before removing them.