Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetPage, ref and relref improvements #4796

Closed
wants to merge 6 commits into from
Closed

GetPage, ref and relref improvements #4796

wants to merge 6 commits into from

Commits on Jul 16, 2018

  1. Unify page indexing and look up (ref renovations 1 of 6)

    Unifies the core internal page index for all page kinds. This enables
    the `ref` and `relref` shortcodes to support all pages kinds (#4147),
    supports a new `GetPage` method with simplified signature (#4726 and
    the way for the implementation of unix path semantics.
    
    Fixes #4147
    
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      132178709     131702904     -0.36%
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     246968331     248262520     +0.52%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      149885185     149436896     -0.30%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     284289590     276022981     -2.91%
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    22c3d78 View commit details
    Browse the repository at this point in the history
  2. Change internal getPage method signature (ref renovations 2 of 6)

    Lays the groundwork for ambiguity detection and unix path semantics by
    changing the method signature for the core internal page lookups method
    used by public API such as the `.GetPage` method and the `ref` and
    `relref` shortcodes in advance of the more involved follow on commits.
    The change has no functional impact.
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    ce929de View commit details
    Browse the repository at this point in the history
  3. Add ambiguity detection (ref renovations 3 of 6)

    Detects ambigous page lookup or link attempts made with ambiguous
    references and produces an error with a helpful message when they
    occur.
    
    NOTE: Two preexisting tests fail because of ambiguity with no
    unambiguous ref available. This will be addressed in the next step
    of the overhaul.
    
    Fixes #4727
    
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      130331810     132914349     +1.98%
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     244420821     243607037     -0.33%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      149811675     148979860     -0.56%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     272842157     280753633     +2.90%
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    22ecaa4 View commit details
    Browse the repository at this point in the history
  4. Add support for absolute source refs (ref renovations 4 of 6)

    Gives every page, including virtual ones, a unique, absolute ref.
    Absolute refs are the absolute path rooted in the content directory,
    with unix path form and semantics.
    
    Used to unambiguously lookup (e.g. .GetPage) or links (e.g. ref/relref)
    to any page when an absolute (as opposed to relative) reference makes
    sense.
    
    First half of fix for #4728.
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    6ceaee7 View commit details
    Browse the repository at this point in the history
  5. Add support for relative source refs (ref renovations 5 of 6)

    Enables page lookups (e.g. .GetPage) or links (e.g. ref/relref) using
    paths relative to the current page. Relative paths have unix path form
    and semantics.
    
    Used to unambiguously lookup (e.g. .GetPage) or links (e.g. ref/relref)
    to any page when a relative (as opposed to absolute) reference makes
    sense.
    
    Fixes #4728
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    05a6563 View commit details
    Browse the repository at this point in the history
  6. Add page relative .GetPage method (ref renovations 6 of 6)

    Add page relative .GetPage method to template API, enabling relative
    page lookups from templates.
    
    Has simple method signature and semantics consistent with ref/relref.
    It does away with the `kind` param of `.Site.GetPage` and only takes a
    simple ref string. This method should be used going forward instead of
    `.Site.GetPage`, which may be deprecated sometime in the future.
    
    Fixes #4726
    Fixes #4652
    
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      130232053     128963144     -0.97%
    BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     248140348     246210344     -0.78%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,num_tags=1,tags_per_page=5,shortcodes,render-4      149372926     151167558     +1.20%
    BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,num_tags=1,tags_per_page=5,shortcodes,render-4     273565538     278713990     +1.88%
    vassudanagunta committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    ce93dbf View commit details
    Browse the repository at this point in the history