summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-01-02 12:33:26 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-03-23 18:51:22 +0100
commit597e418cb02883418f2cebb41400e8e61413f651 (patch)
tree177ad9c540b2583b6dab138c9f0490d28989c7f7
parent44f5c1c14cb1f42cc5f01739c289e9cfc83602af (diff)
Make Page an interface
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
-rwxr-xr-xbenchbep.sh2
-rw-r--r--codegen/methods.go529
-rw-r--r--codegen/methods2_test.go (renamed from hugolib/page_resource.go)17
-rw-r--r--codegen/methods_test.go100
-rw-r--r--commands/commandeer.go9
-rw-r--r--commands/commands.go20
-rw-r--r--commands/commands_test.go21
-rw-r--r--commands/convert.go22
-rw-r--r--commands/hugo.go169
-rw-r--r--commands/import_jekyll.go10
-rw-r--r--commands/list.go14
-rw-r--r--commands/new_content_test.go12
-rw-r--r--commands/server.go10
-rw-r--r--common/collections/append.go6
-rw-r--r--common/collections/slice_test.go6
-rw-r--r--common/hugio/readers.go3
-rw-r--r--common/maps/scratch.go20
-rw-r--r--common/types/types.go24
-rw-r--r--config/configProvider.go14
-rw-r--r--config/services/servicesConfig.go14
-rw-r--r--config/sitemap.go (renamed from hugolib/sitemap.go)15
-rw-r--r--create/content.go8
-rw-r--r--deps/deps.go7
-rw-r--r--docs/content/en/variables/page.md15
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--helpers/content.go8
-rw-r--r--helpers/content_renderer_test.go6
-rw-r--r--helpers/content_test.go24
-rw-r--r--helpers/general.go11
-rw-r--r--helpers/general_test.go25
-rw-r--r--helpers/path.go9
-rw-r--r--helpers/pygments.go4
-rw-r--r--htesting/test_structs.go53
-rw-r--r--hugofs/createcounting_fs.go99
-rw-r--r--hugofs/fs.go8
-rw-r--r--hugofs/hashing_fs.go6
-rw-r--r--hugofs/stacktracer_fs.go70
-rw-r--r--hugolib/alias.go29
-rw-r--r--hugolib/alias_test.go4
-rw-r--r--hugolib/collections.go75
-rw-r--r--hugolib/collections_test.go18
-rw-r--r--hugolib/config.go23
-rw-r--r--hugolib/datafiles_test.go6
-rw-r--r--hugolib/disableKinds_test.go40
-rw-r--r--hugolib/embedded_shortcodes_test.go10
-rw-r--r--hugolib/gitinfo.go14
-rw-r--r--hugolib/hugo_sites.go523
-rw-r--r--hugolib/hugo_sites_build.go175
-rw-r--r--hugolib/hugo_sites_build_errors_test.go123
-rw-r--r--hugolib/hugo_sites_build_test.go509
-rw-r--r--hugolib/hugo_sites_multihost_test.go26
-rw-r--r--hugolib/hugo_smoke_test.go303
-rw-r--r--hugolib/language_content_dir_test.go78
-rw-r--r--hugolib/media.go60
-rw-r--r--hugolib/menu_test.go6
-rw-r--r--hugolib/minify_publisher_test.go20
-rw-r--r--hugolib/multilingual.go16
-rw-r--r--hugolib/orderedMap.go99
-rw-r--r--hugolib/orderedMap_test.go69
-rw-r--r--hugolib/page.go2360
-rw-r--r--hugolib/page__common.go112
-rw-r--r--hugolib/page__content.go135
-rw-r--r--hugolib/page__data.go70
-rw-r--r--hugolib/page__menus.go74
-rw-r--r--hugolib/page__meta.go652
-rw-r--r--hugolib/page__new.go291
-rw-r--r--hugolib/page__output.go107
-rw-r--r--hugolib/page__paginator.go83
-rw-r--r--hugolib/page__paths.go148
-rw-r--r--hugolib/page__per_output.go445
-rw-r--r--hugolib/page__position.go76
-rw-r--r--hugolib/page__ref.go (renamed from hugolib/page_ref.go)61
-rw-r--r--hugolib/page__tree.go113
-rw-r--r--hugolib/page_content.go233
-rw-r--r--hugolib/page_errors.go47
-rw-r--r--hugolib/page_kinds.go40
-rw-r--r--hugolib/page_output.go320
-rw-r--r--hugolib/page_paths.go312
-rw-r--r--hugolib/page_paths_test.go194
-rw-r--r--hugolib/page_permalink_test.go44
-rw-r--r--hugolib/page_taxonomy_test.go96
-rw-r--r--hugolib/page_test.go901
-rw-r--r--hugolib/page_time_integration_test.go183
-rw-r--r--hugolib/page_unwrap.go50
-rw-r--r--hugolib/page_unwrap_test.go (renamed from hugolib/path_separators_test.go)31
-rw-r--r--hugolib/page_without_content.go67
-rw-r--r--hugolib/pagebundler.go42
-rw-r--r--hugolib/pagebundler_capture.go10
-rw-r--r--hugolib/pagebundler_capture_test.go12
-rw-r--r--hugolib/pagebundler_handlers.go141
-rw-r--r--hugolib/pagebundler_test.go308
-rw-r--r--hugolib/pagecollections.go279
-rw-r--r--hugolib/pagecollections_test.go86
-rw-r--r--hugolib/pages_language_merge_test.go40
-rw-r--r--hugolib/pages_related_test.go75
-rw-r--r--hugolib/pagination_test.go579
-rw-r--r--hugolib/paths/themes.go4
-rw-r--r--hugolib/permalinker.go5
-rw-r--r--hugolib/permalinks.go213
-rw-r--r--hugolib/permalinks_test.go85
-rw-r--r--hugolib/resource_chain_test.go8
-rw-r--r--hugolib/rss_test.go25
-rw-r--r--hugolib/shortcode.go490
-rw-r--r--hugolib/shortcode_page.go56
-rw-r--r--hugolib/shortcode_test.go400
-rw-r--r--hugolib/site.go1132
-rw-r--r--hugolib/siteJSONEncode_test.go34
-rw-r--r--hugolib/site_output.go15
-rw-r--r--hugolib/site_output_test.go42
-rw-r--r--hugolib/site_render.go444
-rw-r--r--hugolib/site_sections.go273
-rw-r--r--hugolib/site_sections_test.go150
-rw-r--r--hugolib/site_test.go123
-rw-r--r--hugolib/site_url_test.go14
-rw-r--r--hugolib/sitemap_test.go10
-rw-r--r--hugolib/taxonomy.go151
-rw-r--r--hugolib/taxonomy_test.go161
-rw-r--r--hugolib/testhelpers_test.go123
-rw-r--r--hugolib/translations.go56
-rw-r--r--langs/language.go16
-rw-r--r--lazy/init.go199
-rw-r--r--lazy/init_test.go150
-rw-r--r--lazy/once.go