structured_warnings 0.1.1 → 0.1.2
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/.gitignore +2 -0
- data/History.txt +12 -0
- data/README.rdoc +128 -0
- data/Rakefile +38 -4
- data/lib/structured_warnings.rb +9 -29
- data/lib/structured_warnings/kernel.rb +1 -1
- data/lib/structured_warnings/test.rb +5 -0
- data/lib/structured_warnings/test/assertions.rb +63 -12
- data/lib/structured_warnings/test/warner.rb +12 -3
- data/structured_warnings.gemspec +63 -0
- data/test/{test_structured_warnings.rb → structured_warnings_test.rb} +46 -1
- data/test/test_helper.rb +3 -1
- data/version.yml +4 -0
- metadata +41 -60
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -30
- data/README.txt +0 -19
- data/config/hoe.rb +0 -70
- data/config/requirements.rb +0 -17
- data/lib/structured_warnings/version.rb +0 -9
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/website/index.html +0 -158
- data/website/index.txt +0 -97
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.rhtml +0 -45
- metadata.gz.sig +0 -0
@@ -7,7 +7,7 @@ class Foo
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
class
|
10
|
+
class StructuredWarningsTest < Test::Unit::TestCase
|
11
11
|
def test_warn
|
12
12
|
assert_warn(DeprecatedMethodWarning) do
|
13
13
|
Foo.new.old_method
|
@@ -79,6 +79,51 @@ class TestStructuredWarnings < Test::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
def test_passing_an_additional_message_to_assert_no_warn
|
83
|
+
assert_no_warn(Warning, "with message") do
|
84
|
+
warn Warning, "with another message"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_passing_an_additional_message_to_assert_warn
|
89
|
+
assert_warn(Warning, "with message") do
|
90
|
+
warn Warning, "with message"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_passing_a_warning_instance_to_assert_warn
|
95
|
+
assert_warn(Warning.new("with message")) do
|
96
|
+
warn Warning, "with message"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_passing_a_warning_instance_to_assert_no_warn
|
101
|
+
assert_no_warn(Warning.new("with message")) do
|
102
|
+
warn DeprecationWarning, "with another message"
|
103
|
+
end
|
104
|
+
assert_no_warn(Warning.new) do
|
105
|
+
warn Warning, "with message"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_passing_a_regexp_as_message_to_assert_warn
|
110
|
+
assert_warn(Warning, /message/) do
|
111
|
+
warn DeprecationWarning, "with another message"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_passing_a_regexp_as_message_to_no_assert_warn
|
116
|
+
assert_no_warn(Warning, /message/) do
|
117
|
+
warn DeprecationWarning
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_passing_a_message_only_to_assert_warn
|
122
|
+
assert_warn("I told you so") do
|
123
|
+
warn "I told you so"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
82
127
|
def test_warnings_may_not_be_disabled_twice
|
83
128
|
assert [Warning], Warning.disable
|
84
129
|
assert [Warning], Warning.disable
|
data/test/test_helper.rb
CHANGED
data/version.yml
ADDED
metadata
CHANGED
@@ -1,89 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structured_warnings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregor Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
- |
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDODCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBCMQ0wCwYDVQQDDARydWJ5
|
14
|
-
MR0wGwYKCZImiZPyLGQBGRYNc2NobWlkdHdpc3NlcjESMBAGCgmSJomT8ixkARkW
|
15
|
-
AmRlMB4XDTA3MDkxNjEwMzkyN1oXDTA4MDkxNTEwMzkyN1owQjENMAsGA1UEAwwE
|
16
|
-
cnVieTEdMBsGCgmSJomT8ixkARkWDXNjaG1pZHR3aXNzZXIxEjAQBgoJkiaJk/Is
|
17
|
-
ZAEZFgJkZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOzbl83o33wh
|
18
|
-
veLMQ2JyEstgOulisHRBFpfbF9LbdavuS/EdoOUeEPkziWL/ZI0jvUo0MGmQ/8Of
|
19
|
-
F9DJbvNbhDdg0bK7BMe4R/I3Wpu49mX+7pOsdlC44nzJkVG1DQ67qWp6jx1zvDRc
|
20
|
-
iCoXaQKnROtsx6bCavVvm4P7XLrAQvs7l+1Ke5KLkXRtJ9xJWtAyBLRFoM4e6DeT
|
21
|
-
Py0DsixF9Zb5Nrb7UvK0CN8m6dulsKXNRDVQLHkFa5Zg/BEb0RI93LPmeBt8KGIE
|
22
|
-
eYVjk+6z+py03D18xd9KsUhOB/0lC0a5vWSZIKfZnxf1uYY9TTZVqTGGUMFi1sD4
|
23
|
-
k2TYBqQVsS8CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
24
|
-
BBYEFAeq4388e2PUlF/YeemzaY8neefWMA0GCSqGSIb3DQEBBQUAA4IBAQAArQQo
|
25
|
-
3teQbCcYmZFTrdOzujMca6F4JVzTp+yTnOsp1/5hiBEUMc3GreCVAPh2tU9+IpuB
|
26
|
-
Lif+s5nLfYdI+JrpCHDzm+ecJEJ7u7gxidzUwEBPYpVuU32ALge7fuWWhQfi29JY
|
27
|
-
QwNZgIkGe34z3a2+r2GLBns/GY7t0Lomv6U2SvwLreLc8g7thr2hZfgEJidvcrJR
|
28
|
-
Q6amsFqY06NalH+I175Bp4y9rR7IArgNDS3I5Cly5/heVKK2SRm5Z+IACmKMxIXh
|
29
|
-
hzBK8YDsrjUvPNIJn9yl0LeEsZ5VhupI2OXr6Cqa/tVMJq0oiTsLfel3Tsb9Ph83
|
30
|
-
y3O9DT3o4BiyPe77
|
31
|
-
-----END CERTIFICATE-----
|
10
|
+
cert_chain: []
|
32
11
|
|
33
|
-
date:
|
12
|
+
date: 2009-11-28 00:00:00 +01:00
|
34
13
|
default_executable:
|
35
|
-
dependencies:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jeweler
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.0
|
34
|
+
version:
|
35
|
+
description: This is an implementation of Daniel Berger's proposal of structured warnings for Ruby.
|
36
|
+
email: ruby@schmidtwisser.de
|
40
37
|
executables: []
|
41
38
|
|
42
39
|
extensions: []
|
43
40
|
|
44
41
|
extra_rdoc_files:
|
45
|
-
-
|
46
|
-
- License.txt
|
47
|
-
- Manifest.txt
|
48
|
-
- README.txt
|
49
|
-
- website/index.txt
|
42
|
+
- README.rdoc
|
50
43
|
files:
|
44
|
+
- .gitignore
|
51
45
|
- History.txt
|
52
46
|
- License.txt
|
53
|
-
-
|
54
|
-
- README.txt
|
47
|
+
- README.rdoc
|
55
48
|
- Rakefile
|
56
|
-
- config/hoe.rb
|
57
|
-
- config/requirements.rb
|
58
49
|
- lib/structured_warnings.rb
|
59
50
|
- lib/structured_warnings/dynamic.rb
|
60
51
|
- lib/structured_warnings/kernel.rb
|
61
52
|
- lib/structured_warnings/test.rb
|
62
53
|
- lib/structured_warnings/test/assertions.rb
|
63
54
|
- lib/structured_warnings/test/warner.rb
|
64
|
-
- lib/structured_warnings/version.rb
|
65
55
|
- lib/structured_warnings/warner.rb
|
66
56
|
- lib/structured_warnings/warning.rb
|
67
|
-
-
|
68
|
-
-
|
69
|
-
- script/txt2html
|
70
|
-
- setup.rb
|
71
|
-
- tasks/deployment.rake
|
72
|
-
- tasks/environment.rake
|
73
|
-
- tasks/website.rake
|
57
|
+
- structured_warnings.gemspec
|
58
|
+
- test/structured_warnings_test.rb
|
74
59
|
- test/test_helper.rb
|
75
|
-
-
|
76
|
-
- website/index.html
|
77
|
-
- website/index.txt
|
78
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
79
|
-
- website/stylesheets/screen.css
|
80
|
-
- website/template.rhtml
|
60
|
+
- version.yml
|
81
61
|
has_rdoc: true
|
82
|
-
homepage: http://
|
62
|
+
homepage: http://github.com/schmidt/structured_warnings
|
63
|
+
licenses: []
|
64
|
+
|
83
65
|
post_install_message:
|
84
66
|
rdoc_options:
|
85
|
-
- --
|
86
|
-
- README.txt
|
67
|
+
- --charset=UTF-8
|
87
68
|
require_paths:
|
88
69
|
- lib
|
89
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -100,11 +81,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
81
|
version:
|
101
82
|
requirements: []
|
102
83
|
|
103
|
-
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.3.5
|
105
86
|
signing_key:
|
106
|
-
specification_version:
|
107
|
-
summary: Provides structured warnings
|
87
|
+
specification_version: 3
|
88
|
+
summary: Provides structured warnings for Ruby, using an exception-like interface and hierarchy.
|
108
89
|
test_files:
|
90
|
+
- test/structured_warnings_test.rb
|
109
91
|
- test/test_helper.rb
|
110
|
-
- test/test_structured_warnings.rb
|
data.tar.gz.sig
DELETED
Binary file
|
data/Manifest.txt
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
License.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
config/hoe.rb
|
7
|
-
config/requirements.rb
|
8
|
-
lib/structured_warnings.rb
|
9
|
-
lib/structured_warnings/dynamic.rb
|
10
|
-
lib/structured_warnings/kernel.rb
|
11
|
-
lib/structured_warnings/test.rb
|
12
|
-
lib/structured_warnings/test/assertions.rb
|
13
|
-
lib/structured_warnings/test/warner.rb
|
14
|
-
lib/structured_warnings/version.rb
|
15
|
-
lib/structured_warnings/warner.rb
|
16
|
-
lib/structured_warnings/warning.rb
|
17
|
-
script/destroy
|
18
|
-
script/generate
|
19
|
-
script/txt2html
|
20
|
-
setup.rb
|
21
|
-
tasks/deployment.rake
|
22
|
-
tasks/environment.rake
|
23
|
-
tasks/website.rake
|
24
|
-
test/test_helper.rb
|
25
|
-
test/test_structured_warnings.rb
|
26
|
-
website/index.html
|
27
|
-
website/index.txt
|
28
|
-
website/javascripts/rounded_corners_lite.inc.js
|
29
|
-
website/stylesheets/screen.css
|
30
|
-
website/template.rhtml
|
data/README.txt
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= Structured warnings
|
2
|
-
|
3
|
-
Have closer look at StructuredWarnings::Kernel, Warning and
|
4
|
-
Warning::ClassMethods.
|
5
|
-
|
6
|
-
Part of this library is a set of different warnings:
|
7
|
-
|
8
|
-
* Warning
|
9
|
-
* StandardWarning
|
10
|
-
* DeprecationWarning
|
11
|
-
* DeprecatedMethodWarning
|
12
|
-
* DeprecatedSignatureWarning
|
13
|
-
|
14
|
-
You are encourage to use your own subclasses of Warning to give as much feedback
|
15
|
-
to your users as possible.
|
16
|
-
|
17
|
-
Also see the projects website on http://rug-b.rubyforge.org/structured_warnings
|
18
|
-
and the inspiring article at
|
19
|
-
http://www.oreillynet.com/ruby/blog/2008/02/structured_warnings_now.html.
|
data/config/hoe.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'structured_warnings/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Gregor Schmidt' # can also be an array of Authors
|
4
|
-
EMAIL = "ruby@schmidtwisser.de"
|
5
|
-
DESCRIPTION = "Provides structured warnings"
|
6
|
-
GEM_NAME = 'structured_warnings' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'rug-b' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/#{GEM_NAME}"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
|
11
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
12
|
-
@config = nil
|
13
|
-
RUBYFORGE_USERNAME = "unknown"
|
14
|
-
def rubyforge_username
|
15
|
-
unless @config
|
16
|
-
begin
|
17
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
18
|
-
rescue
|
19
|
-
puts <<-EOS
|
20
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
21
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
22
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
23
|
-
EOS
|
24
|
-
exit
|
25
|
-
end
|
26
|
-
end
|
27
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
REV = nil
|
32
|
-
# UNCOMMENT IF REQUIRED:
|
33
|
-
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
34
|
-
VERS = StructuredWarnings::VERSION::STRING + (REV ? ".#{REV}" : "")
|
35
|
-
RDOC_OPTS = ['--quiet', '--title', 'structured_warnings documentation',
|
36
|
-
"--opname", "index.html",
|
37
|
-
"--line-numbers",
|
38
|
-
"--main", "README",
|
39
|
-
"--inline-source"]
|
40
|
-
|
41
|
-
class Hoe
|
42
|
-
def extra_deps
|
43
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
44
|
-
@extra_deps
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# Generate all the Rake tasks
|
49
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
-
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
|
-
p.developer(AUTHOR, EMAIL)
|
52
|
-
p.description = DESCRIPTION
|
53
|
-
p.summary = DESCRIPTION
|
54
|
-
p.url = HOMEPATH
|
55
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
56
|
-
p.test_globs = ["test/**/test_*.rb"]
|
57
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
-
|
59
|
-
# == Optional
|
60
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
61
|
-
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
62
|
-
|
63
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
68
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
69
|
-
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
70
|
-
hoe.rsync_args = '-av --delete --ignore-errors'
|
data/config/requirements.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
-
|
17
|
-
require 'structured_warnings'
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/script/txt2html
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
begin
|
5
|
-
require 'newgem'
|
6
|
-
rescue LoadError
|
7
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
8
|
-
puts "Install: gem install newgem\n\n"
|
9
|
-
exit(1)
|
10
|
-
end
|
11
|
-
require 'redcloth'
|
12
|
-
require 'syntax/convertors/html'
|
13
|
-
require 'erb'
|
14
|
-
require File.dirname(__FILE__) + '/../lib/structured_warnings/version.rb'
|
15
|
-
|
16
|
-
version = StructuredWarnings::VERSION::STRING
|
17
|
-
download = 'http://rubyforge.org/projects/rug-b'
|
18
|
-
|
19
|
-
class Fixnum
|
20
|
-
def ordinal
|
21
|
-
# teens
|
22
|
-
return 'th' if (10..19).include?(self % 100)
|
23
|
-
# others
|
24
|
-
case self % 10
|
25
|
-
when 1: return 'st'
|
26
|
-
when 2: return 'nd'
|
27
|
-
when 3: return 'rd'
|
28
|
-
else return 'th'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class Time
|
34
|
-
def pretty
|
35
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def convert_syntax(syntax, source)
|
40
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
41
|
-
end
|
42
|
-
|
43
|
-
if ARGV.length >= 1
|
44
|
-
src, template = ARGV
|
45
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.rhtml')
|
46
|
-
|
47
|
-
else
|
48
|
-
puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
|
49
|
-
exit!
|
50
|
-
end
|
51
|
-
|
52
|
-
template = ERB.new(File.open(template).read)
|
53
|
-
|
54
|
-
title = nil
|
55
|
-
body = nil
|
56
|
-
File.open(src) do |fsrc|
|
57
|
-
title_text = fsrc.readline
|
58
|
-
body_text = fsrc.read
|
59
|
-
syntax_items = []
|
60
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
61
|
-
ident = syntax_items.length
|
62
|
-
element, syntax, source = $1, $2, $3
|
63
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
64
|
-
"syntax-temp-#{ident}"
|
65
|
-
}
|
66
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
67
|
-
body = RedCloth.new(body_text).to_html
|
68
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
69
|
-
end
|
70
|
-
stat = File.stat(src)
|
71
|
-
created = stat.ctime
|
72
|
-
modified = stat.mtime
|
73
|
-
|
74
|
-
$stdout << template.result(binding)
|