rbml 0.0.5.9.4.1 → 0.0.5.9.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -0
- data/languages/doc/rss.rb +34 -0
- data/languages/doc/xhtml.rb +1 -1
- data/languages/doc/xml.rb +9 -0
- data/lib/doc.rb +6 -1
- data/lib/extensions/primitives.rb +4 -0
- data/lib/processor.rb +2 -1
- data/lib/rbml.rb +1 -1
- metadata +3 -2
data/Manifest.txt
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'redcloth'
|
3
|
+
require 'doc/xml'
|
4
|
+
require 'rexml/document'
|
5
|
+
|
6
|
+
|
7
|
+
module Rbml
|
8
|
+
module Language
|
9
|
+
module Doc
|
10
|
+
module Rss
|
11
|
+
include Xml
|
12
|
+
::FileUtils.send(:undef_method, :link)
|
13
|
+
|
14
|
+
def tags; %w(title link description language pubDate lastBuildDate docs generator managingEditor webMaster item guid) end
|
15
|
+
def start_tag(*options)
|
16
|
+
'<?xml version="1.0"?><rss version="2.0"><channel>'
|
17
|
+
end
|
18
|
+
def end_tag
|
19
|
+
"</channel></rss>"
|
20
|
+
end
|
21
|
+
def format(doc)
|
22
|
+
fdoc = REXML::Document.new doc.assemble_doc rescue puts doc.assemble_doc
|
23
|
+
fdoc.write doc.formatted_doc, 1
|
24
|
+
doc.formatted_doc.strip
|
25
|
+
end
|
26
|
+
def method_missing(method, *args, &blk)
|
27
|
+
if tags.include? method.to_s
|
28
|
+
print_tag(method.to_s, args, &blk)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/languages/doc/xhtml.rb
CHANGED
@@ -17,7 +17,7 @@ module Rbml
|
|
17
17
|
include Xml
|
18
18
|
::Kernel.send(:undef_method, :p)
|
19
19
|
|
20
|
-
def tags; %w(body title head p div ul li html a br span h1 h2 h3 h4 h5 h6 strong img i u b pre kbd code cite strong em ins sup sub del table tr td th ol blockquote)end
|
20
|
+
def tags; %w(body title head p hr script div ul li html a br span h1 h2 h3 h4 h5 h6 strong img i u b pre kbd code cite strong em ins sup sub del table tr td th ol blockquote)end
|
21
21
|
|
22
22
|
def stylesheets dir, *sheets
|
23
23
|
all_sheets = ''
|
data/languages/doc/xml.rb
CHANGED
@@ -33,6 +33,15 @@ module Rbml
|
|
33
33
|
"<#{tag}#{attributes unless attributes.blank?} />"
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def cdata string=nil, &blk
|
38
|
+
string||=''
|
39
|
+
if block_given?
|
40
|
+
["<![CDATA[#{string}", blk, "]]>"]
|
41
|
+
else
|
42
|
+
"<![CDATA[#{string}]]>"
|
43
|
+
end
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
data/lib/doc.rb
CHANGED
@@ -6,6 +6,7 @@ module Rbml
|
|
6
6
|
attr_accessor :formatted_doc
|
7
7
|
|
8
8
|
def self.render(language, options, &block)
|
9
|
+
options[:format] = true if options[:format].nil?
|
9
10
|
d = Doc.new(language)
|
10
11
|
d.assemble_doc = ""
|
11
12
|
display = lambda do |result|
|
@@ -20,7 +21,11 @@ module Rbml
|
|
20
21
|
d.assemble_doc << d.dsl.end_tag unless options[:partial]
|
21
22
|
d.formatted_doc = ''
|
22
23
|
begin
|
23
|
-
|
24
|
+
if options[:format]
|
25
|
+
d.format
|
26
|
+
else
|
27
|
+
d.formatted_doc = d.assemble_doc
|
28
|
+
end
|
24
29
|
ensure
|
25
30
|
d.print
|
26
31
|
end
|
data/lib/processor.rb
CHANGED
@@ -2,6 +2,7 @@ module Rbml
|
|
2
2
|
class Processor
|
3
3
|
|
4
4
|
ROUTES = {:xhtml => "Doc",
|
5
|
+
:rss => "Doc",
|
5
6
|
:cli => "Cli",
|
6
7
|
:shell => "Shell"}
|
7
8
|
|
@@ -11,7 +12,7 @@ module Rbml
|
|
11
12
|
|
12
13
|
def method_name; caller[0][/`([^']*)'/, 1]; end
|
13
14
|
|
14
|
-
def spawn(options, *args, &block)
|
15
|
+
def spawn(options={}, *args, &block)
|
15
16
|
language = if args.first.kind_of?(Hash) and args.first[:as_language]
|
16
17
|
args[:as_language]
|
17
18
|
else
|
data/lib/rbml.rb
CHANGED
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)) + "/../languages")
|
|
2
2
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module Rbml
|
5
|
-
VERSION = '0.0.5.9.4.
|
5
|
+
VERSION = '0.0.5.9.4.2'
|
6
6
|
end
|
7
7
|
require 'extensions/kernel'
|
8
8
|
require 'extensions/primitives'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rbml
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.5.9.4.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.5.9.4.2
|
7
|
+
date: 2007-07-20 00:00:00 -04:00
|
8
8
|
summary: Rbml is a dsl framework for writing other languages in ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- languages/cli/cli.rb
|
44
44
|
- languages/doc/base.rb
|
45
45
|
- languages/doc/xhtml.rb
|
46
|
+
- languages/doc/rss.rb
|
46
47
|
- languages/doc/xml.rb
|
47
48
|
- languages/shell/shell.rb
|
48
49
|
- lib/base.rb
|