Skip to content

Fix broken page/fragment detection #124

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Fix broken page/fragment detection #124

merged 1 commit into from
Oct 27, 2020

Conversation

bcdickinson
Copy link

@bcdickinson bcdickinson commented Sep 24, 2020

Description

Fixes #119

This fixes an issue that was introduced by #83 where the removal of a specific "pages" pattern type broke the logic that chooses whether or not to wrap the rendered output of a pattern in the base pattern template or not. After that change, all rendered patterns were wrapped in the base template, causing patterns whose template extended the base template already to duplicate that code (e.g. <head> content).

This PR fixes that by doing a few things:

  • Adding a new setting PATTERN_LIBRARY['BASE_TEMPLATE_NAMES'] that replaces the old PATTERN_LIBRARY_BASE_TEMPLATE_NAME
  • Adding a utility function that returns the extension hierarchy of a given template
  • Using that utility function to check whether a pattern extends on of the base templates (i.e. does not need wrapping in the base pattern template) or does not extend those templates (i.e. does need wrapping in the base pattern template) and returns the appropriate rendered result.

Other bits:

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have made corresponding changes to the documentation
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@bcdickinson bcdickinson self-assigned this Sep 24, 2020
@bcdickinson bcdickinson marked this pull request as draft September 24, 2020 18:28
@bcdickinson bcdickinson marked this pull request as ready for review September 24, 2020 18:38
@bcdickinson bcdickinson merged commit db555cf into torchbox:master Oct 27, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Bug with markup rendering in version 0.2.9
1 participant