rdfa 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ +++ 0.0.1 2007-05-24
2
+
3
+ + 1 major enhancement:
4
+ + Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,41 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/rdfa.rb
6
+ lib/rdfa/version.rb
7
+ lib/rdfa/base.rb
8
+ lib/rdfa/classes.rb
9
+ lib/rdfa/properties.rb
10
+ lib/rdfa/partials.rb
11
+ scripts/txt2html
12
+ setup.rb
13
+ test/test_helper.rb
14
+ test/test_rdfa.rb
15
+ bin/rdfa-typo
16
+ rdfa-typo/CONTRIBUTORS
17
+ rdfa-typo/about.markdown
18
+ rdfa-typo/images
19
+ rdfa-typo/images/background.gif
20
+ rdfa-typo/images/gravatar.gif
21
+ rdfa-typo/images/header_shadow.gif
22
+ rdfa-typo/images/rdfa.png
23
+ rdfa-typo/images/spinner.gif
24
+ rdfa-typo/layouts
25
+ rdfa-typo/layouts/default.rhtml
26
+ rdfa-typo/preview.png
27
+ rdfa-typo/stylesheets
28
+ rdfa-typo/stylesheets/application.css
29
+ rdfa-typo/stylesheets/content.css
30
+ rdfa-typo/stylesheets/layout.css
31
+ rdfa-typo/views
32
+ rdfa-typo/views/articles
33
+ rdfa-typo/views/articles/_article.rhtml
34
+ rdfa-typo/views/articles/_comment.rhtml
35
+ rdfa-typo/views/articles/_comment_form.rhtml
36
+ rdfa-typo/views/articles/_comment_list.rhtml
37
+ rdfa-typo/views/articles/_search.rhtml
38
+ rdfa-typo/views/articles/_trackback.rhtml
39
+ rdfa-typo/views/articles/comment_preview.rhtml
40
+ rdfa-typo/views/articles/index.rhtml
41
+ rdfa-typo/views/articles/read.rhtml
data/README.txt ADDED
@@ -0,0 +1,3 @@
1
+ README for rdfa
2
+ ===============
3
+
data/Rakefile ADDED
@@ -0,0 +1,93 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/contrib/rubyforgepublisher'
9
+ require 'fileutils'
10
+ require 'hoe'
11
+ include FileUtils
12
+ require File.join(File.dirname(__FILE__), 'lib', 'rdfa', 'version')
13
+
14
+ AUTHOR = 'Cédric Mesnage' # can also be an array of Authors
15
+ EMAIL = "cedric.mesnage@gmail.com"
16
+ DESCRIPTION = "description of gem"
17
+ GEM_NAME = 'rdfa' # what ppl will type to install your gem
18
+ RUBYFORGE_PROJECT = 'rdfa' # The unix name for your project
19
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
21
+
22
+ NAME = "rdfa"
23
+ REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
+ VERS = Rdfa::VERSION::STRING + (REV ? ".#{REV}" : "")
25
+ CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
26
+ RDOC_OPTS = ['--quiet', '--title', 'rdfa documentation',
27
+ "--opname", "index.html",
28
+ "--line-numbers",
29
+ "--main", "README",
30
+ "--inline-source"]
31
+
32
+ class Hoe
33
+ def extra_deps
34
+ @extra_deps.reject { |x| Array(x).first == 'hoe' }
35
+ end
36
+ end
37
+
38
+ # Generate all the Rake tasks
39
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
40
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
41
+ p.author = AUTHOR
42
+ p.description = DESCRIPTION
43
+ p.email = EMAIL
44
+ p.summary = DESCRIPTION
45
+ p.url = HOMEPATH
46
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
47
+ p.test_globs = ["test/**/test_*.rb"]
48
+ p.clean_globs = CLEAN #An array of file patterns to delete on clean.
49
+
50
+ # == Optional
51
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
52
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
53
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
54
+ end
55
+
56
+
57
+ desc 'Generate website files'
58
+ task :website_generate do
59
+ Dir['website/**/*.txt'].each do |txt|
60
+ sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
61
+ end
62
+ end
63
+
64
+ desc 'Upload website files to rubyforge'
65
+ task :website_upload do
66
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
67
+ host = "#{config["username"]}@rubyforge.org"
68
+ remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
69
+ # remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
70
+ local_dir = 'website'
71
+ sh %{rsync -av #{local_dir}/ #{host}:#{remote_dir}}
72
+ end
73
+
74
+ desc 'Generate and upload website files'
75
+ task :website => [:website_generate, :website_upload]
76
+
77
+ desc 'Release the website and new gem version'
78
+ task :deploy => [:check_version, :website, :release]
79
+
80
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
81
+ task :local_deploy => [:website_generate, :install_gem]
82
+
83
+ task :check_version do
84
+ unless ENV['VERSION']
85
+ puts 'Must pass a VERSION=x.y.z release version'
86
+ exit
87
+ end
88
+ unless ENV['VERSION'] == VERS
89
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
90
+ exit
91
+ end
92
+ end
93
+
data/bin/rdfa-typo ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ current = Dir.pwd
6
+ Dir.chdir(File.dirname(__FILE__))
7
+ Dir.chdir('../')
8
+ Dir.chdir('rdfa-typo')
9
+ rdfatypo = Dir.pwd
10
+
11
+ cp_r rdfatypo, current
12
+
13
+ puts 'Now go to your admin section of your typo installation'
14
+ puts 'and activate the rdfa-typo theme.'
data/lib/rdfa/base.rb ADDED
@@ -0,0 +1,26 @@
1
+ def rdfa_class klass, subject, &block
2
+ rdfa_write_block :span, {:class => klass, :about => subject}, &block if block_given?
3
+ end
4
+
5
+ def rdfa_triple predicate, object, subject=nil, &block
6
+ if block_given?
7
+ rdfa_write_block :span, {:rel => predicate, :content => object, :about => subject}, &block
8
+ else
9
+ rdfa_write :span, object, {:rel => predicate, :about => subject}
10
+ end
11
+ end
12
+
13
+ def rdfa_write_block tag, rdfa_options = {} , &block
14
+ content = capture(&block)
15
+ concat(rdfa_base_final(tag, content, rdfa_options), block.binding)
16
+ end
17
+
18
+ def rdfa_write tag, body, rdfa_options = {}
19
+ content_tag(tag, body, options = rdfa_options)
20
+ end
21
+
22
+
23
+ # rdfa header
24
+ def rdfa_html
25
+ tag(:html, options = $rdfa_namespaces,true)
26
+ end
@@ -0,0 +1,21 @@
1
+ def rdfa_resource resource_url=nil, &block
2
+ rdfa_class "rdfs:Resource", resource_url, &block
3
+ end
4
+
5
+ def rdfa_post post_url=nil, &block
6
+ rdfa_class "sioc:Post", post_url, &block
7
+ end
8
+
9
+ def rdfa_tag tag_url=nil, &block
10
+ rdfa_class("st:tag", tag_url, &block)
11
+ end
12
+
13
+ #def rdfa_link_to_tag_event term, tag_space, creator, resource, date, rdfa_options = {}
14
+ # rdfa_link_to [
15
+ # (rdfa_span term, {:rel => "st:label"}),
16
+ # (rdfa_span "", {:rel => "st:creator", :content => creator}),
17
+ # (rdfa_span "", {:rel => "st:resource", :content => resource}),
18
+ # (rdfa_span "", {:rel => "st:date", :content => date})
19
+ # ], tag_space, (rdfa_options.merge :class => 'st:tag')
20
+ #end
21
+
@@ -0,0 +1,9 @@
1
+ def rdfa_link_to_tag term, tag_url, rdfa_options = {}
2
+ render(:inline => %{
3
+ <% rdfa_tag "#{tag_url}" do %>
4
+ <% rdfa_label("#{term}") do %>
5
+ <%= link_to("#{term}", "#{tag_url}") %>
6
+ <%end%>
7
+ <% end %>
8
+ })
9
+ end
@@ -0,0 +1,30 @@
1
+ def rdfa_post_content content, uri=nil, &block
2
+ rdfa_triple "sioc:content", content, uri, &block
3
+ end
4
+
5
+ def rdfa_title title, uri=nil, &block
6
+ rdfa_triple "dc:title", title, uri, &block
7
+ end
8
+
9
+ def rdfa_creator creator, uri=nil, &block
10
+ rdfa_triple "dc:creator", creator, uri, &block
11
+ end
12
+
13
+ def rdfa_label label, uri=nil, &block
14
+ rdfa_triple "rdf:label", label, uri, &block
15
+ end
16
+
17
+ def rdfa_description description, uri=nil, &block
18
+ rdfa_triple "rdf:description", description, uri, &block
19
+ end
20
+
21
+ def rdfa_date date, uri=nil, &block
22
+ rdfa_triple "dc:date", date, uri, &block
23
+ end
24
+
25
+ #def rdfa_link_to_post post_title, post_url, rdfa_options = {}, &block = nil
26
+ # rdfa_link_to (rdfa_title post_title, :about => post_url), post_url, rdfa_options
27
+ #end
28
+ #def rdfa_link_to_creator body, options, rdfa_options = {}, &block = nil
29
+ # rdfa_link_to body, options, (rdfa_options.merge :rel => "dc:creator")
30
+ #end
@@ -0,0 +1,9 @@
1
+ module Rdfa #:nodoc:
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/rdfa.rb ADDED
@@ -0,0 +1,26 @@
1
+ =begin rdoc
2
+ The rdfa library for Ruby On Rails adds a set of helper methods
3
+ to the ApplicationHelper of your rails application providing
4
+ developers with abstractions for the publishing of rdfa data.
5
+
6
+ Here is a simple example of how to use rdfa in your application:
7
+ * require 'rdfa' in your application_helper.rb
8
+ * in your layout replace <html> by <%= rdfa_html %>
9
+
10
+ =end
11
+
12
+ require 'rdfa/base'
13
+ require 'rdfa/classes'
14
+ require 'rdfa/properties'
15
+ require 'rdfa/partials'
16
+
17
+ $rdfa_namespaces = {}
18
+ def register_namespace abrv, namespace
19
+ $rdfa_namespaces = $rdfa_namespaces.merge "xmlns:#{abrv}" => namespace
20
+ end
21
+
22
+ register_namespace :rdfs , 'http://w3c.org/rdfs'
23
+ register_namespace :dc , 'http://purl.org/dc/elements/1.1/'
24
+ register_namespace :foaf , 'http://xmlns.com/foaf/0.1/'
25
+ register_namespace :sioc , 'http://rdfs.org/sioc/ns#'
26
+ register_namespace :st , 'http://rdfs.org/socialtagging/ns#'
@@ -0,0 +1 @@
1
+ Cédric Mesnage <cedric.mesnage@gmail.com>
@@ -0,0 +1,8 @@
1
+ ### RDFaTypo by [cedricmesnage][1]
2
+
3
+ RDFa typo is a theme based on scribbish which produces rdfa metadata for all your blog. This can be used as a basis theme to create new themes embedding rdfa data.
4
+
5
+ It requires the [rdfa on rails][2] library to be installed (sudo gem install rdfa).
6
+
7
+ [1]: http://www.inf.unisi.ch/phd/mesnage/
8
+ [2]: http://rubyforge/rdfa
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,47 @@
1
+ <% require 'rdfa' %>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <%= rdfa_html %>
4
+ <!-- <html xmlns="http://www.w3.org/1999/xhtml"> -->
5
+ <head>
6
+ <title><%=h page_title %></title>
7
+ <%= page_header %>
8
+ <%= stylesheet_link_tag '/stylesheets/theme/application.css', :media => 'all' %>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="container">
13
+ <div id="header">
14
+ <img src="/images/theme/rdfa.png">
15
+ <div>
16
+ <h1><span><%= link_to this_blog.blog_name, this_blog.base_url %></span></h1>
17
+ <h2><%= this_blog.blog_subtitle %></h2>
18
+ </div>
19
+ </div>
20
+
21
+ <div id="page">
22
+ <div id="content">
23
+ <%= @content_for_layout %>
24
+ <%= javascript_tag 'show_dates_as_local_time()' %>
25
+ </div>
26
+
27
+ <div id="sidebar">
28
+ <!-- search -->
29
+ <%= render :partial => 'search' %>
30
+
31
+ <!-- sidebar components -->
32
+ <%= render_sidebars %>
33
+ </div>
34
+ <br style="clear:both;" />
35
+ </div>
36
+
37
+ <div id="footer">
38
+ <hr />
39
+ <p><%= link_to this_blog.blog_name, this_blog.base_url %></p>
40
+ <ul>
41
+ <li>powered by <%= link_to 'typo', 'http://typosphere.org' %> /
42
+ styled with <%= link_to 'RDFaTypo', 'http://rubyforge/projects/rdfa' %></li>
43
+ </ul>
44
+ </div>
45
+ </div>
46
+ </body>
47
+ </html>
Binary file
@@ -0,0 +1,27 @@
1
+ /*--------------------------------------------------------------
2
+ Application.css
3
+ Imports all stylesheets; sets defaults for bare elements
4
+ --------------------------------------------------------------*/
5
+
6
+ @import 'layout.css';
7
+ @import 'content.css';
8
+
9
+ @media print { #sidebar { display:none; }
10
+ #content { float: none; width:90%; }
11
+ #content pre { color: #000; background: #eee; }
12
+ #content form.comments { display:none; } }
13
+
14
+ body {
15
+ background: url(/images/theme/background.gif) repeat-x left top;
16
+ font: normal 12px "lucida grande", verdana, arial, helvetica, sans-serif;
17
+ }
18
+
19
+ input,
20
+ textarea { font: normal 12px "bitstream vera sans", verdana, sans-serif; }
21
+
22
+ abbr { border: none; }
23
+ cite { font-style: normal; }
24
+ a img { border: none; padding: 0; margin: 0; }
25
+
26
+ a:link, a:visited { color: #930; }
27
+ a:hover, a:active { color: #fff; background: #000; }