Public: Use template to fill placeholders with relevant values.

 Returns the String containing a CSS stylesheet code.
195121
def make_css
      template = ERB.new TEMPLATE
      result = template.result binding
      (0..3).each { result.gsub!(/\n;\n/m, ";\n") }
      @result = result.gsub /^$\n/, ''
    end
249667
def get_placeholders(self, format_string):
        
        placeholders = set()
        # Tokenize the format string and process them
        for token in self.tokens(format_string):
            if token.group("placeholder"):
                placeholders.add(token.group("key"))
            elif token.group("command"):
                # get any placeholders used in commands
                commands = dict(parse_qsl(token.group("command")))
                # placeholders only used in `if`
                if_ = commands.get("if")
                if if_:
                    placeholders.add(Condition(if_).variable)
        return placeholders
1101432
function stylesheet(config = {}) {
	const minifier = new cleancss();
	const styles = [];

	return {
		name: 'stylesheet',
		transform(code, id) {
			// Note that 'id' can be mapped to a CJS proxy import, in which case
			// 'id' will start with 'commonjs-proxy', so let's first check if we
			// are importing an existing css file (i.e. startsWith()).
			if (!id.startsWith(path.resolve('.')) || !id.endsWith('.css')) {
				return;
			}

			if (config.minify) {
				code = minifier.minify(code).styles;
			}

			// keep track of all imported stylesheets (already minified)
			styles.push(code);

			return {
				code: 'export default ' + JSON.stringify(code)
			};
		},
		generateBundle(opts, bundle) {
			if (!config.extract) {
				return;
			}

			const entry = Object.keys(bundle).find(v => bundle[v].isEntry);
			const name = (entry || '').replace(/\.js$/i, '.css');
			if (!name) {
				this.error('failed to guess the output file name');
			}

			bundle[name] = {
				code: styles.filter(v => !!v).join('')
			};
		}
	};
}
422255
function(template, context, partials) {
        if(!this.includes("#", template) && !this.includes("^", template)) {
          return template;
        }

        var that = this;
        // CSW - Added "+?" so it finds the tighest bound, not the widest
        var regex = new RegExp(this.otag + "(\\^|\\#)\\s*(.+)\\s*" + this.ctag +
                "\n*([\\s\\S]+?)" + this.otag + "\\/\\s*\\2\\s*" + this.ctag +
                "\\s*", "mg");

        // for each {{#foo}}{{/foo}} section do...
        return template.replace(regex, function(match, type, name, content) {
          var value = that.find(name, context);
          if(type == "^") { // inverted section
            if(!value || that.is_array(value) && value.length === 0) {
              // false or empty list, render it
              return that.render(content, context, partials, true);
            } else {
              return "";
            }
          } else if(type == "#") { // normal section
            if(that.is_array(value)) { // Enumerable, Let's loop!
              return that.map(value, function(row) {
                return that.render(content, that.create_context(row),
                  partials, true);
              }).join("");
            } else if(that.is_object(value)) { // Object, Use it as subcontext!
              return that.render(content, that.create_context(value),
                partials, true);
            } else if(typeof value === "function") {
              // higher order section
              return value.call(context, content, function(text) {
                return that.render(text, context, partials, true);
              });
            } else if(value) { // boolean section
              return that.render(content, context, partials, true);
            } else {
              return "";
            }
          }
        });
      }
1028788
def js_source_from_string(template_name, content, output_as_array = false)
      buffer = []
      parsed = @parser.parse(content)
      if parsed.nil?
        raise ParseError.new(@parser.failure_reason, @parser.failure_line, @parser.failure_column)
      end
      
      template_namespace(buffer, template_name)
      template_header(buffer, template_name)
      parsed.elements.each do |element|
        push_content(buffer, element)
      end
      template_footer(buffer)
            
      output_as_array ? buffer : buffer.join("\n")
    end
520991
function createTemplateValue(start, end) {
    var value = "";
    while (start <= end) {
      if (tokens[start].value) {
        value += tokens[start].value;
      } else if (tokens[start].type !== tt.template) {
        value += tokens[start].type.label;
      }
      start++;
    }
    return value;
  }
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;
  }
13388
function _stylesheetListRenderer(item) {
        var html = "<span class='stylesheet-name'>" + _.escape(item.name);
        if (item.subDirStr) {
            html += "<span class='stylesheet-dir'> — " + _.escape(item.subDirStr) + "</span>";
        }
        html += "</span>";
        return html;
    }
986061
static String format(String template, Object... args) {
        template = String.valueOf(template); // null -> "null"

        if (N.isNullOrEmpty(args)) {
            return template;
        }

        // start substituting the arguments into the '%s' placeholders
        final StringBuilder sb = Objectory.createStringBuilder(template.length() + 16 * args.length);
        int templateStart = 0;
        int i = 0;

        String placeholder = "{}";
        int placeholderStart = template.indexOf(placeholder);

        if (placeholderStart < 0) {
            placeholder = "%s";
            placeholderStart = template.indexOf(placeholder);
        }

        while (placeholderStart >= 0 && i < args.length) {
            sb.append(template, templateStart, placeholderStart);
            sb.append(N.toString(args[i++]));
            templateStart = placeholderStart + 2;
            placeholderStart = template.indexOf(placeholder, templateStart);
        }

        sb.append(template, templateStart, template.length());

        // if we run out of placeholders, append the extra args in square braces
        if (i < args.length) {
            sb.append(" [");
            sb.append(N.toString(args[i++]));
            while (i < args.length) {
                sb.append(", ");
                sb.append(N.toString(args[i++]));
            }
            sb.append(']');
        }

        final String result = sb.toString();

        Objectory.recycle(sb);

        return result;
    }
823762
def render_layout(self, form, context, template_pack=TEMPLATE_PACK):
        
        # Writing the label values into the field placeholders.
        # This is done at rendering time, so the Form.__init__() could update any labels before.
        # Django 1.11 no longer lets EmailInput or URLInput inherit from TextInput,
        # so checking for `Input` instead while excluding `HiddenInput`.
        for field in form.fields.values():
            if field.label and \
                    isinstance(field.widget, (Input, forms.Textarea)) and \
                    not isinstance(field.widget, forms.HiddenInput):
                field.widget.attrs['placeholder'] = u"{0}:".format(field.label)

        return super(CompactLabelsCommentFormHelper, self).render_layout(form, context, template_pack=template_pack)
95490
def get_templates
      hash = []
      current_theme = Setting.get('theme_folder')

      Dir.glob("#{Rails.root}/app/views/themes/#{current_theme}/template-*.html.erb") do |my_text_file|
        opt = my_text_file.split('/').last
        opt['template-'] = ''
        opt['.html.erb'] = ''
        # strips out the template- and .html.erb extention and returns the middle as the template name for the admin
        hash << opt.titleize
      end

      hash
    end
98962
public static String getCssCode(BandElement be, Map<String, Object> style, boolean needed) {

		StringBuilder css = new StringBuilder();
		if (needed) {
			if (style.containsKey(StyleFormatConstants.FONT_FAMILY_KEY)) {
				String val = (String) style.get(StyleFormatConstants.FONT_FAMILY_KEY);
				css.append(" font-family: ").append(val).append(" ;\n");
			}

			if (style.containsKey(StyleFormatConstants.FONT_SIZE)) {
				Float val = (Float) style.get(StyleFormatConstants.FONT_SIZE);
				css.append("font-size: ").append(val.intValue()).append("pt ;\n");
			}
		}
		
		if (style.containsKey(StyleFormatConstants.FONT_COLOR)) {
			Color val = (Color) style.get(StyleFormatConstants.FONT_COLOR);
			css.append("color: rgb(").append(val.getRed()).append(",").append(val.getGreen()).append(",").append(val.getBlue())
					.append(") ;\n");
		}
		if (style.containsKey(StyleFormatConstants.FONT_STYLE_KEY)) {
			if (StyleFormatConstants.FONT_STYLE_NORMAL.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
				css.append("font-weight: normal ;\n");
				css.append("font-style: normal;  \n");
			}
			if (StyleFormatConstants.FONT_STYLE_BOLD.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
				css.append("font-weight: bold; \n");
				css.append("font-style: normal;  \n");
			}
			if (StyleFormatConstants.FONT_STYLE_ITALIC.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
				css.append("font-weight: normal; \n");
				css.append("font-style: italic;  \n");
			}
			if (StyleFormatConstants.FONT_STYLE_BOLDITALIC.equals(style.get(StyleFormatConstants.FONT_STYLE_KEY))) {
				css.append("font-weight: bold; \n");
				css.append("font-style: italic; \n");
			}
		}
		if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
			Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
			if ((val.getRed() != 255) || (val.getGreen() != 255) || (val.getBlue() != 255)) {				
				css.append("background-color: rgb(").append(val.getRed()).append(",").append(val.getGreen()).append(",")
						.append(val.getBlue()).append(") ;\n");
			}
		}
		if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
			if (StyleFormatConstants.HORIZONTAL_ALIGN_LEFT.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
				css.append("text-align:left; \n");
			}
			if (StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
				css.append("text-align:right; \n");
			}
			if (StyleFormatConstants.HORIZONTAL_ALIGN_CENTER.equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
				css.append("text-align:center; \n");
			}
		}
		if (style.containsKey(StyleFormatConstants.VERTICAL_ALIGN_KEY)) {
			if (StyleFormatConstants.VERTICAL_ALIGN_MIDDLE.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
				css.append("vertical-align:middle; \n");
			}
			if (StyleFormatConstants.VERTICAL_ALIGN_TOP.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
				css.append("vertical-align:top; \n");
			}
			if (StyleFormatConstants.VERTICAL_ALIGN_BOTTOM.equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
				css.append("vertical-align:bottom; \n");
			}
		}
		if (style.containsKey(StyleFormatConstants.PADDING_LEFT)) {
			Float val = (Float) style.get(StyleFormatConstants.PADDING_LEFT);
			css.append("padding-left:").append(val).append("pt; \n");
		}
		if (style.containsKey(StyleFormatConstants.PADDING_RIGHT)) {
			Float val = (Float) style.get(StyleFormatConstants.PADDING_RIGHT);
			css.append("padding-right:").append(val).append("pt; \n");
		}
		if (style.containsKey(StyleFormatConstants.PADDING_TOP)) {
			Float val = (Float) style.get(StyleFormatConstants.PADDING_TOP);
			css.append("padding-top:").append(val).append("pt; \n");
		}
		if (style.containsKey(StyleFormatConstants.PADDING_BOTTOM)) {
			Float val = (Float) style.get(StyleFormatConstants.PADDING_BOTTOM);
			css.append("padding-bottom:").append(val).append("px; \n");
		}
		
		if (needed) {
			if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) {
				Float val = (Float) style.get(StyleFormatConstants.BORDER_LEFT);
				css.append("border-left:").append(val.intValue()).append("px; \n");
				css.append("border-left-style:solid; \n");
				Color color = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR);
				css.append("border-left-color: ").append(Integer.toHexString(color.getRGB() & 0x00ffffff)).append(" ;\n");

			} else {
				css.append("border-left: none; \n");
			}
			if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) {
				Float val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT);
				css.append("border-right:").append(val.intValue()).append("px; \n");
				css.append("border-right-style:solid; \n");
				Color color = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR);
				css.append("border-right-color: ").append(Integer.toHexString(color.getRGB() & 0x00ffffff)).append(" ;\n");
			} else {
				css.append("border-right: none; \n");
			}
			if (style.containsKey(StyleFormatConstants.BORDER_TOP)) {
				Float val = (Float) style.get(StyleFormatConstants.BORDER_TOP);
				css.append("border-top:").append(val.intValue()).append("px; \n");
				css.append("border-top-style:solid; \n");
				Color color = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR);
				css.append("border-top-color: ").append(Integer.toHexString(color.getRGB() & 0x00ffffff)).append(" ;\n");
			} else {
				css.append("border-top: none; \n");
			}
			if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) {
				Float val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM);
				css.append("border-bottom:").append(val.intValue()).append("px; \n");
				css.append("border-bottom-style:solid; \n");
				Color color = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR);
				css.append("border-bottom-color: ").append(Integer.toHexString(color.getRGB() & 0x00ffffff)).append(" ;\n");
			} else {
				css.append("border-bottom: none; \n");
			}
		}
		if (be != null) {
			if (!be.isWrapText()) {
				css.append("white-space: nowrap; \n");
			} else {
				css.append("word-wrap: break-word; \n");
				css.append("line-height: " + be.getPercentLineSpacing() + "%; \n");
			}
			// if (be.getTextRotation() != 0) {
			// css.append(getRotationStyle(be.getTextRotation()));
			// }
		}

		return css.toString();

	}
1166444
def make_placeholders(seq, start=1):
    
    if len(seq) == 0:
        raise ValueError('Sequence must have at least one element.')
    param_style = Context.current().param_style
    placeholders = None
    if isinstance(seq, dict):
        if param_style in ('named', 'pyformat'):
            template = ':%s' if param_style == 'named' else '%%(%s)s'
            placeholders = (template % key
                            for key in six.iterkeys(seq))
    elif isinstance(seq, (list, tuple)):
        if param_style == 'numeric':
            placeholders = (':%d' % i
                            for i in xrange(start, start + len(seq)))
        elif param_style in ('qmark', 'format', 'pyformat'):
            placeholders = itertools.repeat(
                '?' if param_style == 'qmark' else '%s',
                len(seq))
    if placeholders is None:
        raise NotSupported(
            "Param style '%s' does not support sequence type '%s'" % (
                param_style, seq.__class__.__name__))
    return ', '.join(placeholders)
370310
function prepareTemplate(html) {

        var ESCAPE_STRING = /\s{2,}/g ,
            ESCAPE_CARRIAGE = /(\r)|(\n)|(\r\n)/g;

        return html.replace(ESCAPE_STRING, ' ').replace(ESCAPE_CARRIAGE, '');
    }
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
652714
function() {
            var tpl = this.options.template;

            //first pass
            $.each(this.map, function(k, v) {
                v = v[0]; 
                var r = new RegExp(v+'+'),
                    token = v.length > 1 ? v.substring(1, 2) : v;
                    
                tpl = tpl.replace(r, '{'+token+'}');
            });

            //replace spaces with &nbsp;
            tpl = tpl.replace(/ /g, '&nbsp;');

            //second pass
            $.each(this.map, function(k, v) {
                v = v[0];
                var token = v.length > 1 ? v.substring(1, 2) : v;
                    
                tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>');
            });   

            return tpl;
        }
714487
def format(value, name = nil, style = nil)
      name  ||= self.name
      style ||= self.style

      value = fixed if fixed
      value ||= default if default

      unless value
        if required?
          raise ArgumentError, %Q{No value provided for required param "#{name}"!}
        else
          return '' # No value provided and none required.
        end
      end

      if value.respond_to?(:each) && !value.respond_to?(:to_str)
        if repeating?
          values = value
        else
          raise ArgumentError, %Q{Multiple values provided for single-value param "#{name}"}
        end
      else
        values = [value]
      end

      # If the param lists acceptable values in option tags, make sure that
      # all values are found in those tags.
      if options && !options.empty?
        values.each { |_value|
          unless find_option(_value)
            acceptable = options.map { |o| o.value }.join('", "')
            raise ArgumentError, %Q{"#{_value}" is not among the acceptable parameter values ("#{acceptable}")}
          end
        }
      end

      if style == 'query' || parent.is_a?(RequestFormat) || (
        parent.respond_to?(:is_form_representation?) && parent.is_form_representation?
      )
        values.map { |v| "#{uri_escape(name)}=#{uri_escape(v.to_s)}" }.join('&')
      elsif style == 'matrix'
        if type == 'xsd:boolean'
          values.map { |v| ";#{name}" if v =~ BOOLEAN_RE }.compact.join
        else
          values.map { |v| ";#{uri_escape(name)}=#{uri_escape(v.to_s)}" if v }.compact.join
        end
      elsif style == 'header'
        values.join(',')
      else
        # All other cases: plain text representation.
        values.map { |v| uri_escape(v.to_s) }.join(',')
      end
    end