/*
Process the current layout file.
334035
function (f, content) {
    var path = config.getLayout(f);
    if (!path) return content;
    if (!fss.exists(path)) return content;
    return compile(f, fss.readFile(path),
        _.extend(templateData({}), { content: content }));
}
1010043
protected function preProcess(): void
    {
        Router::process();

        // disable Layout for XmlHttpRequests
        if (Request::isXmlHttpRequest()) {
            $this->layoutFlag = false;
        }

        // switch to JSON response based on Accept header
        if (Request::checkAccept([Request::TYPE_HTML, Request::TYPE_JSON]) === Request::TYPE_JSON) {
            $this->layoutFlag = false;
            Response::setType('JSON');
        }
    }
921099
@Override
  void postProcess(TextView textView, List<BannerComponentNode> bannerComponentNodes) {
    if (exitNumber != null) {
      LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context
        .LAYOUT_INFLATER_SERVICE);

      ViewGroup root = (ViewGroup) textView.getParent();

      TextView exitSignView;

      if (modifier.equals(LEFT)) {
        exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false);
      } else {
        exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false);
      }

      exitSignView.setText(exitNumber);

      textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber
        .length());
    }
  }
920305
def _process_layout(self, layout):
        """"""
        # Here we just group text into paragraphs
        elements = []
        for lt_obj in layout:
            if isinstance(lt_obj, LTTextBox) or isinstance(lt_obj, LTTextLine):
                elements.append(Paragraph(lt_obj.get_text().strip()))
            elif isinstance(lt_obj, LTFigure):
                # Recursive...
                elements.extend(self._process_layout(lt_obj))
        return elements
195310
private void processViewPropertyData() throws IOException
   {
      Props14 props = new Props14(m_inputStreamFactory.getInstance(m_viewDir, "Props"));
      byte[] data = props.getByteArray(Props.FONT_BASES);
      if (data != null)
      {
         processBaseFonts(data);
      }

      ProjectProperties properties = m_file.getProjectProperties();
      properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK));
   }
906621
private void processFile(String fileName)
      throws ValidationException, ParserConfigurationException, SAXException, IOException,
          SchedulerException, ClassNotFoundException, ParseException, XPathException {

    prepForProcessing();

    logger.info("Parsing XML file: " + fileName);
    InputSource is = new InputSource(getInputStream(fileName));
    // is.setSystemId(systemId);

    process(is);

    maybeThrowValidationException();
  }
1297759
public function afterLayout() {
         // run through algorithm
         $compressed = $this->_html($this->getView()->Blocks->get('content'));

         // set html content
         $this->getView()->Blocks->set('content', $compressed);
     }
1276229
function render(file, layout, context, partials, callback) {
  try {
    const data = mustache.render(layout, context, partials);
    async.nextTick(callback, null, data);
  } catch (error) {
    console.error(`${file.path}: Could not render the layout`);
    async.nextTick(callback, error);
  }
}
507682
private function processHtml()
    {
        $this->tree->build_tree();

        $this->css->load_css_file(Stylesheet::getDefaultStylesheet(), Stylesheet::ORIG_UA);

        $acceptedmedia = Stylesheet::$ACCEPTED_GENERIC_MEDIA_TYPES;
        $acceptedmedia[] = $this->options->getDefaultMediaType();

        // <base href="" />
        $base_nodes = $this->dom->getElementsByTagName("base");
        if ($base_nodes->length && ($href = $base_nodes->item(0)->getAttribute("href"))) {
            list($this->protocol, $this->baseHost, $this->basePath) = Helpers::explode_url($href);
        }

        // Set the base path of the Stylesheet to that of the file being processed
        $this->css->set_protocol($this->protocol);
        $this->css->set_host($this->baseHost);
        $this->css->set_base_path($this->basePath);

        // Get all the stylesheets so that they are processed in document order
        $xpath = new DOMXPath($this->dom);
        $stylesheets = $xpath->query("//*[name() = 'link' or name() = 'style']");

        /** @var \DOMElement $tag */
        foreach ($stylesheets as $tag) {
            switch (strtolower($tag->nodeName)) {
                // load <link rel="STYLESHEET" ... /> tags
                case "link":
                    if (mb_strtolower(stripos($tag->getAttribute("rel"), "stylesheet") !== false) || // may be "appendix stylesheet"
                        mb_strtolower($tag->getAttribute("type")) === "text/css"
                    ) {
                        //Check if the css file is for an accepted media type
                        //media not given then always valid
                        $formedialist = preg_split("/[\s\n,]/", $tag->getAttribute("media"), -1, PREG_SPLIT_NO_EMPTY);
                        if (count($formedialist) > 0) {
                            $accept = false;
                            foreach ($formedialist as $type) {
                                if (in_array(mb_strtolower(trim($type)), $acceptedmedia)) {
                                    $accept = true;
                                    break;
                                }
                            }

                            if (!$accept) {
                                //found at least one mediatype, but none of the accepted ones
                                //Skip this css file.
                                break;
                            }
                        }

                        $url = $tag->getAttribute("href");
                        $url = Helpers::build_url($this->protocol, $this->baseHost, $this->basePath, $url);

                        $this->css->load_css_file($url, Stylesheet::ORIG_AUTHOR);
                    }
                    break;

                // load <style> tags
                case "style":
                    // Accept all <style> tags by default (note this is contrary to W3C
                    // HTML 4.0 spec:
                    // http://www.w3.org/TR/REC-html40/present/styles.html#adef-media
                    // which states that the default media type is 'screen'
                    if ($tag->hasAttributes() &&
                        ($media = $tag->getAttribute("media")) &&
                        !in_array($media, $acceptedmedia)
                    ) {
                        break;
                    }

                    $css = "";
                    if ($tag->hasChildNodes()) {
                        $child = $tag->firstChild;
                        while ($child) {
                            $css .= $child->nodeValue; // Handle <style><!-- blah --></style>
                            $child = $child->nextSibling;
                        }
                    } else {
                        $css = $tag->nodeValue;
                    }

                    $this->css->load_css($css, Stylesheet::ORIG_AUTHOR);
                    break;
            }
        }
    }
181616
private void processLayouts(Project phoenixProject)
   {
      //
      // Find the active layout
      //
      Layout activeLayout = getActiveLayout(phoenixProject);

      //
      // Create a list of the visible codes in the correct order
      //
      for (CodeOption option : activeLayout.getCodeOptions().getCodeOption())
      {
         if (option.isShown().booleanValue())
         {
            m_codeSequence.add(getUUID(option.getCodeUuid(), option.getCode()));
         }
      }
   }
113327
function process(node) {
          var children, i, l, lastContentEditable, hasContentEditableState;

          // Node has a contentEditable value
          if (node.nodeType === 1 && getContentEditable(node)) {
            lastContentEditable = contentEditable;
            contentEditable = getContentEditable(node) === "true";
            hasContentEditableState = true; // We don't want to wrap the container only it's children
          }

          // Grab the children first since the nodelist might be changed
          children = grep(node.childNodes);

          // Process current node
          if (contentEditable && !hasContentEditableState) {
            for (i = 0, l = formatList.length; i < l; i++) {
              if (removeFormat(formatList[i], vars, node, node)) {
                break;
              }
            }
          }

          // Process the children
          if (format.deep) {
            if (children.length) {
              for (i = 0, l = children.length; i < l; i++) {
                process(children[i]);
              }

              if (hasContentEditableState) {
                contentEditable = lastContentEditable; // Restore last contentEditable state from stack
              }
            }
          }
        }
37632
private void processViewData() throws IOException
   {
      DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
      FixFix ff = new FixFix(138, new DocumentInputStream(((DocumentEntry) dir.getEntry("FixFix   0"))));
      int items = ff.getItemCount();
      byte[] data;
      View view;

      for (int loop = 0; loop < items; loop++)
      {
         data = ff.getByteArrayValue(loop);
         view = new View8(m_file, data);
         m_file.getViews().add(view);
      }
   }
964352
LayoutProcessorOutput applyLayout(FileResource resource, Locale locale, Map<String, Object> model) {

    Optional<Path> layout = findLayout(resource);

    return layout.map(Path::toString)//
        .map(Files::getFileExtension)//
        .map(layoutEngines::get)
        //
        .orElse(lParam -> new LayoutProcessorOutput(lParam.model.get("content").toString(), "none", lParam.layoutTemplate, lParam.locale))
          .apply(new LayoutParameters(layout, resource.getPath(), locale, model));
  }
495013
function () {
    // Thigs to perform after nodes are repositioned on screen
    var afterReposition = function() {
      if (options.fit) {
        options.cy.fit(options.eles.nodes(), options.padding);
      }

      if (!ready) {
        ready = true;
        self.cy.one('layoutready', options.ready);
        self.cy.trigger({type: 'layoutready', layout: self});
      }
    };
    
    var ticksPerFrame = self.options.refresh;
    var isDone;

    for( var i = 0; i < ticksPerFrame && !isDone; i++ ){
      isDone = self.stopped || self.layout.tick();
    }
    
    // If layout is done
    if (isDone) {
      // If the layout is not a sublayout and it is successful perform post layout.
      if (layout.checkLayoutSuccess() && !layout.isSubLayout) {
        layout.doPostLayout();
      }
      
      // If layout has a tilingPostLayout function property call it.
      if (layout.tilingPostLayout) {
        layout.tilingPostLayout();
      }
      
      layout.isLayoutFinished = true;
      
      self.options.eles.nodes().positions(getPositions);
      
      afterReposition();
      
      // trigger layoutstop when the layout stops (e.g. finishes)
      self.cy.one('layoutstop', self.options.stop);
      self.cy.trigger({ type: 'layoutstop', layout: self });

      if (frameId) {
        cancelAnimationFrame(frameId);
      }
      
      ready = false;
      return;
    }
    
    var animationData = self.layout.getPositionsData(); // Get positions of layout nodes note that all nodes may not be layout nodes because of tiling
    
    // Position nodes, for the nodes whose id does not included in data (because they are removed from their parents and included in dummy compounds)
    // use position of their ancestors or dummy ancestors
    options.eles.nodes().positions(function (ele, i) {
      if (typeof ele === "number") {
        ele = i;
      }
      var theId = ele.id();
      var pNode = animationData[theId];
      var temp = ele;
      // If pNode is undefined search until finding position data of its first ancestor (It may be dummy as well)
      while (pNode == null) {
        pNode = animationData[temp.data('parent')] || animationData['DummyCompound_' + temp.data('parent')];
        animationData[theId] = pNode;
        temp = temp.parent()[0];
        if(temp == undefined){
          break;
        }
      }
      if(pNode != null){
        return {
          x: pNode.x,
          y: pNode.y
        };
      }
      else{
        return {
          x: ele.x,
          y: ele.y
        };
      }
    });

    afterReposition();

    frameId = requestAnimationFrame(iterateAnimated);
  }
578025
public function process()
        {
            if ($this->_isXhtml === null) {
                $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
            }

            $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']);
            $this->_placeholders = array();

            // replace SCRIPTs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/(\\s*)(<script\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/i'
                    , array($this, '_removeScriptCB')
                    , $this->_html);

            // replace STYLEs (and minify) with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<style\\b[^>]*?>)([\\s\\S]*?)<\\/style>\\s*/i'
                    , array($this, '_removeStyleCB')
                    , $this->_html);

            // remove HTML comments (not containing IE conditional comments).
            $this->_html = preg_replace_callback(
                    '/<!--([\\s\\S]*?)-->/'
                    , array($this, '_commentCB')
                    , $this->_html);

            // replace PREs with placeholders
            $this->_html = preg_replace_callback('/\\s*(<pre\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/i'
                    , array($this, '_removePreCB')
                    , $this->_html);

            // replace TEXTAREAs with placeholders
            $this->_html = preg_replace_callback(
                    '/\\s*(<textarea\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/i'
                    , array($this, '_removeTextareaCB')
                    , $this->_html);

            // trim each line.
            // @todo take into account attribute values that span multiple lines.
            $this->_html = preg_replace('/^\\s+|\\s+$/m', '', $this->_html);

            // remove ws around block/undisplayed elements
            $this->_html = preg_replace('/\\s+(<\\/?(?:area|base(?:font)?|blockquote|body'
                    . '|caption|center|cite|col(?:group)?|dd|dir|div|dl|dt|fieldset|form'
                    . '|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta'
                    . '|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)'
                    . '|ul)\\b[^>]*>)/i', '$1', $this->_html);

            // remove ws outside of all elements
            $this->_html = preg_replace_callback(
                    '/>([^<]+)</'
                    , array($this, '_outsideTagCB')
                    , $this->_html);

            // use newlines before 1st attribute in open tags (to limit line lengths)
            $this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $this->_html);

            // fill placeholders
            $this->_html = str_replace(
                    array_keys($this->_placeholders)
                    , array_values($this->_placeholders)
                    , $this->_html
            );

            return $this->_html;
        }
1167317
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      try
      {
         populateMemberData(reader, file, root);
         processProjectProperties();

         if (!reader.getReadPropertiesOnly())
         {
            processCalendarData();
            processResourceData();
            processTaskData();
            processConstraintData();
            processAssignmentData();

            if (reader.getReadPresentationData())
            {
               processViewPropertyData();
               processViewData();
               processTableData();
            }
         }
      }

      finally
      {
         clearMemberData();
      }
   }
310133
public function process() {
        /* @var $currentStep StepController */
        /* @var $ancestorStep StepController */
        /* @var $descendantStep StepController */
        $currentStep = $this->stepCollectionIterator->current();
        if ($this->stepAction == self::WIZARD_STEP_ACTION_PREV && !$this->stepCollection->isFirst($this->stepCollectionIterator->current())) {
            $currentStep->leaveToAncestorStep();
            $this->stepCollectionIterator->previous();
            $ancestorStep = $this->stepCollectionIterator->current();
            $ancestorStep->enterFromDescendant();
            $this->resultContent = $this->prepareNextStepView($ancestorStep);
        } elseif ($this->stepAction == self::WIZARD_STEP_ACTION_PREV && $this->stepCollection->isFirst($this->stepCollectionIterator->current())) {
            $this->resultContent = new ResponseConfigurator();
        }
        if ($this->stepAction == self::WIZARD_STEP_ACTION_NEXT) {
            $currentStep->preProcess();
            if ($currentStep->process($currentStep->standardClosureArguments())) {
                $currentStep->postProcess();
                $currentStep->leaveStep();
                $this->stepCollectionIterator->next();

                $descendantStep = $this->stepCollectionIterator->current();
                $descendantStep->enterStep();
                $this->resultContent = $this->prepareNextStepView($descendantStep);
            } else {
                $this->resultContent = $this->prepareNextStepView($currentStep);
                $this->resultContent->setVariable("errorMessage", $currentStep->getProcessErrorMessage());
            }

        }
    }