bluecloth 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +11 -0
- data/ext/Csio.c +61 -0
- data/ext/css.c +76 -0
- data/ext/xml.c +82 -0
- data/ext/xmlpage.c +48 -0
- data/lib/bluecloth.rb +1 -1
- data/rake/packaging.rb +19 -1
- data/rake/publishing.rb +19 -19
- data/rake/win32.rb +2 -2
- data/spec/markdowntest_spec.rb +3 -0
- metadata +12 -4
data/ChangeLog
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
-- Tue, 26 May 2009 05:08:15 -0000 by deveiant (r121) -----
|
2
|
+
Added: ext/Csio.c (new)
|
3
|
+
ext/xmlpage.c (new)
|
4
|
+
ext/xml.c (new)
|
5
|
+
ext/css.c (new)
|
6
|
+
Changed: spec/markdowntest_spec.rb
|
7
|
+
|
8
|
+
* Fixing tests under Ruby 1.9.1. Thanks to Diego Elio Pettenò for the fix.
|
9
|
+
* Adding Discount files for missing symbols on some platforms.
|
10
|
+
|
11
|
+
|
1
12
|
-- Thu, 14 May 2009 15:26:02 -0000 by deveiant (r118) -----
|
2
13
|
Changed: lib/bluecloth.rb
|
3
14
|
|
data/ext/Csio.c
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <string.h>
|
3
|
+
#include <stdarg.h>
|
4
|
+
#include "cstring.h"
|
5
|
+
#include "markdown.h"
|
6
|
+
#include "amalloc.h"
|
7
|
+
|
8
|
+
|
9
|
+
/* putc() into a cstring
|
10
|
+
*/
|
11
|
+
void
|
12
|
+
Csputc(int c, Cstring *iot)
|
13
|
+
{
|
14
|
+
EXPAND(*iot) = c;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
/* printf() into a cstring
|
19
|
+
*/
|
20
|
+
int
|
21
|
+
Csprintf(Cstring *iot, char *fmt, ...)
|
22
|
+
{
|
23
|
+
va_list ptr;
|
24
|
+
int siz=100;
|
25
|
+
|
26
|
+
do {
|
27
|
+
RESERVE(*iot, siz);
|
28
|
+
va_start(ptr, fmt);
|
29
|
+
siz = vsnprintf(T(*iot)+S(*iot), ALL(*iot)-S(*iot), fmt, ptr);
|
30
|
+
va_end(ptr);
|
31
|
+
} while ( siz > (ALL(*iot)-S(*iot)) );
|
32
|
+
|
33
|
+
S(*iot) += siz;
|
34
|
+
return siz;
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
/* write() into a cstring
|
39
|
+
*/
|
40
|
+
int
|
41
|
+
Cswrite(Cstring *iot, char *bfr, int size)
|
42
|
+
{
|
43
|
+
RESERVE(*iot, size);
|
44
|
+
memcpy(T(*iot)+S(*iot), bfr, size);
|
45
|
+
S(*iot) += size;
|
46
|
+
return size;
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
/* reparse() into a cstring
|
51
|
+
*/
|
52
|
+
void
|
53
|
+
Csreparse(Cstring *iot, char *buf, int size, int flags)
|
54
|
+
{
|
55
|
+
MMIOT f;
|
56
|
+
___mkd_initmmiot(&f, 0);
|
57
|
+
___mkd_reparse(buf, size, 0, &f);
|
58
|
+
___mkd_emblock(&f);
|
59
|
+
SUFFIX(*iot, T(f.out), S(f.out));
|
60
|
+
___mkd_freemmiot(&f, 0);
|
61
|
+
}
|
data/ext/css.c
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
/* markdown: a C implementation of John Gruber's Markdown markup language.
|
2
|
+
*
|
3
|
+
* Copyright (C) 2009 David L Parsons.
|
4
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
5
|
+
* be distributed with this source code.
|
6
|
+
*/
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <stdarg.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <ctype.h>
|
13
|
+
|
14
|
+
#include "config.h"
|
15
|
+
|
16
|
+
#include "cstring.h"
|
17
|
+
#include "markdown.h"
|
18
|
+
#include "amalloc.h"
|
19
|
+
|
20
|
+
|
21
|
+
/*
|
22
|
+
* dump out stylesheet sections.
|
23
|
+
*/
|
24
|
+
static void
|
25
|
+
stylesheets(Paragraph *p, Cstring *f)
|
26
|
+
{
|
27
|
+
Line* q;
|
28
|
+
|
29
|
+
for ( ; p ; p = p->next ) {
|
30
|
+
if ( p->typ == STYLE ) {
|
31
|
+
for ( q = p->text; q ; q = q->next )
|
32
|
+
Cswrite(f, T(q->text), S(q->text));
|
33
|
+
Csputc('\n', f);
|
34
|
+
}
|
35
|
+
if ( p->down )
|
36
|
+
stylesheets(p->down, f);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
/* dump any embedded styles to a string
|
42
|
+
*/
|
43
|
+
int
|
44
|
+
mkd_css(Document *d, char **res)
|
45
|
+
{
|
46
|
+
Cstring f;
|
47
|
+
|
48
|
+
if ( res && *res && d && d->compiled ) {
|
49
|
+
CREATE(f);
|
50
|
+
RESERVE(f, 100);
|
51
|
+
stylesheets(d->code, &f);
|
52
|
+
|
53
|
+
/* HACK ALERT! HACK ALERT! HACK ALERT! */
|
54
|
+
*res = T(f); /* we know that a T(Cstring) is a character pointer */
|
55
|
+
/* so we can simply pick it up and carry it away, */
|
56
|
+
return S(f); /* leaving the husk of the Ctring on the stack */
|
57
|
+
/* END HACK ALERT */
|
58
|
+
}
|
59
|
+
return EOF;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
/* dump any embedded styles to a file
|
64
|
+
*/
|
65
|
+
int
|
66
|
+
mkd_generatecss(Document *d, FILE *f)
|
67
|
+
{
|
68
|
+
char *res;
|
69
|
+
int written = EOF, size = mkd_css(d, &res);
|
70
|
+
|
71
|
+
if ( size > 0 )
|
72
|
+
written = fwrite(res, size, 1, f);
|
73
|
+
if ( res )
|
74
|
+
free(res);
|
75
|
+
return (written == size) ? size : EOF;
|
76
|
+
}
|
data/ext/xml.c
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
/* markdown: a C implementation of John Gruber's Markdown markup language.
|
2
|
+
*
|
3
|
+
* Copyright (C) 2007 David L Parsons.
|
4
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
5
|
+
* be distributed with this source code.
|
6
|
+
*/
|
7
|
+
#include <stdio.h>
|
8
|
+
#include <string.h>
|
9
|
+
#include <stdarg.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <ctype.h>
|
13
|
+
|
14
|
+
#include "config.h"
|
15
|
+
|
16
|
+
#include "cstring.h"
|
17
|
+
#include "markdown.h"
|
18
|
+
#include "amalloc.h"
|
19
|
+
|
20
|
+
/* return the xml version of a character
|
21
|
+
*/
|
22
|
+
static char *
|
23
|
+
mkd_xmlchar(unsigned char c)
|
24
|
+
{
|
25
|
+
switch (c) {
|
26
|
+
case '<': return "<";
|
27
|
+
case '>': return ">";
|
28
|
+
case '&': return "&";
|
29
|
+
case '"': return """;
|
30
|
+
case '\'': return "'";
|
31
|
+
default: if ( isascii(c) || (c & 0x80) )
|
32
|
+
return 0;
|
33
|
+
return "";
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
/* write output in XML format
|
39
|
+
*/
|
40
|
+
int
|
41
|
+
mkd_generatexml(char *p, int size, FILE *out)
|
42
|
+
{
|
43
|
+
unsigned char c;
|
44
|
+
char *entity;
|
45
|
+
|
46
|
+
while ( size-- > 0 ) {
|
47
|
+
c = *p++;
|
48
|
+
|
49
|
+
if ( entity = mkd_xmlchar(c) )
|
50
|
+
fputs(entity, out);
|
51
|
+
else
|
52
|
+
fputc(c, out);
|
53
|
+
}
|
54
|
+
return 0;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* build a xml'ed version of a string
|
59
|
+
*/
|
60
|
+
int
|
61
|
+
mkd_xml(char *p, int size, char **res)
|
62
|
+
{
|
63
|
+
unsigned char c;
|
64
|
+
char *entity;
|
65
|
+
Cstring f;
|
66
|
+
|
67
|
+
CREATE(f);
|
68
|
+
RESERVE(f, 100);
|
69
|
+
|
70
|
+
while ( size-- > 0 ) {
|
71
|
+
c = *p++;
|
72
|
+
if ( entity = mkd_xmlchar(c) )
|
73
|
+
Cswrite(&f, entity, strlen(entity));
|
74
|
+
else
|
75
|
+
Csputc(c, &f);
|
76
|
+
}
|
77
|
+
/* HACK ALERT! HACK ALERT! HACK ALERT! */
|
78
|
+
*res = T(f); /* we know that a T(Cstring) is a character pointer */
|
79
|
+
/* so we can simply pick it up and carry it away, */
|
80
|
+
return S(f); /* leaving the husk of the Ctring on the stack */
|
81
|
+
/* END HACK ALERT */
|
82
|
+
}
|
data/ext/xmlpage.c
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* xmlpage -- write a skeletal xhtml page
|
3
|
+
*
|
4
|
+
* Copyright (C) 2007 David L Parsons.
|
5
|
+
* The redistribution terms are provided in the COPYRIGHT file that must
|
6
|
+
* be distributed with this source code.
|
7
|
+
*/
|
8
|
+
#include "config.h"
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <ctype.h>
|
12
|
+
|
13
|
+
#include "cstring.h"
|
14
|
+
#include "markdown.h"
|
15
|
+
#include "amalloc.h"
|
16
|
+
|
17
|
+
|
18
|
+
int
|
19
|
+
mkd_xhtmlpage(Document *p, int flags, FILE *out)
|
20
|
+
{
|
21
|
+
char *title;
|
22
|
+
extern char *mkd_doc_title(Document *);
|
23
|
+
|
24
|
+
if ( mkd_compile(p, flags) ) {
|
25
|
+
fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
26
|
+
fprintf(out, "<!DOCTYPE html "
|
27
|
+
" PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
|
28
|
+
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
|
29
|
+
|
30
|
+
fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
|
31
|
+
|
32
|
+
fprintf(out, "<head>\n");
|
33
|
+
if ( title = mkd_doc_title(p) )
|
34
|
+
fprintf(out, "<title>%s</title>\n", title);
|
35
|
+
mkd_generatecss(p, out);
|
36
|
+
fprintf(out, "</head>\n");
|
37
|
+
|
38
|
+
fprintf(out, "<body>\n");
|
39
|
+
mkd_generatehtml(p, out);
|
40
|
+
fprintf(out, "</body>\n");
|
41
|
+
fprintf(out, "</html>\n");
|
42
|
+
|
43
|
+
mkd_cleanup(p);
|
44
|
+
|
45
|
+
return 0;
|
46
|
+
}
|
47
|
+
return -1;
|
48
|
+
}
|
data/lib/bluecloth.rb
CHANGED
data/rake/packaging.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Packaging Rake Tasks
|
3
|
-
# $Id: packaging.rb
|
3
|
+
# $Id: packaging.rb 102 2009-05-23 21:40:00Z deveiant $
|
4
4
|
#
|
5
5
|
|
6
6
|
require 'rbconfig'
|
@@ -35,6 +35,24 @@ file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
svnrev = get_svn_rev()
|
39
|
+
prerelease_gem_file_name = "#{PKG_FILE_NAME}.#{svnrev}.gem"
|
40
|
+
prerelease_gempath = PKGDIR + prerelease_gem_file_name
|
41
|
+
|
42
|
+
desc "Build a pre-release RubyGem package"
|
43
|
+
task :prerelease_gem => prerelease_gempath.to_s
|
44
|
+
file prerelease_gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
|
45
|
+
when_writing( "Creating prerelease GEM" ) do
|
46
|
+
gemspec = GEMSPEC.clone
|
47
|
+
gemspec.version = Gem::Version.create( "%s.%d" % [GEMSPEC.version, svnrev] )
|
48
|
+
Gem::Builder.new( gemspec ).build
|
49
|
+
verbose( true ) do
|
50
|
+
mv prerelease_gem_file_name, prerelease_gempath
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
38
56
|
### Task: install
|
39
57
|
desc "Install #{PKG_NAME} as a conventional library"
|
40
58
|
task :install => "spec:quiet" do
|
data/rake/publishing.rb
CHANGED
@@ -26,8 +26,8 @@ class Net::SMTP
|
|
26
26
|
return self
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
|
29
|
+
|
30
|
+
|
31
31
|
#######
|
32
32
|
private
|
33
33
|
#######
|
@@ -111,7 +111,7 @@ begin
|
|
111
111
|
$publish_privately = true
|
112
112
|
Rake::Task['release:rerelease'].invoke
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
|
116
116
|
desc "Generate the release notes"
|
117
117
|
task :notes => [RELEASE_NOTES_FILE]
|
@@ -130,12 +130,12 @@ begin
|
|
130
130
|
edit task.name
|
131
131
|
end
|
132
132
|
CLOBBER.include( RELEASE_NOTES_FILE )
|
133
|
-
|
134
|
-
|
133
|
+
|
134
|
+
|
135
135
|
desc "Upload project documentation and packages to #{PROJECT_HOST}"
|
136
136
|
task :upload => [ :upload_docs, :upload_packages ]
|
137
137
|
task :project => :upload # the old name
|
138
|
-
|
138
|
+
|
139
139
|
desc "Publish the project docs to #{PROJECT_HOST}"
|
140
140
|
task :upload_docs => [ :rdoc ] do
|
141
141
|
when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
|
@@ -172,7 +172,7 @@ begin
|
|
172
172
|
== Installation
|
173
173
|
|
174
174
|
Via gems:
|
175
|
-
|
175
|
+
|
176
176
|
$ sudo gem install #{GEMSPEC.name}
|
177
177
|
|
178
178
|
or from source:
|
@@ -185,7 +185,7 @@ begin
|
|
185
185
|
== Changes
|
186
186
|
#{relnotes}
|
187
187
|
}.gsub( /^\t+/, '' )
|
188
|
-
|
188
|
+
|
189
189
|
File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
|
190
190
|
fh.print( announce_body )
|
191
191
|
end
|
@@ -193,8 +193,8 @@ begin
|
|
193
193
|
edit task.name
|
194
194
|
end
|
195
195
|
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
196
|
-
|
197
|
-
|
196
|
+
|
197
|
+
|
198
198
|
desc 'Send out a release announcement'
|
199
199
|
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
200
200
|
email = TMail::Mail.new
|
@@ -217,13 +217,13 @@ begin
|
|
217
217
|
puts '---',
|
218
218
|
email.to_s,
|
219
219
|
'---'
|
220
|
-
|
220
|
+
|
221
221
|
ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
|
222
222
|
pwent = Etc.getpwuid( Process.euid )
|
223
223
|
curuser = pwent ? pwent.name : 'unknown'
|
224
224
|
username = prompt_with_default( "SMTP user", curuser )
|
225
225
|
password = prompt_for_password()
|
226
|
-
|
226
|
+
|
227
227
|
trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
|
228
228
|
smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
|
229
229
|
smtp.set_debug_output( $stdout )
|
@@ -237,8 +237,8 @@ begin
|
|
237
237
|
trace "done."
|
238
238
|
end
|
239
239
|
end
|
240
|
-
|
241
|
-
|
240
|
+
|
241
|
+
|
242
242
|
desc 'Publish the new release to RubyForge'
|
243
243
|
task :publish => [:clean, :package, :notes] do |task|
|
244
244
|
project = GEMSPEC.rubyforge_project
|
@@ -260,9 +260,9 @@ begin
|
|
260
260
|
rf.create_package( group_id, project )
|
261
261
|
end
|
262
262
|
end
|
263
|
-
|
263
|
+
|
264
264
|
package_id = rf.autoconfig['package_ids'][ project ]
|
265
|
-
|
265
|
+
|
266
266
|
# Make sure this release doesn't already exist
|
267
267
|
releases = rf.autoconfig['release_ids']
|
268
268
|
if releases.key?( GEMSPEC.name ) && releases[ GEMSPEC.name ].key?( PKG_VERSION )
|
@@ -297,17 +297,17 @@ begin
|
|
297
297
|
end
|
298
298
|
end
|
299
299
|
end
|
300
|
-
|
300
|
+
|
301
301
|
rescue LoadError => err
|
302
302
|
if !Object.const_defined?( :Gem )
|
303
303
|
require 'rubygems'
|
304
304
|
retry
|
305
305
|
end
|
306
|
-
|
306
|
+
|
307
307
|
task :no_release_tasks do
|
308
308
|
fail "Release tasks not defined: #{err.message}"
|
309
309
|
end
|
310
|
-
|
310
|
+
|
311
311
|
task :release => :no_release_tasks
|
312
312
|
task "release:announce" => :no_release_tasks
|
313
313
|
task "release:publish" => :no_release_tasks
|
data/rake/win32.rb
CHANGED
@@ -56,7 +56,7 @@ CONFIGURE_CMD = %W[
|
|
56
56
|
./configure
|
57
57
|
--host=i386-mingw32
|
58
58
|
--target=i386-mingw32
|
59
|
-
--build=#{
|
59
|
+
--build=#{Config::CONFIG['build']}
|
60
60
|
--prefix=#{XCOMPILER_DIR}
|
61
61
|
]
|
62
62
|
|
@@ -144,7 +144,7 @@ begin
|
|
144
144
|
run *CONFIGURE_CMD
|
145
145
|
run 'make', 'ruby'
|
146
146
|
run 'make', 'rubyw.exe'
|
147
|
-
run 'make', '
|
147
|
+
run 'make', 'install'
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
data/spec/markdowntest_spec.rb
CHANGED
@@ -39,6 +39,9 @@ describe BlueCloth, "-- MarkdownTest 1.0.3: " do
|
|
39
39
|
rescue RuntimeError => err
|
40
40
|
@have_libtidy = false
|
41
41
|
@tidy_error = err.message
|
42
|
+
rescue DL::DLError => err
|
43
|
+
@have_libtidy = false
|
44
|
+
@tidy_error = err.message
|
42
45
|
else
|
43
46
|
@have_libtidy = true
|
44
47
|
@tidy_error = nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluecloth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -132,7 +132,11 @@ dependencies:
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: 0.7.0.0
|
134
134
|
version:
|
135
|
-
description:
|
135
|
+
description: |-
|
136
|
+
BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion
|
137
|
+
tool for web writers. To quote from the project page: Markdown allows you to
|
138
|
+
write using an easy-to-read, easy-to-write plain text format, then convert it to
|
139
|
+
structurally valid XHTML (or HTML).
|
136
140
|
email: ged@FaerieMUD.org
|
137
141
|
executables:
|
138
142
|
- bluecloth
|
@@ -171,12 +175,16 @@ files:
|
|
171
175
|
- bin/bluecloth
|
172
176
|
- lib/bluecloth.rb
|
173
177
|
- ext/bluecloth.c
|
178
|
+
- ext/Csio.c
|
179
|
+
- ext/css.c
|
174
180
|
- ext/docheader.c
|
175
181
|
- ext/generate.c
|
176
182
|
- ext/markdown.c
|
177
183
|
- ext/mkdio.c
|
178
184
|
- ext/resource.c
|
179
185
|
- ext/version.c
|
186
|
+
- ext/xml.c
|
187
|
+
- ext/xmlpage.c
|
180
188
|
- ext/amalloc.h
|
181
189
|
- ext/config.h
|
182
190
|
- ext/cstring.h
|
@@ -280,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
288
|
requirements: []
|
281
289
|
|
282
290
|
rubyforge_project: bluecloth
|
283
|
-
rubygems_version: 1.3.
|
291
|
+
rubygems_version: 1.3.4
|
284
292
|
signing_key:
|
285
293
|
specification_version: 3
|
286
294
|
summary: BlueCloth is a Ruby implementation of Markdown
|