Compiles a theme.
489111
def compile_theme(theme_id=None):
    """"""
    from engineer.processors import convert_less
    from engineer.themes import ThemeManager

    if theme_id is None:
        themes = ThemeManager.themes().values()
    else:
        themes = [ThemeManager.theme(theme_id)]

    with(indent(2)):
        puts(colored.yellow("Compiling %s themes." % len(themes)))

        for theme in themes:
            theme_output_path = (theme.static_root / ('stylesheets/%s_precompiled.css' % theme.id)).normpath()

            puts(colored.cyan("Compiling theme %s to %s" % (theme.id, theme_output_path)))
            with indent(4):
                puts("Compiling...")
                convert_less(theme.static_root / ('stylesheets/%s.less' % theme.id),
                             theme_output_path,
                             minify=True)
                puts(colored.green("Done.", bold=True))
192442
def _compile(pattern, flags):
    """"""

    return re.compile(WcParse(pattern, flags & FLAG_MASK).parse())
383641
public function compile()
	{
		$this->rrmdir($this->config['dir']['site']);
		$this->compilePosts();
		$this->compilePages();
		$this->compileCategories();
		$this->compileAssets();
		$this->compilePaginations();
		$this->compileAuthors();
	}
937355
protected function compile()
    {
        $this->headers = array_merge(
            $this->csp(),
            $this->featurePolicy(),
            $this->hpkp(),
            $this->hsts(),
            $this->expectCT(),
            $this->clearSiteData(),
            $this->miscellaneous()
        );

        $this->compiled = true;
    }
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;
  }
665626
public function prepareTheme()
    {
        $this->viewBuilder()->layout('default');
        if (!empty($this->request->params['prefix']) &&
            strtolower($this->request->params['prefix']) === 'admin'
        ) {
            $this->viewBuilder()->theme(option('back_theme'));
        } else {
            $this->viewBuilder()->theme(option('front_theme'));
        }

        if ($this->request->isAjax()) {
            $this->viewBuilder()->layout('ajax');
        }

        if ($this->request->isHome()) {
            $this->viewBuilder()->layout('home');
        }

        if ($this->request->isDashboard()) {
            $this->viewBuilder()->layout('dashboard');
        }
    }
567676
public function run()
    {
        $data = $this->getData();

        foreach ($data as $feature => $value)
        {
            // Allow theme features without options.
            if (is_int($feature))
            {
                add_theme_support($value);
            }
            else
            {
                // Theme features with options.
                add_theme_support($feature, $value);
            }
        }
    }
448831
public function build()
    {
        $themes = (array)$this->config->general('themes');
        foreach ($themes as $theme) {
            $this->_io->verbose('Building with theme = ' . $theme);
            $this->config->theme($theme);
            foreach ($this->factory->assetCollection() as $target) {
                if ($target->isThemed()) {
                    $this->_buildTarget($target);
                }
            }
        }
        $this->_io->verbose('Building un-themed targets.');
        foreach ($this->factory->assetCollection() as $target) {
            $this->_buildTarget($target);
        }
    }
348504
protected function _setTheme()
    {
        $theme = $this->request->getParam('theme');
        if ($theme) {
            $this->viewBuilder()->setTheme($theme);
        }
    }
803312
def _load_themes(self):
        """"""
        with utils.temporary_chdir(utils.get_file_directory()):
            self._append_theme_dir("themes")
            self.tk.eval("source themes/pkgIndex.tcl")
            theme_dir = "gif" if not self.png_support else "png"
            self._append_theme_dir(theme_dir)
            self.tk.eval("source {}/pkgIndex.tcl".format(theme_dir))
        self.tk.call("package", "require", "ttk::theme::scid")
814325
public function compile()
    {
        $sql = array();

        if (isset($this->select)) {
            $sql[] = 'SELECT ' . implode(',', $this->select);
        }

        if (isset($this->update)) {
            $sql[] = 'UPDATE';
            $sql[] = $this->update['table'];
            $sql[] = 'SET';

            $blocks = array();
            foreach ($this->update['values'] as $key => $value) {
                $blocks[] = $key . ' = ' . $value;
            }

            $sql[] = implode(',', $blocks);
        }

        if (isset($this->delete)) {
            $sql[] = "DELETE ";
        }

        if (isset($this->insert)) {
            $sql[] = 'INSERT INTO';
            $sql[] = $this->insert['table'];

            $fields = array();
            $replaces = array();

            foreach ($this->insert['values'] as $key => $value) {
                $fields[] = '`' . $key . '`';
                $replaces[] = $value;
            }

            $sql[] = '(' . implode(',', $fields) . ')';
            $sql[] = (count($this->insert['values']) > 1) ? 'VALUES' : 'VALUE';
            $sql[] = '(' . implode(',', $replaces) . ')';
        }

        if (isset($this->replace)) {
            $sql[] = 'REPLACE INTO';
            $sql[] = $this->replace['table'];

            $fields = array();
            $replaces = array();

            foreach ($this->replace['values'] as $key => $value) {
                $fields[] = '`' . $key . '`';
                $replaces[] = $value;
            }

            $sql[] = '(' . implode(',', $fields) . ')';
            $sql[] = (count($this->replace['values']) > 1) ? 'VALUES' : 'VALUE';
            $sql[] = '(' . implode(',', $replaces) . ')';
        }

        if (isset($this->from)) {
            $sql[] = 'FROM ' . implode(',', $this->from);
        }

        foreach ($this->where as $index => $where) {

            if (!is_string($where['column'])) {
                throw new \OtherCode\Database\Exceptions\QueryException("The column field is not a string in where clause.");
            }

            if (!is_string($where['operator']) || !in_array($where['operator'], $this->operators)) {
                throw new \OtherCode\Database\Exceptions\QueryException("Invalid operator in where clause.");
            }

            if (gettype($where['value']) == 'string' && $where['quoted'] === true) {
                $where['value'] = '"' . $where['value'] . '"';
            }

            unset($where['quoted']);

            $sentence = ($index == 0) ? "WHERE " : "AND ";
            $sql[] = $sentence . implode(" ", $where);

        }

        if (isset($this->group)) {
            $sql[] = 'GROUP BY ' . $this->group;
        }

        foreach ($this->order as $index => $order) {

            if (!in_array($order[1], array('ASC', 'DESC'))) {
                throw new \OtherCode\Database\Exceptions\QueryException('Invalid order by value, must be ASC or DESC.');
            }

            $sql[] = 'ORDER BY ' . implode(" ", $order);
        }

        if (isset($this->limit)) {
            $sql[] = 'LIMIT ' . implode(" ", $this->limit);
        }

        return trim(implode(" ", $sql));
    }
818459
def compile(self):
        """"""
        result = TEMPLATE

        for rule in self.rules:
            if rule[2]:
                arrow = '=>'
            else:
                arrow = '->'
            repr_rule = repr(rule[0] + arrow + rule[1])

            result += "algo.add_rule({repr_rule})\n".format(repr_rule=repr_rule)

        result += "for line in stdin:\n"
        result += "    print(algo.execute(''.join(line.split())))"
        return result
1082074
def main():
    """"""
    util.create_dir(os.path.join(CONF_DIR, "templates"))
    util.create_dir(os.path.join(CONF_DIR, "colorschemes/light/"))
    util.create_dir(os.path.join(CONF_DIR, "colorschemes/dark/"))

    util.setup_logging()
    parser = get_args()

    parse_args_exit(parser)
    parse_args(parser)
1346056
public function onBeforeInit() {
        $only_dev = LessCompilerConfig::config()->only_dev;
        
        // Only check and compile either on dev, or on all environments (if set)
        if (!$only_dev || $only_dev && Director::isDev()) {

            // Allow extensions for before less is compiled
            $this->owner->extend("onBeforeLessCompiler");

            $files = LessCompilerConfig::config()->file_mappings;
            $root_path = LessCompilerConfig::config()->root_path;
            $temp_folder = TEMP_FOLDER;
            
            if (is_array($files)) {
                $theme_dir = Controller::join_links(
                    "themes",
                    SSViewer::current_theme()
                );
                $base_theme = Controller::join_links(
                    $theme_dir,
                    SSViewer::current_theme()
                );
                
                $options = array('cache_dir' => $temp_folder);
                
                if (LessCompilerConfig::config()->compress) {
                    $options['compress'] = true;
                }
                
                // First loop through all files and deal with inputs
                foreach ($files as $input => $output) {
                    if ($input && $output) {
                        
                        // Does output and input contain a path
                        if (strpos($input, '/') === false) {
                            $input = Controller::join_links(
                                $theme_dir,
                                "less",
                                $input
                            );
                        }
                        
                        if (strpos($output, '/') === false) {
                            $output = Controller::join_links(
                                $theme_dir,
                                "css",
                                $output
                            );
                        }
                        
                        // Now append the full system path to the input
                        // and output file.
                        $input = Controller::join_links(BASE_PATH, $input);
                        $output = Controller::join_links(BASE_PATH, $output);
                        
                        // Finally try to compile our less files
                        try {
                            $css_file_name = Less_Cache::Get(
                                array( $input => $root_path),
                                $options
                            );
                            $css = file_get_contents(Controller::join_links($temp_folder,$css_file_name));
                            
                            $output_file = fopen($output, "w");
                            fwrite($output_file, $css);
                            fclose($output_file);
                        } catch (exception $e) {
                            error_log($e->getMessage());
                        }
                    }
                }
            }

            // Allow extensions for after less has compiled
            $this->owner->extend("onAfterLessCompiler");
        }
    }
1368070
protected function compile()
	{
		if (substr($this->url, 0, 7) == 'mailto:')
		{
			$this->url = \String::encodeEmail($this->url);
		}
		else
		{
			$this->url = ampersand($this->url);
		}

		if ($this->linkTitle == '')
		{
			$this->linkTitle = $this->url;
		}

		if (strncmp($this->rel, 'lightbox', 8) !== 0)
		{
			$this->Template->attribute = ' rel="'. $this->rel .'"';
		}
		else
		{
			$this->Template->attribute = ' data-lightbox="'. substr($this->rel, 9, -1) .'"';
		}

		// Override the link target
		if ($this->target)
		{
			$this->Template->target = ' target="_blank"';
		}

		if($this->cssID[1] == '')
		{
			$cssID = $this->cssID;
			$cssID[1] = 'btn-default';
			$this->cssID = $cssID;
		}

		if($this->icon)
		{
			$this->Template->icon = Icons::generateIcon($this->icon);
		}

		// add data attributes
		$this->dataAttributes = deserialize($this->dataAttributes, true);

		if(!empty($this->dataAttributes))
		{
			$attributes = array();

			foreach($this->dataAttributes as $attribute)
			{
				if(trim($attribute['value']) != '' && $attribute['name'] != '')
				{

					$attributes[] = 'data-' . $attribute['name'] . '=' . $attribute['value'];
				}
			}

			$this->Template->attribute = trim($this->attribute . ' ' . implode(' ', $attributes));
		}

		$this->Template->rel = $this->rel; // Backwards compatibility
		$this->Template->href = $this->url;
		$this->Template->link = $this->linkTitle;
		$this->Template->linkTitle = specialchars($this->titleText ?: $this->linkTitle);
	}
804821
protected function compile()
	{
		$data = deserialize($this->columnset, true);
		$articles = array();

		$container = \Netzmacht\ColumnSet\ColumnSet::prepareContainer($this->columnset_id);
		$i=0;

		foreach($data as $article) {
			$articles[] = array(
				'article' => $this->getArticle($article['article'], false, !((bool) $this->articleMarkup)),
				'class'   => $container[$i++][0],
				'id'      => $article['article'],
			);
		}

		$this->Template->articles = $articles;
	}
102689
public function compile()
	{
		$objModule = \ModuleModel::findByPk($this->module);
	
		if ($objModule === null)
		{
			return;
		}
		
		$strClass = Module::findClass($objModule->type);
		
		if (!class_exists($strClass))
		{
			return;
		}
	
		$objModule->typePrefix = 'ce_';

		/** @var \Module $objModule */
		$objModule = new $strClass($objModule);
		
		$this->writeToTemplate($objModule->generate());
	}