Class: Hobix::Out::Quick

Inherits:
BaseOutput show all
Defined in:
lib/hobix/plugin/tags.rb,
lib/hobix/bixwik.rb,
lib/hobix/comments.rb,
lib/hobix/out/quick.rb,
lib/hobix/trackbacks.rb,
lib/hobix/plugin/flickr.rb,
lib/hobix/plugin/calendar.rb,
lib/hobix/plugin/calendar.rb,
lib/hobix/plugin/sections.rb,
lib/hobix/plugin/bloglines.rb,
lib/hobix/plugin/recent_comments.rb

Overview

sections.rb – Hobix section list plugin

Displays a list of all the sections of your blog.

USAGE:

1) In hobix.yaml (e.g. by running ‘hobix edit <blogname>’), simply

add 'hobix/plugin/sections' to the 'required' list, as follows:

required:

- hobix/plugin/sections

 And that's it!

NOTES:

1) If you redefine ‘sidebar_list’ in hobix.yaml, you’ll need to

explicitly add a 'sidebar_section_list' item.

2) The default Hobix CSS doesn’t indent lists, so the hierarchy is

lost upon display. You can add something like this to your CSS file
to fix this:

.sidebarBox ul

margin:7px;
padding:0px;

Direct Known Subclasses

QuickArchive, QuickSummary

Constant Summary collapse

APPEND_TPL_RE =
/^(.+)\s*(<<|>>)$/

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasePlugin

inherited, start

Constructor Details

#initialize(weblog, defaults = {}) ⇒ Quick

Returns a new instance of Quick.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/hobix/out/quick.rb', line 37

def initialize( weblog, defaults = {} )
    @hobix_path = weblog.path
    @path = weblog.skel_path
    defaults.each do |k, v|
        k = k.gsub( /\W/, '_' )
        k.untaint
        v = v.inspect
        v.untaint
        if k =~ APPEND_TPL_RE
            k = $1.strip
            v = if $2 == ">>"
                    "#{ v } + #{ k }_erb_orig"
                else
                    "#{ k }_erb_orig + #{ v }"
                end
            instance_eval %{
                alias #{ k }_erb_orig #{ k }_erb
                def #{ k }_erb
                    #{ v }
                end
            }
        else
            instance_eval %{
                def #{ k }_erb
                    #{ v }
                end
            }
        end
    end
end

Class Method Details

.append_def(method, str) ⇒ Object

Class method for appending to a method template



27
28
29
30
# File 'lib/hobix/out/quick.rb', line 27

def self.append_def( method, str )
    newstr = "#{ self.allocate.method( method ).call }#{ str }"
    define_method( method ) { newstr }
end

.prepend_def(method, str) ⇒ Object

Class method for prepending to a method template



32
33
34
35
# File 'lib/hobix/out/quick.rb', line 32

def self.prepend_def( method, str )
    newstr = "#{ str }#{ self.allocate.method( method ).call }"
    define_method( method ) { newstr }
end

Instance Method Details

#all_comments(weblog, entries) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/hobix/plugin/recent_comments.rb', line 41

def all_comments(weblog, entries)
  entries.map do |ie|
    begin
      comments = weblog.storage.load_attached(ie.id, "comments")
      e = weblog.storage.load_entry ie.id
      comments.each { |c| yield e.link, e.title, c.author, c.created }
    rescue Errno::ENOENT
    end
  end
end


165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/hobix/bixwik.rb', line 165

def banner_erb; %{
  <% page_id = page.id %>
  <% page_id = 'HomePage' if page.id == 'index' %>
  <% page_name = Hobix::BixWik::wiki_word( page_id ) %>
  <div id="banner">
    <% if page_id == "HomePage" %>
      <h1 id="title"><%= weblog.title %></h1>
      <% if weblog.tagline %><div id="tagline"><%= weblog.tagline %></div><% end %>
    <% else %>
      <div id="title"><%= weblog.title %></div>
      <h1 id="pageName"><%= page_name %></h1>
    <% end %>
    <form id="navigationForm" class="navigation" action="<%= weblog.expand_path( 'search' ) %>" action="get" style="font-size: 10px">  
    <% Hobix::BixWik::QUICK_MENU.each do |menu_link, attr| %>
      <% if page_id == menu_link %>
        <%= attr[0] %>
      <% else %>
      <a href="<%= weblog.abs_link( menu_link ) %>" title="<% if attr[1] %>[<%= attr[1] %>] <% end %><%= attr[2] %>" 
           accesskey="<%= attr[1] %>"><%= attr[0] %></a>
      <% end %> |
    <% end %>
    <input type="text" id="searchField" name="query" style="font-size: 10px" value="Search" onClick="this.value == 'Search' ? this.value = '' : true">
    </form>
  </div> }
end

#blog_erbObject



201
202
203
204
205
# File 'lib/hobix/out/quick.rb', line 201

def blog_erb
 %{ <div id="blog">
    <+ entries +>
    </div> }
end

#bloglines_old_sidebar_list_erbObject



53
54
55
# File 'lib/hobix/plugin/bloglines.rb', line 53

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end

#calendar_old_sidebar_list_erbObject



74
75
76
# File 'lib/hobix/plugin/calendar.rb', line 74

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end

#css_erbObject



236
# File 'lib/hobix/out/quick.rb', line 236

def css_erb; %{ @import "<%= weblog.expand_path "site.css" %>"; }; end

#day_header_erbObject



214
215
216
# File 'lib/hobix/out/quick.rb', line 214

def day_header_erb; 
  %{ <h2 class="dayHeader" id="<%= day.strftime( "day%Y%m%d" ) %>"><%= day.strftime( "%A, %B %d, %Y" ) %></h2> }; 
end

#doctype_erbObject



237
238
239
# File 'lib/hobix/out/quick.rb', line 237

def doctype_erb
 %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">}
end

#entries_erbObject



206
207
208
209
210
211
212
213
# File 'lib/hobix/out/quick.rb', line 206

def entries_erb
 %{ <% entries.each_day do |day, day_entries| %>
        <+ day_header +>
        <% day_entries.each do |entry| %>
            <+ entry +>
        <% end %>
    <% end %> }
end

#entry_comment_erbObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/hobix/comments.rb', line 46

def entry_comment_erb; %{
  <% entry_id = entry.id %>
  <div id="comments">
  <% comments = weblog.storage.load_attached( entry_id, "comments" ) rescue [] %>
  <% comments.each do |comment| %>
  <div class="entry">
      <div class="entryAttrib">
          <div class="entryAuthor"><h3><%= comment.author %></h3></div>
          <div class="entryTime">said on <%= comment.created.strftime( "<nobr>%d %b %Y</nobr> at <nobr>%H:%M</nobr>" ) %></div>
      </div>
      <div class="entryContentOuter"><div class="entryContent"><%= comment.content.to_html %></div></div>
  </div>
  <% end %>
} end

#entry_comment_form_erbObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/hobix/comments.rb', line 61

def entry_comment_form_erb; %{
  <div class="entry">
  <form id="userComment" method="post" action="<%= weblog.expand_path( '/control/comment/' + entry_id )%>">
    <div class="entryAttrib">
       <div class="entryAuthor"><input name="<%= Hobix::Facets::Comments.form_field 'author' %>" type="textbox" size="15" maxlength="50" /></div>
       <div id="liveTime" class="entryTime">said on <%= Time.now.strftime( "<nobr>%d %b %Y</nobr> at <nobr>%H:%M</nobr>")%></div>
    </div>
    <div class="entryContentOuter"><div class="entryContent">
       <textarea name="<%= Hobix::Facets::Comments.form_field 'content' %>" rows="6" cols="50"></textarea>
       <p><input type="button" name="pleasePreview" value="preview" 
           onClick="new Ajax.Request( '<%= weblog.expand_path '/control/preview' %>', {parameters: Form.serialize('userComment'), onComplete: function(req) { $('textilePreview').innerHTML = req.responseText }})" />
          <input type="submit" name="<%= Hobix::Facets::Comments.form_field 'submit' %>" value="&gt;&gt;" />
          <small>* do <a href="javascript:quickRedReference();">fancy stuff</a> in your comment.</small>
       </p>
       <div id="textileWrap"><!-- <h4>PREVIEW PANE</h4> -->
       <div id="textilePreview"></div>
       </div>
       </div>
    </div></div>
     
  </form>
  </div>
} end

#entry_content_erbObject



191
192
193
# File 'lib/hobix/bixwik.rb', line 191

def entry_content_erb
    %{ <div class="entryContent"><%= weblog.wiki_page( entry.content.to_html ) %></div> }
end

#entry_erbObject



217
218
219
220
221
222
223
# File 'lib/hobix/out/quick.rb', line 217

def entry_erb
 %{ <div class="entry">
        <+ entry_title +>
        <+ entry_content +>
    </div>
    <div class="entryFooter"><+ entry_footer +></div> }
end

#entry_footer_erbObject



195
196
197
# File 'lib/hobix/bixwik.rb', line 195

def ; %{
  Revision from <%= ( entry.modified || entry.created ).strftime( "%d %B %Y at %H:%M" ) %> by <%= weblog.wiki_link( "authors/" + entry.author ) %> }
end

#entry_title_erbObject



190
# File 'lib/hobix/bixwik.rb', line 190

def entry_title_erb; end

#entry_trackback_erbObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/hobix/trackbacks.rb', line 38

def entry_trackback_erb; %{
  <div id="trackbacks">
  <% entry_id = entry.id %>
  <% trackbacks = weblog.storage.load_attached( entry_id, "trackbacks") rescue [] %>
  <% trackbacks.each do |trackback| %>
  <div class="entry">
      <div class="entryAttrib">
          <div class="entryAuthor"><h3><%= trackback.blog_name %></h3></div>
          <div class="entryTime">tracked back on <%= trackback.created.strftime("<nobr>%d %b %Y</nobr> at <nobr>%H:%M</nobr>" ) %></div>
      </div>
      <div class="entryContentOuter"><div class="entryContent">
          <h3><a href="<%= trackback.url %>"><%= trackback.title %></a></h3>
          <%= trackback.excerpt %>
      </div></div>
  </div>
  <% end %>
  </div>
} end

#entry_trackback_rdf_erbObject



28
29
30
31
32
# File 'lib/hobix/trackbacks.rb', line 28

def entry_trackback_rdf_erb; %{
  <!--
  <%= trackback_rdf_for( weblog, entry ) %>
  -->
} end

#expand(fname) ⇒ Object



127
128
129
130
131
132
133
# File 'lib/hobix/out/quick.rb', line 127

def expand( fname )
    if fname =~ /^\//
        File.join( @path, fname )
    else
        File.join( @relpath, fname )
    end
end

#extensionObject



87
88
89
# File 'lib/hobix/out/quick.rb', line 87

def extension
    "quick"
end

#flickr_old_sidebar_list_erbObject



70
71
72
# File 'lib/hobix/plugin/flickr.rb', line 70

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end


162
# File 'lib/hobix/out/quick.rb', line 162

def footer_erb; end

#head_tags_erbObject



235
# File 'lib/hobix/out/quick.rb', line 235

def head_tags_erb; end

#load(file_name, vars) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/hobix/out/quick.rb', line 90

def load( file_name, vars )
    @bind = binding
    @relpath = File.dirname( file_name )
    vars.each do |k, v|
        k.untaint
        k_inspect = k.inspect.untaint
        eval( "#{ k } = vars[#{ k_inspect }]", @bind )
    end
    quick_file = File.read( file_name )
    quick_data = if quick_file.strip.empty?
                     {}
                 else
                     YAML::load( quick_file )
                 end
    quick_data.each do |k, v|
        if k =~ APPEND_TPL_RE
            k = $1.strip
            quick_data[k] = if $2 == ">>"
                                v + method( "#{ k }_erb" ).call
                            else
                                method( "#{ k }_erb" ).call + v
                            end
        end
    end
    erb_src = make( 'page', quick_data, vars.has_key?( :entries ) )
    erb_src.untaint
    erb = ::ERB.new( erb_src )
    begin
        erb.result( @bind )
    rescue Exception => e
        puts "--- erb source ---"
        puts erb_src
        puts "--- erb source ---"
        puts e.backtrace
        raise QuickError, "Error `#{ e.message }' in erb #{ file_name }."
    end
end

#make(part, quick_data, has_entries = true) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/hobix/out/quick.rb', line 134

def make( part, quick_data, has_entries = true )
    if part == 'entries' and not has_entries
        part = 'entry'
    end
    erb = quick_data[part] || method( "#{ part.gsub( /\W+/, '_' ) }_erb" ).call
    if erb.respond_to? :gsub
        erb.gsub( /<\+\s*(\w+)\s*\+>/ ) do
            make( $1, quick_data, has_entries )
        end.gsub( /<\+\s*([\w\.\/\\\-]+)\s*\+>/ ) do
            File.read( expand( $1 ) )
        end
    elsif erb.respond_to? :collect
        erb.collect do |inc|
            make( inc, quick_data, has_entries )
        end.join "\n"
    end
end

#page_erbObject



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/hobix/out/quick.rb', line 240

def page_erb
 %{<+ doctype +>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><+ title +></title>
<+ head_tags +>
<style type="text/css">
<+ css +>
</style>
</head>
<body>

<div id="page">

<+ banner +>

<div id="content">
<+ sidebar +>

<+ blog +>

</div>

<+ footer +>

</div>

</body>
</html>}
end

#recent_comments(weblog, entries, num) ⇒ Object



52
53
54
55
56
# File 'lib/hobix/plugin/recent_comments.rb', line 52

def recent_comments(weblog, entries, num)
  comments = []
  all_comments(weblog, entries) { |*c| comments.push c }
  comments.map { |x| x }.sort_by { |x| x[3] }.reverse[0 ... num]
end

#recent_comments_old_sidebar_list_erbObject



73
74
75
# File 'lib/hobix/plugin/recent_comments.rb', line 73

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end

#section_list(entries, topname = "top level") ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/hobix/plugin/sections.rb', line 29

def section_list( entries, topname = "top level" )
  counts = {}
  entries.each do |entry|
    path = ( entry.id.split("/")[0 ... -1] || [] ) # nil in ruby 1.8.1 if path is ""
    counts[path] = 1 + ( counts[path] || 0 )
  end

  list = []; seen = {}
  counts[[]] ||= 0 # force the root
  counts.sort.each do |path, count|
    if path == []
      list.push [topname, "", 0, counts[path]]        
    else
      path.inject( "." ) do |s, x|
        prefix = s + "/" + x
        unless seen[prefix]
          length = prefix.count '/'
          list.push [x, prefix, length, ( length == path.length ? count : 0 ) ]
          seen[prefix] = true
        end
        prefix
      end
    end
  end
  list
end

#sections_old_sidebar_list_erbObject



82
83
84
# File 'lib/hobix/plugin/sections.rb', line 82

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end

#setupObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/hobix/out/quick.rb', line 67

def setup
    quick_conf = File.join( @hobix_path, 'hobix.out.quick' )
    unless File.exists? quick_conf
        quicksand = {}
        methods.each do |m|
            if m =~ /^(.+)_erb$/
                key = $1
                qtmpl = method( m ).call
                if qtmpl.respond_to? :strip
                    qtmpl = "\n#{ qtmpl.strip.gsub( /^ {8}/, '' ) }\n"
                    def qtmpl.to_yaml_fold; '|'; end
                end
                quicksand[key] = qtmpl
            end
        end
        File.open( quick_conf, 'w' ) do |f|
            YAML.dump( quicksand, f )
        end
    end
end


171
172
173
174
175
176
177
178
179
180
181
# File 'lib/hobix/out/quick.rb', line 171

def sidebar_archive_erb
 %{ <div class="sidebarBox">
    <h2 class="sidebarTitle">Archive</h2>
    <ul>
    <% months = weblog.storage.get_months( weblog.storage.find ) %>
    <% months.reverse.each do |month_start, month_end, month_id| %>
        <li><a href="<%= weblog.expand_path month_id %>"><%= month_start.strftime( "%B %Y" ) %></a></li>
    <% end %>
    </ul>
    </div> }
end


63
64
65
66
67
68
69
70
# File 'lib/hobix/plugin/bloglines.rb', line 63

def sidebar_bloglines_erb
  (BloglinesPlugin.in_sidebarBox_div? ? %{<div class="sidebarBox">} : "") +
    (BloglinesPlugin.title ? %{<h2 class="sidebarTitle">#{BloglinesPlugin.title}</h2>} : "") +
    %{<script language="javascript" type="text/javascript" src="http://rpc.bloglines.com/blogroll?id=#{BloglinesPlugin.userid}} +
    (BloglinesPlugin.folder ? "&folder=#{BloglinesPlugin.folder}" : "") +
    %{"></script>} +
    (BloglinesPlugin.in_sidebarBox_div? ? "</div>" : "")
end


193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/hobix/plugin/calendar.rb', line 193

def sidebar_calendar_caption_erb
%q{
  <caption class="sidebarCalendarCaption">
  <% if page.prev %>
    <a href="<%= weblog.expand_path page.prev %>">&larr;</a>
  <% else %>
    &larr;
  <% end %>
  &nbsp;<a href="<%= weblog.expand_path month.strftime("/%Y/%m/")%>"><%= month.strftime("%B %Y") %></a>&nbsp;
  <% if page.next %>
    <a href="<%= weblog.expand_path page.next %>">&rarr;</a>
  <% else %>
    &rarr;
  <% end %>
  </caption>
}
end


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/hobix/plugin/calendar.rb', line 142

def sidebar_calendar_contents_erb
%q{
  <tr class="sidebarCalendarContentRow">
  <% offset.times do %>
    <td class="sidebarCalendarFiller"> &nbsp; </td>
  <% end %>
  
  <%
    current = offset
    first = Date.new(month.year, month.mon, 1)
    last = (first >> 1) - 1
  %>

  <% (first .. last).each do |d| %>
    <% if (current % 7) == 0 %>
      </tr><tr class="sidebarCalendarContentRow">
    <% end %>
    <% current += 1 %>

    <% if days.keys.include? d %>
      <% 
        title = d.strftime("%A, %B %e: " + (days[d] == 1 ? "one entry" : "#{days[d]} entries"))
        link = case index
               when :yearly:
                 d.strftime("/%Y/#day%Y%m%d")
               when :monthly:
                 d.strftime("/%Y/%m/#day%Y%m%d")
               else
                 d.strftime("/%Y/%m/%d.html#day%Y%m%d")
               end
      %>
      <td class="sidebarCalendarLinkDay"><a title="<%= title %>" href="<%= weblog.expand_path link %>"><%= d.strftime("%e") %></a></td>
    <% else %>
      <td class="sidebarCalendarEmptyDay"><%= d.strftime("%e") %></td>
    <% end %>
  <% end %>

  </tr>
}
end


123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/hobix/plugin/calendar.rb', line 123

def sidebar_calendar_erb
%{
  <style type="text/css">
  .sidebarCalendar a { text-decoration: none; font-weight: bold; }
  .sidebarCalendarHeader { text-align: center; }
  .sidebarCalendarContentRow { color: #888; text-align: right; }
  </style>

  <div class="sidebarBox">
  <h2 class="sidebarTitle">Calendar</h2>
  <table class="sidebarCalendar">
    <+ sidebar_calendar_caption +>
    <+ sidebar_calendar_header +>
    <+ sidebar_calendar_contents +>
  </table>
  </div>
}
end


183
184
185
186
187
188
189
190
191
# File 'lib/hobix/plugin/calendar.rb', line 183

def sidebar_calendar_header_erb
%{
  <tr class="sidebarCalendarHeaderRow">
  <% day_syms.each do |d| %>
    <th class="sidebarCalendarHeader"><%= d %></th>
  <% end %>
  </tr>
}
end


84
85
86
# File 'lib/hobix/plugin/calendar.rb', line 84

def sidebar_calendar_ssi
  %q{<!--#include virtual="<%= weblog.link.path + SidebarCalendarPlugin.dir_to(page.timestamp || Time.now)%>"-->}
end


194
# File 'lib/hobix/bixwik.rb', line 194

def sidebar_erb; nil; end


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/hobix/plugin/flickr.rb', line 80

def sidebar_flickr_erb
  (FlickrPlugin.in_sidebarBox_div? ? %{<div class="sidebarBox">} : "") +
    (FlickrPlugin.title ? %{<h2 class="sidebarTitle">#{FlickrPlugin.title}</h2>} : "") +
    %{
<!-- Start of Flickr Badge -->
<!-- Start of Flickr Badge -->
<style type="text/css">
#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}
#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}
#flickr_icon_td {padding:0 5px 0 0 !important;}
.flickr_badge_image {text-align:center !important;}
.flickr_badge_image img {border: 1px solid black !important;}
#flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}
#flickr_badge_uber_wrapper a:hover,
#flickr_badge_uber_wrapper a:link,
#flickr_badge_uber_wrapper a:active,
#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;}
#flickr_badge_wrapper {border: solid 1px #000000}
#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;}
</style>
<table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"><tr><td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper">
<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=#{FlickrPlugin.num}&display=latest&size=#{FlickrPlugin.size}&layout=v&source=user&user=#{FlickrPlugin.userid}"></script>
</table>
</td></tr></table>
<!-- End of Flickr Badge -->
  } +
  (FlickrPlugin.in_sidebarBox_div? ? "</div>" : "")
end


196
197
198
199
200
# File 'lib/hobix/out/quick.rb', line 196

def sidebar_hobix_erb
 %{ <div class="sidebarBox">
    <p>Built upon <a href="http://hobix.com">Hobix</a></p>
    </div> }
end


182
183
184
185
186
187
# File 'lib/hobix/out/quick.rb', line 182

def sidebar_links_erb
 %{ <div class="sidebarBox">
    <h2 class="sidebarTitle">Links</h2>
    <%= weblog.linklist.content.to_html %>
    </div> }
end


168
169
170
# File 'lib/hobix/out/quick.rb', line 168

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end


58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/hobix/plugin/recent_comments.rb', line 58

def sidebar_recent_comments_erb
%q{
  <div class="sidebarBox">
  <h2 class="sidebarTitle">Recent Comments</h2>
  <ul>
  <% reccomm = recent_comments( weblog, weblog.storage.find, RecentCommentsPlugin.num ) %>
  <% reccomm.each do |link, title, auth, created| %>
    <li><a href="<%= link %>"><%= title %></a> by <%= auth %> on <nobr><%= created.strftime "%d %b at %H:%M" %></nobr></li>
  <% end %>
  <%= "<li>No comments (yet)!</li>" if reccomm.empty? %>
  </ul>
  </div>
}
end


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/hobix/plugin/sections.rb', line 56

def sidebar_section_list_erb
%q{
  <div class="sidebarBox">
  <h2 class="sidebarTitle">Sections</h2>
  <% curlev = -1 %>
  <% section_list( weblog.storage.find ).each do |name, path, lev, num| %>
    <% if ( lev > curlev ) %>
      <% ( lev - curlev ).times do %> <ul> <% end %>
    <% else # less than or equal %>
      </li>
    <% end %>
    <% if ( curlev > lev ) %>
      <% ( curlev - lev ).times do %> </ul></li> <% end %>
    <% end %>

    <% curlev = lev %>
    <li>
      <a href="<%= weblog.expand_path path %>"><%= name %></a><% if num != 0 then %>: <%= num %> <% end %>
  <% end %>
  <% ( curlev + 1 ).times do %>
    </li></ul>
  <% end %>
  </div>
}
end


188
189
190
191
192
193
194
195
# File 'lib/hobix/out/quick.rb', line 188

def sidebar_syndicate_erb
 %{ <div class="sidebarBox">
    <h2 class="sidebarTitle">Syndicate</h2>
    <ul>
        <li><a href="<%= weblog.link %>/index.atom">Atom 1.0</a></li>
    </ul>
    </div> }
end


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/hobix/plugin/tags.rb', line 34

def sidebar_tag_list_erb
  %q{
      <div class="sidebarBox">
      <h2 class="sidebarTitle">Tags</h2>
      <ul>
      <% tags_list(weblog.storage.find).sort.each do |name, count| %>
        <li>
          <a href="<%= weblog.expand_path "tags/#{ name }/" %>"><%= name
          %></a>:&nbsp;<%=count%>
        </li>
      <% end %>
      </ul>
      </div>
    }
end

#tags_list(entries) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hobix/plugin/tags.rb', line 21

def tags_list(entries)
  tags = { }
  entries.each do |e|
    if e.tags
      e.tags.each do |t|
        tags[t] ||= 0
        tags[t] += 1
      end
    end
  end
  tags
end

#tags_old_sidebar_list_erbObject



50
51
52
# File 'lib/hobix/plugin/tags.rb', line 50

def sidebar_list_erb
    ['sidebar_archive', 'sidebar_links', 'sidebar_syndicate', 'sidebar_hobix']
end

#title_erbObject

Default quick templates



155
# File 'lib/hobix/out/quick.rb', line 155

def title_erb; '<%= weblog.title %>'; end