Class: Livetext::Functions

Inherits:
Object
  • Object
show all
Defined in:
lib/liveblog.rb,
lib/exper/fbtw.rb,
lib/liveblog.rb

Overview

experimental…

Instance Method Summary collapse

Instance Method Details

#_var(name) ⇒ Object



717
718
719
# File 'lib/liveblog.rb', line 717

def _var(name)
  ::Livetext::Vars[name] || "[:#{name} is undefined]"
end

#br(n = "1") ⇒ Object



690
691
692
693
694
695
# File 'lib/liveblog.rb', line 690

def br(n="1")
  # Thought: Maybe make a way for functions to "simply" call the
  #   dot command of the same name?? Is this trivial??
  n = n.empty? ? 1 : n.to_i
  "<br>"*n
end

#facebook_initObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/exper/fbtw.rb', line 4

def facebook_init
  fb_appid = _var("facebook.appid")
  <<~HTML
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '#{fb_appid}',
          xfbml      : true,
          version    : 'v2.4'
        });
      };
  HTML
end

#facebook_likesObject

<!– Needed: btw what is ‘content’?

<meta property='fb:admins' content='767352779'/> 
<meta property='og:url' content='http://rubyhacker.com/blog2/#{slug}.html'/>
<meta property='og:type' content='article'/>
<meta property='og:title' content='#{title}'/>
<meta property='og:image' content='http://rubyhacker.com/blog2/blog3b.gif'/>
<meta property='og:description' content='#{teaser}'/>

–>



28
29
30
31
32
33
34
35
36
# File 'lib/exper/fbtw.rb', line 28

def facebook_likes
  <<~HTML
    <div class='fb-like'
         data-share='true'
         data-width='450'
         data-show-faces='true'>
    </div>
  HTML
end

#h1(param) ⇒ Object



697
# File 'lib/liveblog.rb', line 697

def h1(param); "<h1>#{param}</h1>"; end

#h2(param) ⇒ Object



698
# File 'lib/liveblog.rb', line 698

def h2(param); "<h2>#{param}</h2>"; end

#h3(param) ⇒ Object



699
# File 'lib/liveblog.rb', line 699

def h3(param); "<h3>#{param}</h3>"; end

#h4(param) ⇒ Object



700
# File 'lib/liveblog.rb', line 700

def h4(param); "<h4>#{param}</h4>"; end

#h5(param) ⇒ Object



701
# File 'lib/liveblog.rb', line 701

def h5(param); "<h5>#{param}</h5>"; end

#h6(param) ⇒ Object



702
# File 'lib/liveblog.rb', line 702

def h6(param); "<h6>#{param}</h6>"; end

#hr(param = nil) ⇒ Object



704
705
706
# File 'lib/liveblog.rb', line 704

def hr(param=nil)
  $Dot.hr
end

#image(param) ⇒ Object



708
709
710
# File 'lib/liveblog.rb', line 708

def image(param)
  "<img src='#{param}'></img>"
end

#twitter_followObject



50
51
52
53
54
55
# File 'lib/exper/fbtw.rb', line 50

def twitter_follow
  name = "hal_fulton"   # FIXME
  <<~HTML
    <a href='https://twitter.com/#{name}' class='twitter-follow-button' data-show-count='false'>Follow @#{name}</a>
  HTML
end

#twitter_shareObject



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/exper/fbtw.rb', line 38

def twitter_share
  name, title, url = "", "", ""  # FIXME
  <<~HTML
    <a href='https://twitter.com/share' 
       class='twitter-share-button' 
       data-text='#{title}' 
       data-url='#{url}' 
       data-via='#{name}' 
       data-related='#{name}'>Tweet</a>
  HTML
end