Possible custom headers and external stylesheet file

@Pdf(
headers={"Expires"="Sat, 1 Jan 2000 12:00:00 GMT"},
stylesheet="PsPdfBundle:Example:pdfStylesheet.xml.twig",
enableCache=true
)
168625
public function usingAutomaticFormatGuessingAction($name)
    {
        $format = $this->get('request')->get('_format');
        
        return $this->render(sprintf('PsPdfBundle:Example:usingAutomaticFormatGuessing.%s.twig', $format), array(
            'name' => $name,
        ));
    }
1243985
def compile(options = {})

            load_all_objects unless loaded?

            #
            # A valid document must have at least one page.
            #
            append_page if pages.empty?

            #
            # Allocates object numbers and creates references.
            # Invokes object finalization methods.
            #
            physicalize(options)

            #
            # Sets the PDF version header.
            #
            version, level = version_required
            @header.major_version = version[0,1].to_i
            @header.minor_version = version[2,1].to_i

            set_extension_level(version, level) if level > 0

            self
        end
221987
static function decorate_frame(Frame $frame, Dompdf $dompdf, Frame $root = null)
    {
        if (is_null($dompdf)) {
            throw new Exception("The DOMPDF argument is required");
        }

        $style = $frame->get_style();

        // Floating (and more generally out-of-flow) elements are blocks
        // http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/
        if (!$frame->is_in_flow() && in_array($style->display, Style::$INLINE_TYPES)) {
            $style->display = "block";
        }

        $display = $style->display;

        switch ($display) {

            case "flex": //FIXME: display type not yet supported 
            case "table-caption": //FIXME: display type not yet supported
            case "block":
                $positioner = "Block";
                $decorator = "Block";
                $reflower = "Block";
                break;

            case "inline-flex": //FIXME: display type not yet supported 
            case "inline-block":
                $positioner = "Inline";
                $decorator = "Block";
                $reflower = "Block";
                break;

            case "inline":
                $positioner = "Inline";
                if ($frame->is_text_node()) {
                    $decorator = "Text";
                    $reflower = "Text";
                } else {
                    if ($style->float !== "none") {
                        $decorator = "Block";
                        $reflower = "Block";
                    } else {
                        $decorator = "Inline";
                        $reflower = "Inline";
                    }
                }
                break;

            case "table":
                $positioner = "Block";
                $decorator = "Table";
                $reflower = "Table";
                break;

            case "inline-table":
                $positioner = "Inline";
                $decorator = "Table";
                $reflower = "Table";
                break;

            case "table-row-group":
            case "table-header-group":
            case "table-footer-group":
                $positioner = "NullPositioner";
                $decorator = "TableRowGroup";
                $reflower = "TableRowGroup";
                break;

            case "table-row":
                $positioner = "NullPositioner";
                $decorator = "TableRow";
                $reflower = "TableRow";
                break;

            case "table-cell":
                $positioner = "TableCell";
                $decorator = "TableCell";
                $reflower = "TableCell";
                break;

            case "list-item":
                $positioner = "Block";
                $decorator = "Block";
                $reflower = "Block";
                break;

            case "-dompdf-list-bullet":
                if ($style->list_style_position === "inside") {
                    $positioner = "Inline";
                } else {
                    $positioner = "ListBullet";
                }

                if ($style->list_style_image !== "none") {
                    $decorator = "ListBulletImage";
                } else {
                    $decorator = "ListBullet";
                }

                $reflower = "ListBullet";
                break;

            case "-dompdf-image":
                $positioner = "Inline";
                $decorator = "Image";
                $reflower = "Image";
                break;

            case "-dompdf-br":
                $positioner = "Inline";
                $decorator = "Inline";
                $reflower = "Inline";
                break;

            default:
                // FIXME: should throw some sort of warning or something?
            case "none":
                if ($style->_dompdf_keep !== "yes") {
                    // Remove the node and the frame
                    $frame->get_parent()->remove_child($frame);
                    return;
                }

                $positioner = "NullPositioner";
                $decorator = "NullFrameDecorator";
                $reflower = "NullFrameReflower";
                break;
        }

        // Handle CSS position
        $position = $style->position;

        if ($position === "absolute") {
            $positioner = "Absolute";
        } else {
            if ($position === "fixed") {
                $positioner = "Fixed";
            }
        }

        $node = $frame->get_node();

        // Handle nodeName
        if ($node->nodeName === "img") {
            $style->display = "-dompdf-image";
            $decorator = "Image";
            $reflower = "Image";
        }

        $decorator  = "Dompdf\\FrameDecorator\\$decorator";
        $reflower   = "Dompdf\\FrameReflower\\$reflower";

        /** @var AbstractFrameDecorator $deco */
        $deco = new $decorator($frame, $dompdf);

        $deco->set_positioner(self::getPositionerInstance($positioner));
        $deco->set_reflower(new $reflower($deco, $dompdf->getFontMetrics()));

        if ($root) {
            $deco->set_root($root);
        }

        if ($display === "list-item") {
            // Insert a list-bullet frame
            $xml = $dompdf->getDom();
            $bullet_node = $xml->createElement("bullet"); // arbitrary choice
            $b_f = new Frame($bullet_node);

            $node = $frame->get_node();
            $parent_node = $node->parentNode;

            if ($parent_node) {
                if (!$parent_node->hasAttribute("dompdf-children-count")) {
                    $xpath = new DOMXPath($xml);
                    $count = $xpath->query("li", $parent_node)->length;
                    $parent_node->setAttribute("dompdf-children-count", $count);
                }

                if (is_numeric($node->getAttribute("value"))) {
                    $index = intval($node->getAttribute("value"));
                } else {
                    if (!$parent_node->hasAttribute("dompdf-counter")) {
                        $index = ($parent_node->hasAttribute("start") ? $parent_node->getAttribute("start") : 1);
                    } else {
                        $index = (int)$parent_node->getAttribute("dompdf-counter") + 1;
                    }
                }

                $parent_node->setAttribute("dompdf-counter", $index);
                $bullet_node->setAttribute("dompdf-counter", $index);
            }

            $new_style = $dompdf->getCss()->create_style();
            $new_style->display = "-dompdf-list-bullet";
            $new_style->inherit($style);
            $b_f->set_style($new_style);

            $deco->prepend_child(Factory::decorate_frame($b_f, $dompdf, $root));
        }

        return $deco;
    }
697406
def create_stylesheets
      template 'stylesheets/myg.scss', "#{stylesheets_dir}/myg.scss"
      template 'stylesheets/variables/_action-button.scss',
               "#{stylesheets_dir}/variables/_action-button.scss"
      template 'stylesheets/variables/_animate.scss',
               "#{stylesheets_dir}/variables/_animate.scss"
      template 'stylesheets/variables/_base.scss',
               "#{stylesheets_dir}/variables/_base.scss"
      template 'stylesheets/variables/_font.scss',
               "#{stylesheets_dir}/variables/_font.scss"
      template 'stylesheets/variables/_footer.scss',
               "#{stylesheets_dir}/variables/_footer.scss"
      template 'stylesheets/variables/_grid.scss',
               "#{stylesheets_dir}/variables/_grid.scss"
      template 'stylesheets/variables/_layout.scss',
               "#{stylesheets_dir}/variables/_layout.scss"
      template 'stylesheets/variables/_spacing.scss',
               "#{stylesheets_dir}/variables/_spacing.scss"
      template 'stylesheets/variables/_text.scss',
               "#{stylesheets_dir}/variables/_text.scss"
      template 'stylesheets/variables/_theme.scss',
               "#{stylesheets_dir}/variables/_theme.scss"
      template 'stylesheets/theme/theme.scss',
               "#{stylesheets_dir}/theme/theme.scss"
      template 'stylesheets/theme/_custom.scss',
               "#{stylesheets_dir}/theme/_custom.scss"
    end
519209
function generateFormatterExamples(formatterInfo, prereleaseVersion) {
    const output = ejs.render(cat("./templates/formatter-examples.md.ejs"), formatterInfo);
    let filename = "../eslint.github.io/docs/user-guide/formatters/index.md",
        htmlFilename = "../eslint.github.io/docs/user-guide/formatters/html-formatter-example.html";

    if (prereleaseVersion) {
        filename = filename.replace("/docs", `/docs/${prereleaseVersion}`);
        htmlFilename = htmlFilename.replace("/docs", `/docs/${prereleaseVersion}`);
        if (!test("-d", path.dirname(filename))) {
            mkdir(path.dirname(filename));
        }
    }

    output.to(filename);
    formatterInfo.formatterResults.html.result.to(htmlFilename);
}
1124785
def to_pdf_data
      pdf_data = header

      @data.each do |key, value|
        if Hash === value
          value.each do |sub_key, sub_value|
            pdf_data << field("#{key}_#{sub_key}", sub_value)
          end
        else
          pdf_data << field(key, value)
        end
      end

      pdf_data << footer
      return encode_data(pdf_data)
    end
1015853
protected function createStylesheet() {

		$this->stylesheet = strtolower( sanitize_file_name( wp_get_theme() . '.css' ) );
		$path_to_tmp_stylesheet = $this->tmpDir . "/OEBPS/{$this->stylesheet}";

		// Copy stylesheet
		\Pressbooks\Utility\put_contents(
			$path_to_tmp_stylesheet,
			$this->loadTemplate( $this->exportStylePath )
		);

		$this->scrapeKneadAndSaveCss( $this->exportStylePath, $path_to_tmp_stylesheet );
	}
796893
private void createOutputHeader() {
        // setup some constants
        String endBracket3 = "   }\n";
        String endBracket4 = "    }\n";
        String boldFont = "    font-weight:bold;\n";
        String swapRow = "   </tr><tr>\n";

        // Open file
        SimpleDateFormat sdf = new SimpleDateFormat("EEEE, MMMM d, yyyy");
        SimpleDateFormat stf = new SimpleDateFormat("HH:mm:ss");
        String datePart = sdf.format(new Date());
        String sTime = stf.format(startTime);
        try (FileWriter fw = new FileWriter(file); BufferedWriter out = new BufferedWriter(fw)) {
            out.write("<html>\n");
            out.write(" <head>\n");
            out.write("  <title>" + test + "</title>\n");
            out.write("  <style type='text/css'>\n");
            out.write("    @page {\n");
            out.write("     size: landscape;\n");
            out.write(endBracket3);
            out.write("   table {\n");
            out.write("    margin-left:auto;margin-right:auto;\n");
            out.write("    width:90%;\n");
            out.write("    border-collapse:collapse;\n");
            out.write(endBracket3);
            out.write("   table, td, th {\n");
            out.write("    border:1px solid black;\n");
            out.write("    padding:0px 10px;\n");
            out.write(endBracket3);
            out.write("   th {\n");
            out.write("    text-align:right;\n");
            out.write(endBracket3);
            out.write("   td {\n");
            out.write("    word-wrap: break-word;\n");
            out.write(endBracket3);
            out.write("   .check {\n");
            out.write("    color:orange;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .fail {\n");
            out.write("    color:red;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .pass {\n");
            out.write("    color:green;\n");
            out.write(boldFont);
            out.write(endBracket3);
            out.write("   .indent {\n");
            out.write("    position:relative;\n");
            out.write("    left:10px;\n");
            out.write(endBracket3);
            out.write("  </style>\n");
            out.write("  <script type='text/javascript'>\n");
            out.write("   function toggle( imageName ) {\n");
            out.write("    var element = document.getElementById( imageName );\n");
            out.write("    element.src = location.href.match(/^.*\\//) + imageName;\n");
            out.write("    element.style.display = (element.style.display != 'none' ? 'none' : '' );\n");
            out.write(endBracket3);
            out.write("   function display( imageName ) {\n");
            out.write("    window.open( location.href.match(/^.*\\//) + imageName )\n");
            out.write(endBracket3);
            out.write("   function toggleVis(col_no, do_show) {\n");
            out.write("    var stl;\n");
            out.write("    if (do_show) stl = ''\n");
            out.write("    else         stl = 'none';\n");
            out.write("    var tbl  = document.getElementById('all_results');\n");
            out.write("    var rows = tbl.getElementsByTagName('tr');\n");
            out.write("    var cels = rows[0].getElementsByTagName('th')\n");
            out.write("    cels[col_no].style.display=stl;\n");
            out.write("    for (var row=1; row<rows.length;row++) {\n");
            out.write("     var cels = rows[row].getElementsByTagName('td')\n");
            out.write("     cels[col_no].style.display=stl;\n");
            out.write(endBracket4);
            out.write(endBracket3);
            out.write("   function getElementsByClassName(oElm, strTagName, strClassName){\n");
            out.write(
                    "    var arrElements = (strTagName == '*' && document.all)? document.all : oElm" +
                            ".getElementsByTagName(strTagName);\n");
            out.write("    var arrReturnElements = new Array();\n");
            out.write("    strClassName = strClassName.replace(/\\-/g, '\\\\-');\n");
            out.write("    var oRegExp = new RegExp('(^|\\s)' + strClassName + '(\\s|$)');\n");
            out.write("    var oElement;\n");
            out.write("    for(var i=0; i<arrElements.length; i++){\n");
            out.write("     oElement = arrElements[i];\n");
            out.write("     if(oRegExp.test(oElement.className)){\n");
            out.write("      arrReturnElements.push(oElement);\n");
            out.write("     }\n");
            out.write(endBracket4);
            out.write("    return (arrReturnElements)\n");
            out.write(endBracket3);
            out.write("   function fixImages( imageName ) {\n");
            out.write("    top.document.title = document.title;\n");
            out.write("    allImgIcons = getElementsByClassName( document, 'img', 'imgIcon' );\n");
            out.write("    for( var element in allImgIcons ) {\n");
            out.write("     element.src = location.href.match(/^.*\\//) + element.src;\n");
            out.write(endBracket4);
            out.write(endBracket3);
            out.write("  </script>\n");
            out.write(" </head>\n");
            out.write(" <body onLoad='fixImages()'>\n");
            out.write("  <table>\n");
            out.write(START_ROW);
            out.write("    <th bgcolor='lightblue'><font size='5'>Test</font></th>\n");
            out.write("    <td bgcolor='lightblue' colspan='3'><font size='5'>" + test + " </font></td>\n");
            out.write(swapRow);
            out.write("    <th>Tester</th>\n");
            out.write("    <td>Automated</td>\n");
            out.write("    <th>Version</th>\n");
            out.write(START_CELL + this.version + END_CELL);
            out.write(swapRow);
            out.write("    <th>Author</th>\n");
            out.write(START_CELL + this.author + END_CELL);
            out.write("    <th rowspan='2'>Test Run Time</th>\n");
            out.write("    <td rowspan='2'>\n");
            out.write("     Start:\t" + sTime + " <br/>\n");
            out.write("     End:\tTIMEFINISHED <br/>\n");
            out.write("     Run Time:\tRUNTIME \n");
            out.write("    </td>\n ");
            out.write(swapRow);
            out.write("    <th>Date Tested</th>\n");
            out.write(START_CELL + datePart + END_CELL);
            out.write(swapRow);
            out.write("    <th>URL Under Test</th>\n");
            out.write(START_CELL + "<a href='" + url + "'>" + url + "</a>" + END_CELL);
            out.write("    <th>Browser</th>\n");
            out.write(START_CELL + capabilities.getBrowser().getDetails() + END_CELL);
            out.write(swapRow);
            out.write("    <th>Testing Group</th>\n");
            out.write(START_CELL + group + END_CELL);
            out.write("    <th>Testing Suite</th>\n");
            out.write(START_CELL + suite + END_CELL);
            out.write(swapRow);
            out.write("    <th>Test Objectives</th>\n");
            out.write("    <td colspan='3'>" + objectives + END_CELL);
            out.write(swapRow);
            out.write("    <th>Overall Results</th>\n");
            out.write("    <td colspan='3' style='padding: 0px;'>\n");
            out.write("     <table style='width: 100%;'><tr>\n");
            out.write("      <td font-size='big' rowspan='2'>PASSORFAIL</td>\n");
            out.write("      <td><b>Steps Performed</b></td><td><b>Steps Passed</b></td>" +
                    "<td><b>Steps Failed</b></td>\n");
            out.write("     </tr><tr>\n");
            out.write("      <td>STEPSPERFORMED</td><td>STEPSPASSED</td><td>STEPSFAILED</td>\n");
            out.write("     </tr></table>\n");
            out.write("    </td>\n");
            out.write(swapRow);
            out.write("    <th>View Results</th>\n");
            out.write("    <td colspan='3'>\n");
            out.write("     <input type='checkbox' name='step' onclick='toggleVis(0,this.checked)' " +
                    "checked='checked'>Step</input>\n");
            out.write("     <input type='checkbox' name='action' onclick='toggleVis(1,this.checked)' " +
                    "checked='checked'>Action</input>\n");
            out.write(
                    "     <input type='checkbox' name='expected' onclick='toggleVis(2,this.checked)' " +
                            "checked='checked'>Expected Results</input>\n");
            out.write(
                    "     <input type='checkbox' name='actual' onclick='toggleVis(3,this.checked)' " +
                            "checked='checked'>Actual Results</input>\n");
            out.write(
                    "     <input type='checkbox' name='times' onclick='toggleVis(4,this.checked)' " +
                            "checked='checked'>Step Times</input>\n");
            out.write("     <input type='checkbox' name='result' onclick='toggleVis(5,this.checked)' " +
                    "checked='checked'>Results</input>\n");
            out.write("    </td>\n");
            out.write(END_ROW);
            out.write("  </table>\n");
            out.write("  <table id='all_results'>\n");
            out.write(START_ROW);
            out.write("    <th align='center'>Step</th><th style='text-align:center'>Action</th>" +
                    "<th style='text-align:center'>Expected Result</th>" +
                    "<th style='text-align:center'>Actual Result</th>" +
                    "<th style='text-align:center'>Step Times</th><th style='text-align:center'>Pass/Fail</th>\n");
            out.write(END_ROW);
        } catch (IOException e) {
            log.error(e);
        }
    }
1057112
def pdftoxml(pdfdata, options=""):
    """"""
    pdffout = tempfile.NamedTemporaryFile(suffix='.pdf')
    pdffout.write(pdfdata)
    pdffout.flush()

    xmlin = tempfile.NamedTemporaryFile(mode='r', suffix='.xml')
    tmpxml = xmlin.name  # "temph.xml"
    cmd = 'pdftohtml -xml -nodrm -zoom 1.5 -enc UTF-8 -noframes %s "%s" "%s"' % (
        options, pdffout.name, os.path.splitext(tmpxml)[0])
    # can't turn off output, so throw away even stderr yeuch
    cmd = cmd + " >/dev/null 2>&1"
    os.system(cmd)

    pdffout.close()
    #xmlfin = open(tmpxml)
    xmldata = xmlin.read()
    xmlin.close()
    return xmldata.decode('utf-8')
1257263
function FPDF($orientation='P', $unit='mm', $format='A4')
{
	//Some checks
	$this->_dochecks();
	//Initialization of properties
	$this->page=0;
	$this->n=2;
	$this->buffer='';
	$this->pages=array();
	$this->PageSizes=array();
	$this->state=0;
	$this->fonts=array();
	$this->FontFiles=array();
	$this->diffs=array();
	$this->images=array();
	$this->links=array();
	$this->InHeader=false;
	$this->InFooter=false;
	$this->lasth=0;
	$this->FontFamily='';
	$this->FontStyle='';
	$this->FontSizePt=12;
	$this->underline=false;
	$this->DrawColor='0 G';
	$this->FillColor='0 g';
	$this->TextColor='0 g';
	$this->ColorFlag=false;
	$this->ws=0;
	//Standard fonts
	$this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique',
		'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique',
		'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic',
		'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats');
	//Scale factor
	if($unit=='pt')
		$this->k=1;
	elseif($unit=='mm')
		$this->k=72/25.4;
	elseif($unit=='cm')
		$this->k=72/2.54;
	elseif($unit=='in')
		$this->k=72;
	else
		$this->Error('Incorrect unit: '.$unit);
	//Page format
	$this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
		'letter'=>array(612,792), 'legal'=>array(612,1008));
	if(is_string($format))
		$format=$this->_getpageformat($format);
	$this->DefPageFormat=$format;
	$this->CurPageFormat=$format;
	//Page orientation
	$orientation=strtolower($orientation);
	if($orientation=='p' || $orientation=='portrait')
	{
		$this->DefOrientation='P';
		$this->w=$this->DefPageFormat[0];
		$this->h=$this->DefPageFormat[1];
	}
	elseif($orientation=='l' || $orientation=='landscape')
	{
		$this->DefOrientation='L';
		$this->w=$this->DefPageFormat[1];
		$this->h=$this->DefPageFormat[0];
	}
	else
		$this->Error('Incorrect orientation: '.$orientation);
	$this->CurOrientation=$this->DefOrientation;
	$this->wPt=$this->w*$this->k;
	$this->hPt=$this->h*$this->k;
	//Page margins (1 cm)
	$margin=28.35/$this->k;
	$this->SetMargins($margin,$margin);
	//Interior cell margin (1 mm)
	$this->cMargin=$margin/10;
	//Line width (0.2 mm)
	$this->LineWidth=.567/$this->k;
	//Automatic page break
	$this->SetAutoPageBreak(true,2*$margin);
	//Full width display mode
	$this->SetDisplayMode('fullwidth');
	//Enable compression
	$this->SetCompression(true);
	//Set default PDF version number
	$this->PDFVersion='1.3';
}
386752
static function insert_cached_document(CPDF_Adapter $pdf, $id, $new_page = true) {
    $res = self::__query("SELECT font_name FROM page_fonts WHERE id='" . pg_escape_string($id) . "'");

    // Ensure that the fonts needed by the cached document are loaded into
    // the pdf
    while ($row = pg_fetch_assoc($res)) 
      $pdf->get_cpdf()->selectFont($row["font_name"]);
    
    $res = self::__query("SELECT data FROM page_cache WHERE id='" . pg_escape_string($id) . "'");

    if ( $new_page )
      $pdf->new_page();

    $first = true;
    while ($row = pg_fetch_assoc($res)) {

      if ( !$first ) 
        $pdf->new_page();
      else 
        $first = false;        
      
      $page = $pdf->reopen_serialized_object($row["data"]);
      //$pdf->close_object();
      $pdf->add_object($page, "add");

    }
      
  }
397902
function loadPdfTemplate(params, cb) {
  logger.debug("renderPDF loadPdfTemplate", params);

  //Already have a compiled template, no need to compile it again.
  if (pdfTemplate) {
    return cb(null, pdfTemplate);
  } else {
    readAndCompileTemplate(function(err, compiledTemplate) {
      pdfTemplate = compiledTemplate;
      return cb(err, pdfTemplate);
    });
  }
}
486030
function (table) {
        if (!table.pdf.page) {
            return;
        }
        if (this.calculatedWidth === null) {
            var self = this,
                content_width = this.maxWidth,
                width = lodash.sumBy(table.getColumns(), function (column) {
                    return column.id !== self.column ? column.width : 0;
                });

            if (!content_width) {
                content_width = table.pdf.page.width
                    - table.pdf.page.margins.left
                    - table.pdf.page.margins.right;
            }

            this.calculatedWidth = content_width - width;
            if (this.calculatedWidth < 0) {
                this.calculatedWidth = 0;
            }
        }
        table.setColumnWidth(this.column, this.calculatedWidth, true);
    }
988713
public function getPdfContent($request) {
    // Get all parameters from query.
    $parameters = $request->query->all();
    $category = !empty($parameters['categories']) ? $parameters['categories'] : '0';
    $rooms = !empty($parameters['rooms']) ? $parameters['rooms'] : '';
    $classnames = !empty($parameters['cn']) ? $parameters['cn'] : [];
    $location = !empty($parameters['locations']) ? $parameters['locations'] : '0';
    $date = !empty($parameters['date']) ? $parameters['date'] : '';
    $mode = !empty($parameters['mode']) ? $parameters['mode'] : 'activity';

    if (empty($date)) {
      $date = time();
    }
    else {
      $date = strtotime($date);
    }

    // Calculate first day of a week.
    $monday_timestamp = strtotime("last Monday", $date);
    if (date('D', $date) === 'Mon') {
      $monday_timestamp = $date;
    }
    $timestamp_start = $monday_timestamp;

    $result = [];
    // Create weekly schedule by getting results for every weekday.
    for ($i = 1; $i <= 7; $i++) {
      $date = DrupalDateTime::createFromTimestamp($timestamp_start);
      $result[$date->format('Y-m-d')] = $this->getData($request, $location, $date->format('F j, l 00:00:00'), $category);
      $timestamp_start += 86400;
    }
    if (!empty($rooms)) {
      $rooms = explode(',', $rooms);
    }
    // Group by activity.
    if ($mode == 'activity') {
      $result = $this->groupByActivity($result, $rooms, $classnames);
      $theme = 'openy_repeat__pdf__table__activity';
    }
    // Group by day.
    if ($mode == 'day') {
      $result = $this->groupByDay($result, $rooms, $classnames);
      $theme = 'openy_repeat__pdf__table__day';
    }

    $content = [
      'content' => $result,
      'theme' => $theme,
    ];

    return $content;
  }
656859
function () {
    // render stylesheets
    var precss = fs.readFileSync(__dirname + '/themes/default/styl/default.styl', 'utf8');
    stylus.render(precss, { filename: 'default.css' }, function(err, css){
      if (err) {
        throw err;
      }

      this.styles = css;
    }.bind(this));

    // collect client js (to be inined later)
    this.js = fs.readFileSync(__dirname + '/themes/default/js/default.js', 'utf8');

    // register handlebars helpers
    Handlebars.registerHelper('roundNumber', function (number) {
      return Math.round(number * Math.pow(10, 2)) / Math.pow(10, 2);
    });

    // collect & compile templates
    this.templates = {};
    this.templates.test = Handlebars.compile(fs.readFileSync(__dirname + '/themes/default/hbs/test.hbs', 'utf8'));
    this.templates.wrapper = Handlebars.compile(fs.readFileSync(__dirname + '/themes/default/hbs/wrapper.hbs', 'utf8'));
    this.templates.testresult = Handlebars.compile(fs.readFileSync(__dirname + '/themes/default/hbs/tests.hbs', 'utf8'));
    this.templates.banner = Handlebars.compile(fs.readFileSync(__dirname + '/themes/default/hbs/banner.hbs', 'utf8'));
    this.templates.detail = Handlebars.compile(fs.readFileSync(__dirname + '/themes/default/hbs/detail.hbs', 'utf8'));

    return this;
  }
1090516
public function maybeUpdateStylesheets() {
		// If this is ajax/cron/404, don't update right now
		if ( wp_doing_ajax() || wp_doing_cron() || is_404() ) {
			return false;
		}

		// Compare current and previous Buckram versions
		$current_buckram_version = $this->getBuckramVersion();
		$last_buckram_version = get_option( 'pressbooks_buckram_version' );
		$buckram_updated = version_compare( $current_buckram_version, $last_buckram_version ) > 0;

		// Compare current and previous theme versions
		$theme = wp_get_theme();
		$current_theme_version = $theme->get( 'Version' );
		$last_theme_version = get_option( 'pressbooks_theme_version' );
		$theme_updated = version_compare( $current_theme_version, $last_theme_version ) > 0;

		// If either Buckram or the theme were updated, rebuild the web and editor stylesheets.
		if ( $buckram_updated || $theme_updated ) {
			// Try to stop a Cache Stampede, Dog-Pile, Cascading Failure...
			if ( ! get_transient( 'pressbooks_updating_stylesheet' ) ) {
				set_transient( 'pressbooks_updating_stylesheet', 1, 5 * MINUTE_IN_SECONDS );
				( new Modules\ThemeOptions\Admin() )->clearCache();
				$this->updateWebBookStyleSheet();
				update_editor_style();
				if ( $buckram_updated ) {
					update_option( 'pressbooks_buckram_version', $current_buckram_version );
				}
				if ( $theme_updated ) {
					update_option( 'pressbooks_theme_version', $current_theme_version );
				}
				delete_transient( 'pressbooks_updating_stylesheet' );
				return true;
			}
		}

		return false;
	}
639628
def build_pdf
      @push_down = 0
      @push_items_table = 0
      @pdf.fill_color '000000'
      build_header
      build_provider_box
      build_purchaser_box
      build_payment_method_box
      build_info_box
      build_items
      build_total
      build_stamp
      build_logo
      build_note
      build_footer
    end