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

Reorganise variable processing #1189

Merged

Commits on Jun 9, 2020

  1. Reorganise variable processing (part 1)

    Processing variables involves a lot of boilerplate code with minor
    variations. This decentralizes variable processing, decreasing code
    maintainability and readability.
    
    Let's embark on a two stage refactor to improve variable processing.
    In this first refactor, we create the variablePreprocessor abstraction,
    and completely migrate the use of userDefinedVariablesMap for site
    variables to variablePreprocessor, reducing boilerplate code relating
    to site variables.
    Additionally, we move all page variable processing related methods to
    variablePreprocessor from Parser, abstracting such methods into
    smaller units of functionality where possible, and enhancing in code
    documentation.
    
    In the second part, we will similarly refactor page variable processing
    methods to reduce more boilerplate, increasing code maintainability.
    ang-zeyu committed Jun 9, 2020
    Configuration menu
    Copy the full SHA
    7040ac8 View commit details
    Browse the repository at this point in the history
  2. Reorganise variable processing (part 2)

    Processing page variables involves a two step process.
    
    The first step extracts and renders locally declared page variables in
    <variable> tags, using javascript proxies to force imported variables
    to re-render as themselves again, which decreases code clarity.
    The second step then extracts the imported variables, and stores such
    variables into an alias map, then re-rendering the page a second time.
    
    This process can be combined into a single pass to simplify the process
    greatly and remove the need for workarounds like proxies.
    This also increases rendering performance slightly, as only a single
    pass is made
    
    Moreover, variable tags in <include> tags are erroneously recognised as
    page variables. Let's include a simple fix for this as well.
    ang-zeyu committed Jun 9, 2020
    Configuration menu
    Copy the full SHA
    d6a00b0 View commit details
    Browse the repository at this point in the history