Class: RDocF95::RI::OverstrikeFormatter

Inherits:
AttributeFormatter show all
Defined in:
lib/rdoc-f95/ri/formatter.rb

Overview

This formatter generates overstrike-style formatting, which works with pagers such as man and less.

Constant Summary collapse

BS =
"\C-h"

Constants inherited from AttributeFormatter

AttributeFormatter::ATTR_MAP, AttributeFormatter::BOLD, AttributeFormatter::CODE, AttributeFormatter::ITALIC

Constants inherited from Formatter

Formatter::FORMATTERS

Instance Attribute Summary

Attributes inherited from Formatter

#indent, #output

Instance Method Summary collapse

Methods inherited from AttributeFormatter

#wrap

Methods inherited from Formatter

#blankline, #break_to_newline, #conv_html, #conv_markup, #display_flow, #display_flow_item, #display_heading, #display_list, #display_verbatim_flow_item, #draw_line, for, #initialize, list, #raw_print_line, #strip_attributes, #wrap

Constructor Details

This class inherits a constructor from RDocF95::RI::Formatter

Instance Method Details

#bold_print(text) ⇒ Object

Draw a string in bold


355
356
357
358
359
# File 'lib/rdoc-f95/ri/formatter.rb', line 355

def bold_print(text)
  text.split(//).each do |ch|
    @output.print ch, BS, ch
  end
end

#write_attribute_text(prefix, line) ⇒ Object


339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/rdoc-f95/ri/formatter.rb', line 339

def write_attribute_text(prefix, line)
  @output.print prefix

  line.each do |achar|
    attr = achar.attr
    @output.print "_", BS if (attr & (ITALIC + CODE)) != 0
    @output.print achar.char, BS if (attr & BOLD) != 0
    @output.print achar.char
  end

  @output.puts
end