1
0
Fork 0
mirror of https://github.com/fmap/muflax65ngodyewp.onion synced 2024-07-03 11:00:42 +02:00
muflax65ngodyewp.onion/lib/default.rb

63 lines
1.2 KiB
Ruby
Raw Normal View History

# Helper functions for site-building.
2011-07-31 22:51:41 +02:00
2012-02-16 23:17:17 +01:00
include Nanoc::Helpers::Rendering
2011-07-31 22:51:41 +02:00
2012-02-16 23:17:17 +01:00
class Nanoc::Item
def add_content content
@raw_content += "\n\n#{content}"
end
2011-07-31 22:51:41 +02:00
def add_references refs
add_content refs
2011-07-31 22:51:41 +02:00
end
def name
identifier.split("/").last
end
2012-02-04 21:18:01 +01:00
def draft?
self[:techne] == :wip
end
2012-02-05 05:40:57 +01:00
def cognitive?
!self[:non_cognitive]
end
def article?
not self[:is_category] and not draft? and cognitive?
end
2012-02-06 06:10:28 +01:00
def is_category? category
!!path.match(%r{^/#{category}/})
end
2011-07-31 22:51:41 +02:00
end
2012-02-16 23:17:17 +01:00
class Nanoc::Site
2012-02-06 05:58:19 +01:00
# only articles that actually get printed
attr_reader :printed_items
def find_printed_items
@printed_items = @items.select { |i| not i[:is_hidden] and not i.binary? }
end
end
def category name
render "category", :category => name
end
def route_unchanged
item.identifier.chop + '.' + item[:extension]
end
2012-02-06 05:58:19 +01:00
def google_search
<<EOF
<div align="center"><form method="get" action="http://www.google.com/search">
<input type="text" name="q" maxlength="255" />
<input type="submit" value="Google Search" />
<input type="hidden" name="domains" value="muflax.com" />
<input style="visibility:hidden" type="radio" name="sitesearch" value="muflax.com" checked="checked" />
</form></div>
EOF
end