Skip to content

Commit 79cfee2

Browse files
committed
add back in wikicloth support
1 parent d26b9b3 commit 79cfee2

File tree

7 files changed

+105
-3
lines changed

7 files changed

+105
-3
lines changed

Diff for: Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag:
1111
gem "rdoc", "~> 6.7.0"
1212
gem "org-ruby", "= 0.9.12"
1313
gem "creole", "~> 0.5.0"
14+
gem "wikicloth", "0.8.4.6.ga1b6c30"
15+
gem "rexml"
1416
gem "asciidoctor", "~> 2.0.23"
1517
gem "rake"

Diff for: HISTORY.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## 5.0.0 - 2024-06-11
2-
* Drop wikicloth support
32
* Drop support for Ruby versions < 3.1.0
43

54
* Update to Nokogiri ~> 1.16.5

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
2424
* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc -v 3.6.1`
2525
* [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby)
2626
* [.creole](http://wikicreole.org/) -- `gem install creole` (https://github.com/larsch/creole)
27+
* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` (https://github.com/nricciar/wikicloth)
2728
* [.rst](http://docutils.sourceforge.net/rst.html) -- `pip install docutils`
2829
* [.asciidoc, .adoc, .asc](http://asciidoc.org/) -- `gem install asciidoctor` (http://asciidoctor.org)
2930
* [.pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::XHTML`

Diff for: github-markup.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
2020
s.require_paths = %w[lib]
2121

2222
s.add_development_dependency "rake", "~> 12"
23-
s.add_development_dependency "activesupport", "~> 4.0"
24-
s.add_development_dependency "minitest", "~> 5.4", ">= 5.4.3"
23+
s.add_development_dependency "activesupport", "~> 7.1.3.4"
24+
s.add_development_dependency "minitest", "~> 5.23.1"
2525
s.add_development_dependency "html-pipeline", "~> 2.14.3"
2626
s.add_development_dependency "sanitize", "~> 6.1.0"
2727
s.add_development_dependency "nokogiri", "~> 1.16.5"

Diff for: test/markup_test.rb

+6
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def call
5151
markup = readme.split('/').last.gsub(/^README\./, '')
5252

5353
define_method "test_#{markup}" do
54+
skip(
55+
"Skipping MediaWiki test because wikicloth is currently not compatible with JRuby.",
56+
) if markup == "mediawiki" && RUBY_PLATFORM == "java"
57+
5458
source = File.read(readme)
5559
expected_file = "#{readme}.html"
5660
expected = File.read(expected_file).rstrip
@@ -65,6 +69,7 @@ def call
6569
f.close_write
6670
f.read
6771
end
72+
6873
assert_html_equal expected, actual, <<message
6974
#{File.basename expected_file}'s contents are not html equal to output:
7075
#{diff}
@@ -85,6 +90,7 @@ def test_each_render_has_a_name
8590
assert_equal "rdoc", GitHub::Markup.renderer('README.rdoc', '* One').name
8691
assert_equal "org-ruby", GitHub::Markup.renderer('README.org', '* Title').name
8792
assert_equal "creole", GitHub::Markup.renderer('README.creole', '= Title =').name
93+
assert_equal "wikicloth", GitHub::Markup.renderer('README.wiki', '<h1>Title</h1>').name
8894
assert_equal "asciidoctor", GitHub::Markup.renderer('README.adoc', '== Title').name
8995
assert_equal "restructuredtext", GitHub::Markup.renderer('README.rst', 'Title').name
9096
assert_equal "pod", GitHub::Markup.renderer('README.pod', '=head1').name

Diff for: test/markups/README.mediawiki

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[[Home|&raquo; JRuby Project Wiki Home Page]]
2+
<h1>Embedding JRuby</h1>
3+
Using Java from Ruby is JRuby's best-known feature---but you can also go in the other direction, and use Ruby from Java. There are several different ways to do this. You can execute entire Ruby scripts, call individual Ruby methods, or even implement a Java interface in Ruby (thus allowing you to treat Ruby objects like Java ones). We refer to all these techniques generically as "embedding." This section will explain how to embed JRuby in your Java project.
4+
5+
__TOC__
6+
7+
= Red Bridge (JRuby Embed) =
8+
9+
<tt>one-<two</tt>
10+
<pre>a-b</pre>
11+
12+
JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the [[DirectJRubyEmbedding|legacy API]] should still work, but we strongly recommend Red Bridge for all new projects.
13+
14+
== Features of Red Bridge ==
15+
Red Bridge consists of two layers: Embed Core on the bottom, and implementations of [http://www.jcp.org/en/jsr/detail?id=223 JSR223] and [http://jakarta.apache.org/bsf/ BSF] on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
16+
17+
Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:
18+
19+
# With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.
20+
# Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.
21+
22+
For projects requiring multiple scripting languages, JSR223 is a good fit. Though the API is language-independent, JRuby's implementation of it allows you to set some Ruby-specific options. In particular, you can control the threading model of the scripting engine, the lifetime of local variables, compilation mode, and how line numbers are displayed.
23+
24+
The full [http://jruby-embed.kenai.com/docs/ API documentation] has all the gory details. It's worth talking about a couple of the finer points here.
25+
26+
= Previous Embedding JRuby Page=
27+
We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the [[JavaIntegration|legacy embedding]]<ref>This link goes nowhere.</ref> page.
28+
29+
= References =
30+
<references/>

Diff for: test/markups/README.mediawiki.html

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<p><a href="Home">» JRuby Project Wiki Home Page</a>
2+
</p><h1>Embedding JRuby</h1>
3+
Using Java from Ruby is JRuby's best-known feature---but you can also go in the other direction, and use Ruby from Java. There are several different ways to do this. You can execute entire Ruby scripts, call individual Ruby methods, or even implement a Java interface in Ruby (thus allowing you to treat Ruby objects like Java ones). We refer to all these techniques generically as "embedding." This section will explain how to embed JRuby in your Java project.
4+
5+
<p></p><table summary="Contents"><tr><td>
6+
<div><h2>Table of Contents</h2></div>
7+
<ul>
8+
<li>
9+
<a href="#Red_Bridge_JRuby_Embed">Red Bridge (JRuby Embed)</a><ul><li><a href="#Features_of_Red_Bridge">Features of Red Bridge</a></li></ul>
10+
</li>
11+
<li><a href="#Previous_Embedding_JRuby_Page">Previous Embedding JRuby Page</a></li>
12+
<li><a href="#References">References</a></li>
13+
</ul>
14+
</td></tr></table>
15+
16+
17+
<h1>
18+
<a name="Red_Bridge_JRuby_Embed"></a><span>Red Bridge (JRuby Embed)</span>
19+
</h1>
20+
21+
22+
23+
<p><tt>one-&lt;two</tt>
24+
</p><pre>a-b</pre>
25+
26+
<p>JRuby has long had a private embedding API, which was closely tied to the runtime's internals and therefore changed frequently as JRuby evolved. Since version 1.4, however, we have also provided a more stable public API, known as Red Bridge or JRuby Embed. Existing Java programs written to the <a href="DirectJRubyEmbedding">legacy API</a> should still work, but we strongly recommend Red Bridge for all new projects.
27+
</p>
28+
29+
<h2>
30+
<a name="Features_of_Red_Bridge"></a><span>Features of Red Bridge</span>
31+
</h2>
32+
33+
34+
<p>Red Bridge consists of two layers: Embed Core on the bottom, and implementations of <a href="http://www.jcp.org/en/jsr/detail?id=223" target="_blank">JSR223</a> and <a href="http://jakarta.apache.org/bsf/" target="_blank">BSF</a> on top. Embed Core is JRuby-specific, and can take advantage of much of JRuby's power. JSR223 and BSF are more general interfaces that provide a common ground across scripting languages.
35+
</p>
36+
<p>Which API should you use? For projects where Ruby is the only scripting language involved, we recommend Embed Core for the following reasons:
37+
</p>
38+
39+
40+
41+
<p></p><ol>
42+
<li>With Embed Core, you can create several Ruby environments in one JVM, and configure them individually (via <code>org.jruby.RubyInstanceConfig</code>. With the other APIs, configuration options can only be set globally, via the <code>System</code> properties.</li>
43+
<li>Embed Core offers several shortcuts, such as loading scripts from a <code>java.io.InputStream</code>, or returning Java-friendly objects from Ruby code. These allow you to skip a lot of boilerplate.</li>
44+
</ol>
45+
For projects requiring multiple scripting languages, JSR223 is a good fit. Though the API is language-independent, JRuby's implementation of it allows you to set some Ruby-specific options. In particular, you can control the threading model of the scripting engine, the lifetime of local variables, compilation mode, and how line numbers are displayed.
46+
47+
<p>The full <a href="http://jruby-embed.kenai.com/docs/" target="_blank">API documentation</a> has all the gory details. It's worth talking about a couple of the finer points here.
48+
</p>
49+
50+
<h1>
51+
<a name="Previous_Embedding_JRuby_Page"></a><span>Previous Embedding JRuby Page</span>
52+
</h1>
53+
54+
55+
<p>We recommend using Embed Core; however, if you're maintaining code that uses the old API, you can find its documentation on the <a href="JavaIntegration">legacy embedding</a><sup>[<a href="#cite_note-1">1</a>]</sup> page.
56+
</p>
57+
58+
<h1>
59+
<a name="References"></a><span>References</span>
60+
</h1>
61+
62+
63+
<p></p><ol><li>
64+
<b><a href="#cite_ref-1-0">^</a> </b> This link goes nowhere.</li></ol>

0 commit comments

Comments
 (0)