Skip to content

Commit b013e7a

Browse files
committed
More TODOs
1 parent 0d4ac97 commit b013e7a

File tree

18 files changed

+25
-152
lines changed

18 files changed

+25
-152
lines changed

‎config/allconfig/alldecoders.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ var allDecoderSetups = map[string]decodeWeight{
246246
err error
247247
defaultContentLanguage string
248248
)
249-
p.c.Languages, defaultContentLanguage, err = langs.DecodeConfig2(p.c.RootConfig.DefaultContentLanguage, p.c.RootConfig.DisableLanguages, m)
249+
p.c.Languages, defaultContentLanguage, err = langs.DecodeConfig(p.c.RootConfig.DefaultContentLanguage, p.c.RootConfig.DisableLanguages, m)
250250
if err != nil {
251251
return fmt.Errorf("failed to decode languages config: %w", err)
252252
}

‎hugolib/content_map.go‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ func (p *resourceSource) lookupContentNodes(siteVector sitesmatrix.Vector, fallb
208208
}
209209
}
210210

211-
func (r *resourceSource) ForEeachIdentity(f func(identity.Identity) bool) bool {
212-
return f(r.GetIdentity())
213-
}
214-
215211
func (r *resourceSource) Path() string {
216212
return r.path.Base()
217213
}

‎hugolib/content_map_page_assembler.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,15 @@ func (a *allPagesAssembler) createAllPages() error {
326326
}
327327
return
328328
case *pageState:
329+
// Nothing to do.
330+
ns = doctree.NodeTransformStateNone
329331
return v, ns, nil
330332
case contentNodesMap:
331-
ns = doctree.NodeTransformStateUpdated
333+
ns = doctree.NodeTransformStateNone
332334
for _, vv := range v {
333335
switch m := vv.(type) {
334336
case *pageMetaSource:
337+
ns = doctree.NodeTransformStateUpdated
335338
_, err := handlePageMetaSource(m, v, true)
336339
if err != nil {
337340
return nil, 0, fmt.Errorf("failed to create page from pageMetaSource %s: %w", s, err)
@@ -341,7 +344,7 @@ func (a *allPagesAssembler) createAllPages() error {
341344
}
342345
}
343346

344-
return v, 0, nil
347+
return v, ns, nil
345348

346349
default:
347350
panic(fmt.Sprintf("unexpected type %T", n))

‎hugolib/content_map_page_contentnode.go‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ func (n contentNodes) sample() contentNode {
220220
return n[0]
221221
}
222222

223-
func (n contentNodes) resetBuildState() {
224-
// Nothing to do for now.
225-
}
226-
227223
type contentNodesMap map[sitesmatrix.Vector]contentNode
228224

229225
var cnh helperContentNode
@@ -286,7 +282,7 @@ func (h helperContentNode) markStale(n contentNode) {
286282
func (h helperContentNode) resetBuildState(n contentNode) {
287283
n.forEeachContentNode(
288284
func(_ sitesmatrix.Vector, nn contentNode) bool {
289-
if nnn := nn.(contentNodeBuildStateResetter); nnn != nil {
285+
if nnn, ok := nn.(contentNodeBuildStateResetter); ok {
290286
nnn.resetBuildState()
291287
}
292288
return true

‎hugolib/content_map_test.go‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ import (
2020
"testing"
2121

2222
qt "github.com/frankban/quicktest"
23-
"github.com/gohugoio/hugo/common/paths"
2423
"github.com/gohugoio/hugo/hugolib/sitesmatrix"
25-
"github.com/gohugoio/hugo/identity"
2624
)
2725

2826
func TestContentMapSite(t *testing.T) {
@@ -444,29 +442,14 @@ type testContentNode struct {
444442
key string
445443
}
446444

447-
func (n *testContentNode) GetIdentity() identity.Identity {
448-
return identity.StringIdentity(n.key)
449-
}
450-
451-
func (n *testContentNode) ForEeachIdentity(cb func(id identity.Identity) bool) bool {
452-
panic("not supported")
453-
}
454-
455445
func (n *testContentNode) Path() string {
456446
return n.key
457447
}
458448

459-
func (n *testContentNode) PathInfo() *paths.Path {
460-
panic("not supported")
461-
}
462-
463449
func (n *testContentNode) forEeachContentNode(f func(v sitesmatrix.Vector, n contentNode) bool) bool {
464450
panic("not supported")
465451
}
466452

467-
func (n *testContentNode) resetBuildState() {
468-
}
469-
470453
// Issue 12274.
471454
func TestHTMLNotContent(t *testing.T) {
472455
filesTemplate := `

‎hugolib/doctree/nodeshifttree.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ type (
3333
}
3434

3535
// Shifter handles tree transformations.
36-
// TODO1 clean up all the description in here and elsewhere where dimensions etc. are mentioned and remove unused.
3736
Shifter[T any] interface {
3837
// ForEeachInDimension will call the given function for each value in the given dimension d.
3938
// If the function returns true, the walk will stop.

‎hugolib/filesystems/basefs.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ func (b *sourceFilesystemsBuilder) createMainOverlayFs(p *paths.Paths) (*filesys
626626

627627
overlayMounts: overlayfs.New(overlayfs.Options{}),
628628
overlayMountsContent: overlayfs.New(overlayfs.Options{DirsMerger: hugofs.AppendDirsMerger}),
629-
overlayMountsStatic: overlayfs.New(overlayfs.Options{}), // TODO1
629+
overlayMountsStatic: overlayfs.New(overlayfs.Options{}),
630630
overlayFull: overlayfs.New(overlayfs.Options{}),
631631
overlayResources: overlayfs.New(overlayfs.Options{FirstWritable: true}),
632632
}

‎hugolib/page.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ func (ps *pageState) siteVectors() sitesmatrix.VectorIterator {
531531
return ps.s.siteVector
532532
}
533533

534-
// TODO1 name.
534+
// Rotate returns all pages in the given dimension for this page.
535535
func (ps *pageState) Rotate(dimensionStr string) (page.Pages, error) {
536536
dimensionStr = strings.ToLower(dimensionStr)
537537
key := ps.Path() + "/" + "rotate-" + dimensionStr

‎hugolib/page__content.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ type contentParseInfo struct {
186186
itemsStep2 []any
187187

188188
// The shortcode handler.
189-
shortcodeParseInfo *shortcodeParsInfo
189+
shortcodeParseInfo *shortcodeParseInfo
190190
}
191191

192192
func (pi *contentParseInfo) AddBytes(item pageparser.Item) {

‎hugolib/page__meta.go‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,10 @@ import (
5454

5555
var cjkRe = regexp.MustCompile(`\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}`)
5656

57-
// Implement contentNodeI
5857
func (m *pageMetaSource) GetIdentity() identity.Identity {
5958
return m.pathInfo
6059
}
6160

62-
// ForEeachIdentityProvider calls cb for each Identity.
63-
// If cb returns true, the iteration is terminated.
64-
// The return value is whether the iteration was terminated.
65-
func (m *pageMetaSource) ForEeachIdentity(cb func(id identity.Identity) bool) bool {
66-
return cb(m.pathInfo)
67-
}
68-
6961
func (m *pageMetaSource) Path() string {
7062
return m.pathInfo.Base()
7163
}
@@ -78,12 +70,8 @@ func (m *pageMetaSource) forEeachContentNode(f func(v sitesmatrix.Vector, n cont
7870
return f(sitesmatrix.Vector{}, m)
7971
}
8072

81-
func (m *pageMetaSource) resetBuildState() {
82-
// Nothing to do.
83-
}
84-
8573
type pageMetaSource struct {
86-
pathInfo *paths.Path // Always set. This the canonical path to the Page. // TODO1 remove.
74+
pathInfo *paths.Path // Always set. This the canonical path to the Page.
8775
f *source.File
8876
pi *contentParseInfo
8977
contentAdapterSourceEntryHash uint64
@@ -1075,21 +1063,6 @@ func getParam(m resource.ResourceParamsProvider, key string, stringToLower bool)
10751063
}
10761064
}
10771065

1078-
// Implement contentNodeI.
1079-
// Note that pageMeta is just a temporary contentNode. It will be replaced in the tree with a *pageState.
1080-
// TODO1 make some partial interfaces.
1081-
func (m *pageMeta) GetIdentity() identity.Identity {
1082-
panic("not supported")
1083-
}
1084-
1085-
func (m *pageMeta) ForEeachIdentity(cb func(id identity.Identity) bool) bool {
1086-
panic("not supported")
1087-
}
1088-
1089-
func (m *pageMeta) resetBuildState() {
1090-
panic("not supported")
1091-
}
1092-
10931066
func getParamToLower(m resource.ResourceParamsProvider, key string) any {
10941067
return getParam(m, key, true)
10951068
}

0 commit comments

Comments
 (0)