Top Level Namespace

Defined Under Namespace

Modules: PryDocNotebook

Instance Method Summary collapse

Instance Method Details

#code_add_border(html) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/templates/default/docstring/html/setup.rb', line 5

def code_add_border(html)
  doc = Nokogiri::HTML::DocumentFragment.parse(html)
  doc.search('pre.code').each do |pre|
    pre['style'] = 'border: 1px solid #cfcfcf;'\
                   'border-radius: 2px;'\
                   'margin: 0.5em;'\
                   'padding: 0.3em;'
  end
  doc.to_html
end

#detect_language(filename) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/templates/default/method_details/html/setup.rb', line 3

def detect_language(filename)
  case File.extname(filename).downcase
  when '.c' then 'C'
  when '.py' then 'Python'
  when '.rb' then 'Ruby'
  when '.c++', '.cpp', '.cxx' then 'Cpp'
  end
end