gatherPanels(patternData, iframePassback, switchText) {
    Dispatcher.addListener('checkPanels', panelsViewer.checkPanels);

    // set-up defaults
    let template, templateCompiled, templateRendered, templateFormatted;

    // get the base panels
    const panels = Panels.get();

    // evaluate panels array and create content
    for (let i = 0; i < panels.length; ++i) {
      const panel = panels[i];

      // catch pattern panel since it doesn't have a name defined by default
      if (panel.name === undefined) {
        panel.name =
          patternData.patternEngineName || patternData.patternExtension;
        panel.language = patternData.patternExtension;
      }

      // if httpRequestReplace has not been set, use the extension. this is likely for the raw template
      if (panel.httpRequestReplace === undefined) {
        panel.httpRequestReplace = '';
      }

      if (panel.httpRequestReplace === '') {
        panel.httpRequestReplace =
          panel.httpRequestReplace + '.' + patternData.patternExtension;
      }

      if (panel.templateID !== undefined && panel.templateID) {
        if (panel.httpRequest !== undefined && panel.httpRequest) {
          // need a file and then render
          const fileBase = urlHandler.getFileName(
            patternData.patternPartial,
            false
          );
          const e = new XMLHttpRequest();
          // @todo: look deeper into how we can refactor this particular code block
          /* eslint-disable */
          e.onload = (function (i, panels, patternData, iframeRequest) {
            return function () {
              // since non-existant files (such as .scss from plugin-tab) still return a 200, we need to instead inspect the contents
              // we look for responseText that starts with the doctype
              let rText = this.responseText;
              if (rText.startsWith('<!DOCTYPE html>')) {
                rText = '';
              }

              // use pretty to format HTML
              if (panels[i].name === 'HTML') {
                templateFormatted = pretty(rText, { ocd: true });
              } else {
                templateFormatted = rText;
              }

              const templateHighlighted = Prism.highlight(
                templateFormatted,
                Prism.languages[panels[i].name.toLowerCase()] ||
                  Prism.languages['markup']
                // Prism.languages[panels[i].name.toLowerCase()],
              );

              const codeTemplate = (code, language) =>
                html`
                  <pre
                    class="language-markup"
                  ><code id="pl-code-fill-${language}" class="language-${language}">${unsafeHTML(
                    code
                  )}</code></pre>
                `;

              const result = document.createDocumentFragment();
              const fallBackResult = document.createDocumentFragment();

              render(codeTemplate(templateHighlighted, 'html'), result);
              render(codeTemplate(templateFormatted, 'html'), fallBackResult);

              if (result.children) {
                panels[i].content = result.children[0].outerHTML;
              } else if (fallBackResult.children) {
                panels[i].content = fallBackResult.children[0].outerHTML;
              } else {
                panels[i].content =
                  '<pre class="language-markup"><code id="pl-code-fill-html" class="language-html">' +
                  templateFormatted
                    .replace(/</g, '&lt;')
                    .replace(/>/g, '&gt;') +
                  '</code></pre>';
              }

              Dispatcher.trigger('checkPanels', [
                panels,
                patternData,
                iframePassback,
                switchText,
              ]);
            };
          })(i, panels, patternData, iframePassback);
          /* eslint-enable */
          e.open(
            'GET',
            fileBase + panel.httpRequestReplace + '?' + new Date().getTime(),
            true
          );
          e.send();
        } else {
          // vanilla render of pattern data
          template = document.getElementById(panel.templateID);
          templateCompiled = Hogan.compile(template.innerHTML);
          templateRendered = templateCompiled.render(patternData);
          const normalizedCode =
            normalizeWhitespace.normalize(templateRendered);
          normalizedCode.replace(/[\r\n]+/g, '\n\n');
          const highlightedCode = Prism.highlight(
            normalizedCode,
            Prism.languages.html
          );
          panels[i].content = highlightedCode;
          Dispatcher.trigger('checkPanels', [
            panels,
            patternData,
            iframePassback,
            switchText,
          ]);
        }
      }
    }
  }
/**
   * Gather the panels related to the modal
   * @param  {String}      the data from the pattern
   * @param  {Boolean}     if this is going to be passed back to the styleguide
   */
Gather the panels related to the modal
@param  {String}      the data from the pattern
@param  {Boolean}     if this is going to be passed back to the styleguide
Gather the panels related to the modal @param { String } the data from the pattern @param { Boolean } if this is going to be passed back to the styleguide
gatherPanels(patternData, iframePassback, switchText) {
    Dispatcher.addListener('checkPanels', panelsViewer.checkPanels);
    let template, templateCompiled, templateRendered, templateFormatted;
    const panels = Panels.get();
    for (let i = 0; i < panels.length; ++i) {
      const panel = panels[i];
      if (panel.name === undefined) {
        panel.name =
          patternData.patternEngineName || patternData.patternExtension;
        panel.language = patternData.patternExtension;
      }
      if (panel.httpRequestReplace === undefined) {
        panel.httpRequestReplace = '';
      }
      if (panel.httpRequestReplace === '') {
        panel.httpRequestReplace =
          panel.httpRequestReplace + '.' + patternData.patternExtension;
      }
      if (panel.templateID !== undefined && panel.templateID) {
        if (panel.httpRequest !== undefined && panel.httpRequest) {
          const fileBase = urlHandler.getFileName(
            patternData.patternPartial,
            false
          );
          const e = new XMLHttpRequest();
          e.onload = (function (i, panels, patternData, iframeRequest) {
            return function () {
              let rText = this.responseText;
              if (rText.startsWith('<!DOCTYPE html>')) {
                rText = '';
              }
              if (panels[i].name === 'HTML') {
                templateFormatted = pretty(rText, { ocd: true });
              } else {
                templateFormatted = rText;
              }
              const templateHighlighted = Prism.highlight(
                templateFormatted,
                Prism.languages[panels[i].name.toLowerCase()] ||
                  Prism.languages['markup']
              );
              const codeTemplate = (code, language) =>
                html`
                  <pre
                    class="language-markup"
                  ><code id="pl-code-fill-${language}" class="language-${language}">${unsafeHTML(
                    code
                  )}</code></pre>
                `;
              const result = document.createDocumentFragment();
              const fallBackResult = document.createDocumentFragment();
              render(codeTemplate(templateHighlighted, 'html'), result);
              render(codeTemplate(templateFormatted, 'html'), fallBackResult);
              if (result.children) {
                panels[i].content = result.children[0].outerHTML;
              } else if (fallBackResult.children) {
                panels[i].content = fallBackResult.children[0].outerHTML;
              } else {
                panels[i].content =
                  '<pre class="language-markup"><code id="pl-code-fill-html" class="language-html">' +
                  templateFormatted
                    .replace(/</g, '&lt;')
                    .replace(/>/g, '&gt;') +
                  '</code></pre>';
              }
              Dispatcher.trigger('checkPanels', [
                panels,
                patternData,
                iframePassback,
                switchText,
              ]);
            };
          })(i, panels, patternData, iframePassback);
          e.open(
            'GET',
            fileBase + panel.httpRequestReplace + '?' + new Date().getTime(),
            true
          );
          e.send();
        } else {
          template = document.getElementById(panel.templateID);
          templateCompiled = Hogan.compile(template.innerHTML);
          templateRendered = templateCompiled.render(patternData);
          const normalizedCode =
            normalizeWhitespace.normalize(templateRendered);
          normalizedCode.replace(/[\r\n]+/g, '\n\n');
          const highlightedCode = Prism.highlight(
            normalizedCode,
            Prism.languages.html
          );
          panels[i].content = highlightedCode;
          Dispatcher.trigger('checkPanels', [
            panels,
            patternData,
            iframePassback,
            switchText,
          ]);
        }
      }
    }
  }
gatherPanels ( patternData , iframePassback , switchText ) { Dispatcher . addListener ( 'checkPanels' , panelsViewer . checkPanels ) ; let template , templateCompiled , templateRendered , templateFormatted ; const panels = Panels . get ( ) ; for ( let i = 0 ; i < panels . length ; ++ i ) { const panel = panels [ i ] ; if ( panel . name === undefined ) { panel . name = patternData . patternEngineName || patternData . patternExtension ; panel . language = patternData . patternExtension ; } if ( panel . httpRequestReplace === undefined ) { panel . httpRequestReplace = '' ; } if ( panel . httpRequestReplace === '' ) { panel . httpRequestReplace = panel . httpRequestReplace + '.' + patternData . patternExtension ; } if ( panel . templateID !== undefined && panel . templateID ) { if ( panel . httpRequest !== undefined && panel . httpRequest ) { const fileBase = urlHandler . getFileName ( patternData . patternPartial , false ) ; const e = new XMLHttpRequest ( ) ; e . onload = ( function ( i , panels , patternData , iframeRequest ) { return function ( ) { let rText = this . responseText ; if ( rText . startsWith ( '<!DOCTYPE html>' ) ) { rText = '' ; } if ( panels [ i ] . name === 'HTML' ) { templateFormatted = pretty ( rText , { ocd : true } ) ; } else { templateFormatted = rText ; } const templateHighlighted = Prism . highlight ( templateFormatted , Prism . languages [ panels [ i ] . name . toLowerCase ( ) ] || Prism . languages [ 'markup' ] ) ; const codeTemplate = ( code , language ) => html ` ${ language } ${ language } ${ unsafeHTML ( code ) } ` ; const result = document . createDocumentFragment ( ) ; const fallBackResult = document . createDocumentFragment ( ) ; render ( codeTemplate ( templateHighlighted , 'html' ) , result ) ; render ( codeTemplate ( templateFormatted , 'html' ) , fallBackResult ) ; if ( result . children ) { panels [ i ] . content = result . children [ 0 ] . outerHTML ; } else if ( fallBackResult . children ) { panels [ i ] . content = fallBackResult . children [ 0 ] . outerHTML ; } else { panels [ i ] . content = '<pre class="language-markup"><code id="pl-code-fill-html" class="language-html">' + templateFormatted . replace ( / < / g , '&lt;' ) . replace ( / > / g , '&gt;' ) + '</code></pre>' ; } Dispatcher . trigger ( 'checkPanels' , [ panels , patternData , iframePassback , switchText , ] ) ; } ; } ) ( i , panels , patternData , iframePassback ) ; e . open ( 'GET' , fileBase + panel . httpRequestReplace + '?' + new Date ( ) . getTime ( ) , true ) ; e . send ( ) ; } else { template = document . getElementById ( panel . templateID ) ; templateCompiled = Hogan . compile ( template . innerHTML ) ; templateRendered = templateCompiled . render ( patternData ) ; const normalizedCode = normalizeWhitespace . normalize ( templateRendered ) ; normalizedCode . replace ( / [\r\n]+ / g , '\n\n' ) ; const highlightedCode = Prism . highlight ( normalizedCode , Prism . languages . html ) ; panels [ i ] . content = highlightedCode ; Dispatcher . trigger ( 'checkPanels' , [ panels , patternData , iframePassback , switchText , ] ) ; } } } }
Gather the panels related to the modal
 @param  {String}      the data from the pattern
 @param  {Boolean}     if this is going to be passed back to the styleguide
Gather the panels related to the modal @param { String } the data from the pattern @param { Boolean } if this is going to be passed back to the styleguide
// set-up defaults // get the base panels // evaluate panels array and create content // catch pattern panel since it doesn't have a name defined by default // if httpRequestReplace has not been set, use the extension. this is likely for the raw template // need a file and then render // @todo: look deeper into how we can refactor this particular code block /* eslint-disable */ // since non-existant files (such as .scss from plugin-tab) still return a 200, we need to instead inspect the contents // we look for responseText that starts with the doctype // use pretty to format HTML // Prism.languages[panels[i].name.toLowerCase()], /* eslint-enable */ // vanilla render of pattern data