page__common.go - hugo - [fork] hugo port for 9front
(HTM) git clone https://git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
page__common.go (2819B)
---
1 // Copyright 2019 The Hugo Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 package hugolib
15
16 import (
17 "sync"
18
19 "github.com/gohugoio/hugo/common/maps"
20 "github.com/gohugoio/hugo/compare"
21 "github.com/gohugoio/hugo/lazy"
22 "github.com/gohugoio/hugo/markup/converter"
23 "github.com/gohugoio/hugo/navigation"
24 "github.com/gohugoio/hugo/resources/page"
25 "github.com/gohugoio/hugo/resources/resource"
26 "github.com/gohugoio/hugo/source"
27 )
28
29 type nextPrevProvider interface {
30 getNextPrev() *nextPrev
31 }
32
33 func (p *pageCommon) getNextPrev() *nextPrev {
34 return p.posNextPrev
35 }
36
37 type nextPrevInSectionProvider interface {
38 getNextPrevInSection() *nextPrev
39 }
40
41 func (p *pageCommon) getNextPrevInSection() *nextPrev {
42 return p.posNextPrevSection
43 }
44
45 type pageCommon struct {
46 s *Site
47 m *pageMeta
48
49 sWrapped page.Site
50
51 // Lazily initialized dependencies.
52 init *lazy.Init
53
54 // Store holds state that survives server rebuilds.
55 store *maps.Scratch
56
57 // All of these represents the common parts of a page.Page
58 navigation.PageMenusProvider
59 page.AlternativeOutputFormatsProvider
60 page.ChildCareProvider
61 page.FileProvider
62 page.GetPageProvider
63 page.GitInfoProvider
64 page.InSectionPositioner
65 page.OutputFormatsProvider
66 page.PageMetaProvider
67 page.PageMetaInternalProvider
68 page.Positioner
69 page.RawContentProvider
70 page.RefProvider
71 page.ShortcodeInfoProvider
72 page.SitesProvider
73 page.TranslationsProvider
74 page.TreeProvider
75 resource.LanguageProvider
76 resource.ResourceDataProvider
77 resource.ResourceNameTitleProvider
78 resource.ResourceParamsProvider
79 resource.ResourceTypeProvider
80 resource.MediaTypeProvider
81 resource.TranslationKeyProvider
82 compare.Eqer
83
84 // Describes how paths and URLs for this page and its descendants
85 // should look like.
86 targetPathDescriptor page.TargetPathDescriptor
87
88 // Set if feature enabled and this is in a Git repo.
89 gitInfo *source.GitInfo
90 codeowners []string
91
92 // Positional navigation
93 posNextPrev *nextPrev
94 posNextPrevSection *nextPrev
95
96 // Menus
97 pageMenus *pageMenus
98
99 // Internal use
100 page.RelatedDocsHandlerProvider
101
102 contentConverterInit sync.Once
103 contentConverter converter.Converter
104 }
105
106 func (p *pageCommon) Store() *maps.Scratch {
107 return p.store
108 }
109
110 // See issue 13016.
111 func (p *pageCommon) Scratch() *maps.Scratch {
112 return p.Store()
113 }