Module: HybookHelper

Included in:
Bookfile::PageCtx
Defined in:
lib/bookfile/helpers/misc.rb,
lib/bookfile/helpers/markdown.rb

Instance Method Summary collapse

Instance Method Details

#columns_begin(opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/bookfile/helpers/markdown.rb', line 19

def columns_begin( opts={} )
  # note: will add  columns2 or columns3 etc. depending on columns option passed in


  ## note: default was 2 (columns) for world.db, 300 (px) for beer.db

  columns = opts[:columns] || 300

  "\n<div class='columns#{columns}' markdown='1'>\n\n"
end

#columns_endObject



28
29
30
# File 'lib/bookfile/helpers/markdown.rb', line 28

def columns_end
  "\n</div>\n\n"
end


14
15
16
# File 'lib/bookfile/helpers/markdown.rb', line 14

def link_to( title, link )
  "[#{title}](#{link})"
end

#number_with_delimiter(num) ⇒ Object

todo:

add to textutils ?? why? why not??


7
8
9
10
# File 'lib/bookfile/helpers/misc.rb', line 7

def number_with_delimiter( num )
  delimiter = '.'
  num.to_s.reverse.gsub( /(\d{3})(?=\d)/, "\\1#{delimiter}").reverse
end