Print header block in text mode
511477
def header(*msg, level='h1', separator=" ", print_out=print):
    ''' 
    '''
    out_string = separator.join(str(x) for x in msg)
    if level == 'h0':
        # box_len = 80 if len(msg) < 80 else len(msg)
        box_len = 80
        print_out('+' + '-' * (box_len + 2))
        print_out("| %s" % out_string)
        print_out('+' + '-' * (box_len + 2))
    elif level == 'h1':
        print_out("")
        print_out(out_string)
        print_out('-' * 60)
    elif level == 'h2':
        print_out('\t%s' % out_string)
        print_out('\t' + ('-' * 40))
    else:
        print_out('\t\t%s' % out_string)
        print_out('\t\t' + ('-' * 20))
1009607
def _print_head(self):
        """"""
        self._print_divide()
        self.StrTable += "| "
        for colwidth, attr in zip(self.AttributesLength, self.Attributes):
            self.StrTable += self._pad_string(attr, colwidth * 2)
            self.StrTable += "| "
        self.StrTable += '\n'
        self._print_divide()
914218
def _repr_html_(self, header=True):
        """"""
        name = adjust_name_for_printing(self.name) + "."
        names = self.parameter_names()
        desc = self._description_str
        iops = OrderedDict()
        for opname in self._index_operations:
            iop = []
            for p in self.parameters:
                iop.extend(p.get_property_string(opname))
            iops[opname] = iop

        format_spec = self._format_spec(name, names, desc, iops, False)
        to_print = []

        if header:
            to_print.append("<tr><th><b>" + '</b></th><th><b>'.join(format_spec).format(name=name, desc='value', **dict((name, name) for name in iops)) + "</b></th></tr>")

        format_spec = "<tr><td class=tg-left>" + format_spec[0] + '</td><td class=tg-right>' + format_spec[1] + '</td><td class=tg-center>' + '</td><td class=tg-center>'.join(format_spec[2:]) + "</td></tr>"
        for i in range(len(names)):
            to_print.append(format_spec.format(name=names[i], desc=desc[i], **dict((name, iops[name][i]) for name in iops)))

        style = """<style type="text/css">
.tg  {font-family:"Courier New", Courier, monospace !important;padding:2px 3px;word-break:normal;border-collapse:collapse;border-spacing:0;border-color:#DCDCDC;margin:0px auto;width:100%;}
.tg td{font-family:"Courier New", Courier, monospace !important;font-weight:bold;color:#444;background-color:#F7FDFA;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#DCDCDC;}
.tg th{font-family:"Courier New", Courier, monospace !important;font-weight:normal;color:#fff;background-color:#26ADE4;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:#DCDCDC;}
.tg .tg-left{font-family:"Courier New", Courier, monospace !important;font-weight:normal;text-align:left;}
.tg .tg-center{font-family:"Courier New", Courier, monospace !important;font-weight:normal;text-align:center;}
.tg .tg-right{font-family:"Courier New", Courier, monospace !important;font-weight:normal;text-align:right;}
</style>"""
        return style + '\n' + '<table class="tg">' + '\n'.join(to_print) + '\n</table>'
1167465
def print_msg(msg, header, file=sys.stdout):
    """"""
    DEFAULT_MSG_BLOCK_WIDTH = 60

    # Calculate the length of the boarder on each side of the header and the
    # total length of the bottom boarder
    side_boarder_length = (DEFAULT_MSG_BLOCK_WIDTH - (len(header) + 2)) // 2
    msg_block_width = side_boarder_length * 2 + (len(header) + 2)

    # Create the top and bottom boarders
    side_boarder = '#' * side_boarder_length
    top_boarder = '{0} {1} {2}'.format(side_boarder, header, side_boarder)
    bottom_boarder = '#' * msg_block_width

    def pad(line, length):
        """Returns a string padded and centered by the given length"""
        padding_length = length - len(line)
        left_padding = ' ' * (padding_length//2)
        right_padding = ' ' * (padding_length - len(left_padding))
        return '{0} {1} {2}'.format(left_padding, line, right_padding)

    words = msg.split(' ')
    lines = []
    line = ''
    for word in words:
        if len(line + ' ' + word) <= msg_block_width - 4:
            line = (line + ' ' + word).strip()
        else:
            lines.append('#{0}#'.format(pad(line, msg_block_width - 4)))
            line = word
    lines.append('#{0}#'.format(pad(line, msg_block_width - 4)))

    # Print the full message
    print(file=file)
    print(top_boarder, file=file)
    print('#{0}#'.format(pad('', msg_block_width - 4)), file=file)
    for line in lines:
        print(line, file=file)
    print('#{0}#'.format(pad('', msg_block_width - 4)), file=file)
    print(bottom_boarder, file=file)
    print(file=file)
31298
def pre_process_code_block(block):
        
        if 'indent' in block and block['indent']:
            indent = r'^' + block['indent']
            block['content'] = re.sub(indent, '', block['icontent'],
                                      flags=re.MULTILINE)
718940
def header_style(header)
      if header.type != :header
        raise "header_style called with non-header element"
      end
      line = element_line(header)
      if line.start_with?("#")
        if line.strip.end_with?("#")
          :atx_closed
        else
          :atx
        end
      else
        :setext
      end
    end
1221060
def print_a_header(message="-"):
    
    print("-".center(60,'-'))
    print(message.center(60,'-'))
    print("-".center(60,'-'))
    print()
1143813
function(block){
    var escapePrettyMode = this.escapePrettyMode;
    var pp = this.pp;
    var ast = [];
    // Pretty print multi-line text
    if (pp && block.nodes.length > 1 && !escapePrettyMode &&
        block.nodes[0].type === 'Text' && block.nodes[1].type === 'Text' ) {
      push.apply(ast, this.prettyIndent(1, true));
    }
    for (var i = 0; i < block.nodes.length; ++i) {
      // Pretty print text
      if (pp && i > 0 && !escapePrettyMode &&
          block.nodes[i].type === 'Text' && block.nodes[i-1].type === 'Text' &&
          /\n$/.test(block.nodes[i - 1].val)) {
        push.apply(ast,this.prettyIndent(1, false));
      }
      push.apply(ast, this.visit(block.nodes[i], block));
    }
    return ast;
  }
58933
def print_header_content(nlh):
    
    answer = 'type={0} length={1} flags=<{2}> sequence-nr={3} pid={4}'.format(
        nl_nlmsgtype2str(nlh.nlmsg_type, bytearray(), 32).decode('ascii'),
        nlh.nlmsg_len,
        nl_nlmsg_flags2str(nlh.nlmsg_flags, bytearray(), 128).decode('ascii'),
        nlh.nlmsg_seq,
        nlh.nlmsg_pid,
    )
    return answer
1365575
private void printWrapped(int nextLineTabStop, String text) {
        StringBuilder sb = new StringBuilder(text.length());
        renderWrappedTextBlock(sb, nextLineTabStop, text);
        console.writeLine(sb.toString());
    }
748143
def header(msg, *args, **kwargs):
    ''''''
    msg = ' '.join((yellow(HEADER), white(msg), yellow(HEADER)))
    echo(msg, *args, **kwargs)
605828
public void setHeaderMargin(int l, int t, int r, int b) {
        mHeader.setMargin(l, t, r, b);
    }
100507
def highlight_block(self, text):
        """"""
        text = to_text_string(text)
        if text.startswith(("c", "C")):
            self.setFormat(0, len(text), self.formats["comment"])
            self.highlight_spaces(text)
        else:
            FortranSH.highlight_block(self, text)
            self.setFormat(0, 5, self.formats["comment"])
            self.setFormat(73, max([73, len(text)]),
                           self.formats["comment"])
1259769
def header(args):
    
    from jcvi.formats.base import DictFile

    p = OptionParser(header.__doc__)
    p.add_option("--prefix", default="",
                 help="Prepend text to line number [default: %default]")
    p.add_option("--ids", help="Write ids to file [default: %default]")
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    mstmap, conversion_table = args
    data = MSTMap(mstmap)
    hd = data.header
    conversion = DictFile(conversion_table)
    newhd = [opts.prefix + conversion.get(x, x) for x in hd]

    print("\t".join(hd))
    print("--->")
    print("\t".join(newhd))

    ids = opts.ids
    if ids:
        fw = open(ids, "w")
        print("\n".join(newhd), file=fw)
        fw.close()
61540
function renderHeader(statuses) {
  var txt = '';

  // Build Header
  for (var k in statuses) {
    var status = statuses[k];

    // Create header
    var col = centerText(k, width);

    // Set header status color
    if (status === false) {
      col = chalk.dim(col);
    } else {
      col = chalk.white(col);
    }

    txt += col;
  }

  return txt;
}
22580
function printLevelHeader(levelNumber) {
  printRow(chalk.gray.dim(` level ${levelNumber} `), {
    position: 'middle',
    padding: chalk.gray.dim('~'),
  });
}
705304
public void printHead(final Writer writer) throws IOException {
        final String eol = "\r\n";
        int pos = 0;
        try {
            for (final String line : this.head()) {
                if (pos == 0 && !RsPrint.FIRST.matcher(line).matches()) {
                    throw new IllegalArgumentException(
                        String.format(
                            // @checkstyle LineLength (1 line)
                            "first line of HTTP response \"%s\" doesn't match \"%s\" regular expression, but it should, according to RFC 7230",
                            line, RsPrint.FIRST
                        )
                    );
                }
                if (pos > 0 && !RsPrint.OTHERS.matcher(line).matches()) {
                    throw new IllegalArgumentException(
                        String.format(
                            // @checkstyle LineLength (1 line)
                            "header line #%d of HTTP response \"%s\" doesn't match \"%s\" regular expression, but it should, according to RFC 7230",
                            pos + 1, line, RsPrint.OTHERS
                        )
                    );
                }
                writer.append(line);
                writer.append(eol);
                ++pos;
            }
            writer.append(eol);
        } finally {
            writer.flush();
        }
    }