# All files / src/Page PageConfig.ts

100% Statements 21/21
50% Branches 1/2
100% Functions 1/1
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122

    1x

    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x

     import type { Template } from 'nunjucks';
    import type { SiteLinkManager } from '../html/SiteLinkManager';
    import type { PluginManager } from '../plugins/PluginManager';

    import { VariableProcessor } from '../variables/VariableProcessor';
    import { LayoutManager } from '../Layout';

    export interface PageAssets {
      bootstrap: string;
      externalScripts: string[];
      fontAwesome?: string;
      glyphicons?: string;
      octicons?: string;
      materialIcons?: string;
      bootstrapIcons?: string;
      highlight: string;
      markBindCss: string;
      markBindJs: string;
      pageNavCss: string;
      siteNavCss: string;
      bootstrapUtilityJs: string;
      polyfillJs: string;
      vue: string;
      pageVueRenderJs?: string;
      layoutUserScriptsAndStyles: string[];
      pluginScripts?: string[],
      pluginLinks?: string[],
    }

    /**
     * A page configuration object used to construct a {@link Page}.
     * Its properties will never be modified by {@link Page} itself.
     */
    export class PageConfig {
      /**
       * Object of asset names as keys to their corresponding destination file paths / links.
       */
      asset: PageAssets;

      /**
       * Set of urls of the root site and subsites' root directories.
       */
      baseUrlMap: Set<string>;

      dev: boolean;
      faviconUrl?: string;
      frontmatterOverride: { [frontmatterName: string]: string };
      layout?: string;
      layoutsAssetPath: string;
      pluginManager: PluginManager;
      /**
       * The output path of this page
       */
      resultPath: string;
      rootPath: string;
      searchable: boolean;
      siteLinkManager: SiteLinkManager;
      siteOutputPath: string;
      /**
       * The source file's (.md) file path for rendering this page
       */
      sourcePath: string;
      /**
       * The source file's (.md) posix relative file path for rendering this page
       */
      src: string;
      title?: string;
      /**
       * The compiled Nunjucks template for the page wrapper (page.njk).
       * This is used to generate the HTML version of the page, handling the global structure
       * (html, head, body, scripts) wrapping the processed content.
       */
      template: Template;
      variableProcessor: VariableProcessor;
      addressablePagesSource: string[];
      layoutManager: LayoutManager;

      constructor(args: {
        asset: PageAssets;
        baseUrlMap: Set<string>;
        dev: boolean;
        faviconUrl?: string;
        frontmatterOverride?: { [frontmatterName: string]: string },
        layout?: string,
        layoutsAssetPath: string;
        pluginManager: PluginManager,
        resultPath: string;
        rootPath: string;
        searchable: boolean;
        siteLinkManager: SiteLinkManager;
        siteOutputPath: string;
        sourcePath: string;
        src: string;
        title?: string;
        template: Template;
        variableProcessor: VariableProcessor;
        addressablePagesSource: string[];
        layoutManager: any;
      }) {
        this.asset = args.asset;
        this.baseUrlMap = args.baseUrlMap;
        this.dev = args.dev;
        this.faviconUrl = args.faviconUrl;
        this.frontmatterOverride = args.frontmatterOverride || {};
        this.layout = args.layout;
        this.layoutsAssetPath = args.layoutsAssetPath;
        this.pluginManager = args.pluginManager;
        this.resultPath = args.resultPath;
        this.rootPath = args.rootPath;
        this.searchable = args.searchable;
        this.siteLinkManager = args.siteLinkManager;
        this.siteOutputPath = args.siteOutputPath;
        this.sourcePath = args.sourcePath;
        this.src = args.src;
        this.title = args.title;
        this.template = args.template;
        this.variableProcessor = args.variableProcessor;
        this.addressablePagesSource = args.addressablePagesSource;
        this.layoutManager = args.layoutManager;
      }
    }