github.com/graemephi/kahugo@v0.62.3-0.20211121071557-d78c0423784d/resources/page/page_nop.go (about)

     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 page contains the core interfaces and types for the Page resource,
    15  // a core component in Hugo.
    16  package page
    17  
    18  import (
    19  	"html/template"
    20  	"time"
    21  
    22  	"github.com/gohugoio/hugo/identity"
    23  
    24  	"github.com/gohugoio/hugo/hugofs/files"
    25  	"github.com/gohugoio/hugo/tpl"
    26  
    27  	"github.com/gohugoio/hugo/hugofs"
    28  
    29  	"github.com/bep/gitmap"
    30  	"github.com/gohugoio/hugo/navigation"
    31  
    32  	"github.com/gohugoio/hugo/common/hugo"
    33  	"github.com/gohugoio/hugo/common/maps"
    34  	"github.com/gohugoio/hugo/source"
    35  
    36  	"github.com/gohugoio/hugo/config"
    37  	"github.com/gohugoio/hugo/langs"
    38  	"github.com/gohugoio/hugo/media"
    39  	"github.com/gohugoio/hugo/related"
    40  	"github.com/gohugoio/hugo/resources/resource"
    41  )
    42  
    43  var (
    44  	NopPage Page = new(nopPage)
    45  	NilPage *nopPage
    46  )
    47  
    48  // PageNop implements Page, but does nothing.
    49  type nopPage int
    50  
    51  func (p *nopPage) Aliases() []string {
    52  	return nil
    53  }
    54  
    55  func (p *nopPage) Sitemap() config.Sitemap {
    56  	return config.Sitemap{}
    57  }
    58  
    59  func (p *nopPage) Layout() string {
    60  	return ""
    61  }
    62  
    63  func (p *nopPage) RSSLink() template.URL {
    64  	return ""
    65  }
    66  
    67  func (p *nopPage) Author() Author {
    68  	return Author{}
    69  }
    70  
    71  func (p *nopPage) Authors() AuthorList {
    72  	return nil
    73  }
    74  
    75  func (p *nopPage) AllTranslations() Pages {
    76  	return nil
    77  }
    78  
    79  func (p *nopPage) LanguagePrefix() string {
    80  	return ""
    81  }
    82  
    83  func (p *nopPage) AlternativeOutputFormats() OutputFormats {
    84  	return nil
    85  }
    86  
    87  func (p *nopPage) BaseFileName() string {
    88  	return ""
    89  }
    90  
    91  func (p *nopPage) BundleType() files.ContentClass {
    92  	return ""
    93  }
    94  
    95  func (p *nopPage) Content() (interface{}, error) {
    96  	return "", nil
    97  }
    98  
    99  func (p *nopPage) ContentBaseName() string {
   100  	return ""
   101  }
   102  
   103  func (p *nopPage) CurrentSection() Page {
   104  	return nil
   105  }
   106  
   107  func (p *nopPage) Data() interface{} {
   108  	return nil
   109  }
   110  
   111  func (p *nopPage) Date() (t time.Time) {
   112  	return
   113  }
   114  
   115  func (p *nopPage) Description() string {
   116  	return ""
   117  }
   118  
   119  func (p *nopPage) RefFrom(argsm map[string]interface{}, source interface{}) (string, error) {
   120  	return "", nil
   121  }
   122  
   123  func (p *nopPage) RelRefFrom(argsm map[string]interface{}, source interface{}) (string, error) {
   124  	return "", nil
   125  }
   126  
   127  func (p *nopPage) Dir() string {
   128  	return ""
   129  }
   130  
   131  func (p *nopPage) Draft() bool {
   132  	return false
   133  }
   134  
   135  func (p *nopPage) Eq(other interface{}) bool {
   136  	return p == other
   137  }
   138  
   139  func (p *nopPage) ExpiryDate() (t time.Time) {
   140  	return
   141  }
   142  
   143  func (p *nopPage) Ext() string {
   144  	return ""
   145  }
   146  
   147  func (p *nopPage) Extension() string {
   148  	return ""
   149  }
   150  
   151  var nilFile *source.FileInfo
   152  
   153  func (p *nopPage) File() source.File {
   154  	return nilFile
   155  }
   156  
   157  func (p *nopPage) FileInfo() hugofs.FileMetaInfo {
   158  	return nil
   159  }
   160  
   161  func (p *nopPage) Filename() string {
   162  	return ""
   163  }
   164  
   165  func (p *nopPage) FirstSection() Page {
   166  	return nil
   167  }
   168  
   169  func (p *nopPage) FuzzyWordCount() int {
   170  	return 0
   171  }
   172  
   173  func (p *nopPage) GetPage(ref string) (Page, error) {
   174  	return nil, nil
   175  }
   176  
   177  func (p *nopPage) GetPageWithTemplateInfo(info tpl.Info, ref string) (Page, error) {
   178  	return nil, nil
   179  }
   180  
   181  func (p *nopPage) GetParam(key string) interface{} {
   182  	return nil
   183  }
   184  
   185  func (p *nopPage) GetTerms(taxonomy string) Pages {
   186  	return nil
   187  }
   188  
   189  func (p *nopPage) GitInfo() *gitmap.GitInfo {
   190  	return nil
   191  }
   192  
   193  func (p *nopPage) HasMenuCurrent(menuID string, me *navigation.MenuEntry) bool {
   194  	return false
   195  }
   196  
   197  func (p *nopPage) HasShortcode(name string) bool {
   198  	return false
   199  }
   200  
   201  func (p *nopPage) Hugo() (h hugo.Info) {
   202  	return
   203  }
   204  
   205  func (p *nopPage) InSection(other interface{}) (bool, error) {
   206  	return false, nil
   207  }
   208  
   209  func (p *nopPage) IsAncestor(other interface{}) (bool, error) {
   210  	return false, nil
   211  }
   212  
   213  func (p *nopPage) IsDescendant(other interface{}) (bool, error) {
   214  	return false, nil
   215  }
   216  
   217  func (p *nopPage) IsDraft() bool {
   218  	return false
   219  }
   220  
   221  func (p *nopPage) IsHome() bool {
   222  	return false
   223  }
   224  
   225  func (p *nopPage) IsMenuCurrent(menuID string, inme *navigation.MenuEntry) bool {
   226  	return false
   227  }
   228  
   229  func (p *nopPage) IsNode() bool {
   230  	return false
   231  }
   232  
   233  func (p *nopPage) IsPage() bool {
   234  	return false
   235  }
   236  
   237  func (p *nopPage) IsSection() bool {
   238  	return false
   239  }
   240  
   241  func (p *nopPage) IsTranslated() bool {
   242  	return false
   243  }
   244  
   245  func (p *nopPage) Keywords() []string {
   246  	return nil
   247  }
   248  
   249  func (p *nopPage) Kind() string {
   250  	return ""
   251  }
   252  
   253  func (p *nopPage) Lang() string {
   254  	return ""
   255  }
   256  
   257  func (p *nopPage) Language() *langs.Language {
   258  	return nil
   259  }
   260  
   261  func (p *nopPage) Lastmod() (t time.Time) {
   262  	return
   263  }
   264  
   265  func (p *nopPage) Len() int {
   266  	return 0
   267  }
   268  
   269  func (p *nopPage) LinkTitle() string {
   270  	return ""
   271  }
   272  
   273  func (p *nopPage) LogicalName() string {
   274  	return ""
   275  }
   276  
   277  func (p *nopPage) MediaType() (m media.Type) {
   278  	return
   279  }
   280  
   281  func (p *nopPage) Menus() (m navigation.PageMenus) {
   282  	return
   283  }
   284  
   285  func (p *nopPage) Name() string {
   286  	return ""
   287  }
   288  
   289  func (p *nopPage) Next() Page {
   290  	return nil
   291  }
   292  
   293  func (p *nopPage) OutputFormats() OutputFormats {
   294  	return nil
   295  }
   296  
   297  func (p *nopPage) Pages() Pages {
   298  	return nil
   299  }
   300  
   301  func (p *nopPage) RegularPages() Pages {
   302  	return nil
   303  }
   304  
   305  func (p *nopPage) RegularPagesRecursive() Pages {
   306  	return nil
   307  }
   308  
   309  func (p *nopPage) Paginate(seq interface{}, options ...interface{}) (*Pager, error) {
   310  	return nil, nil
   311  }
   312  
   313  func (p *nopPage) Paginator(options ...interface{}) (*Pager, error) {
   314  	return nil, nil
   315  }
   316  
   317  func (p *nopPage) Param(key interface{}) (interface{}, error) {
   318  	return nil, nil
   319  }
   320  
   321  func (p *nopPage) Params() maps.Params {
   322  	return nil
   323  }
   324  
   325  func (p *nopPage) Page() Page {
   326  	return p
   327  }
   328  
   329  func (p *nopPage) Parent() Page {
   330  	return nil
   331  }
   332  
   333  func (p *nopPage) Path() string {
   334  	return ""
   335  }
   336  
   337  func (p *nopPage) Permalink() string {
   338  	return ""
   339  }
   340  
   341  func (p *nopPage) Plain() string {
   342  	return ""
   343  }
   344  
   345  func (p *nopPage) PlainWords() []string {
   346  	return nil
   347  }
   348  
   349  func (p *nopPage) Prev() Page {
   350  	return nil
   351  }
   352  
   353  func (p *nopPage) PublishDate() (t time.Time) {
   354  	return
   355  }
   356  
   357  func (p *nopPage) PrevInSection() Page {
   358  	return nil
   359  }
   360  
   361  func (p *nopPage) NextInSection() Page {
   362  	return nil
   363  }
   364  
   365  func (p *nopPage) PrevPage() Page {
   366  	return nil
   367  }
   368  
   369  func (p *nopPage) NextPage() Page {
   370  	return nil
   371  }
   372  
   373  func (p *nopPage) RawContent() string {
   374  	return ""
   375  }
   376  
   377  func (p *nopPage) ReadingTime() int {
   378  	return 0
   379  }
   380  
   381  func (p *nopPage) Ref(argsm map[string]interface{}) (string, error) {
   382  	return "", nil
   383  }
   384  
   385  func (p *nopPage) RelPermalink() string {
   386  	return ""
   387  }
   388  
   389  func (p *nopPage) RelRef(argsm map[string]interface{}) (string, error) {
   390  	return "", nil
   391  }
   392  
   393  func (p *nopPage) Render(layout ...string) (template.HTML, error) {
   394  	return "", nil
   395  }
   396  
   397  func (p *nopPage) RenderString(args ...interface{}) (template.HTML, error) {
   398  	return "", nil
   399  }
   400  
   401  func (p *nopPage) ResourceType() string {
   402  	return ""
   403  }
   404  
   405  func (p *nopPage) Resources() resource.Resources {
   406  	return nil
   407  }
   408  
   409  func (p *nopPage) Scratch() *maps.Scratch {
   410  	return nil
   411  }
   412  
   413  func (p *nopPage) RelatedKeywords(cfg related.IndexConfig) ([]related.Keyword, error) {
   414  	return nil, nil
   415  }
   416  
   417  func (p *nopPage) Section() string {
   418  	return ""
   419  }
   420  
   421  func (p *nopPage) Sections() Pages {
   422  	return nil
   423  }
   424  
   425  func (p *nopPage) SectionsEntries() []string {
   426  	return nil
   427  }
   428  
   429  func (p *nopPage) SectionsPath() string {
   430  	return ""
   431  }
   432  
   433  func (p *nopPage) Site() Site {
   434  	return nil
   435  }
   436  
   437  func (p *nopPage) Sites() Sites {
   438  	return nil
   439  }
   440  
   441  func (p *nopPage) Slug() string {
   442  	return ""
   443  }
   444  
   445  func (p *nopPage) String() string {
   446  	return "nopPage"
   447  }
   448  
   449  func (p *nopPage) Summary() template.HTML {
   450  	return ""
   451  }
   452  
   453  func (p *nopPage) TableOfContents() template.HTML {
   454  	return ""
   455  }
   456  
   457  func (p *nopPage) Title() string {
   458  	return ""
   459  }
   460  
   461  func (p *nopPage) TranslationBaseName() string {
   462  	return ""
   463  }
   464  
   465  func (p *nopPage) TranslationKey() string {
   466  	return ""
   467  }
   468  
   469  func (p *nopPage) Translations() Pages {
   470  	return nil
   471  }
   472  
   473  func (p *nopPage) Truncated() bool {
   474  	return false
   475  }
   476  
   477  func (p *nopPage) Type() string {
   478  	return ""
   479  }
   480  
   481  func (p *nopPage) URL() string {
   482  	return ""
   483  }
   484  
   485  func (p *nopPage) UniqueID() string {
   486  	return ""
   487  }
   488  
   489  func (p *nopPage) Weight() int {
   490  	return 0
   491  }
   492  
   493  func (p *nopPage) WordCount() int {
   494  	return 0
   495  }
   496  
   497  func (p *nopPage) GetIdentity() identity.Identity {
   498  	return identity.NewPathIdentity("content", "foo/bar.md")
   499  }