[DRE-commits] [ruby-org] 158/303: Remove code tags and use pre block with src-:lang class like org exporter
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:49 UTC 2013
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository ruby-org.
commit d05ceca0b6fe7c6dc9cfe1ca114e82738eb246b1
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date: Thu Jul 5 00:22:56 2012 +0900
Remove code tags and use pre block with src-:lang class like org exporter
---
lib/org-ruby/html_output_buffer.rb | 13 ++-----------
spec/html_examples/advanced-code.html | 22 +++++-----------------
spec/html_examples/properties_drawer.html | 16 ++++------------
3 files changed, 11 insertions(+), 40 deletions(-)
diff --git a/lib/org-ruby/html_output_buffer.rb b/lib/org-ruby/html_output_buffer.rb
index c5bc5f7..6630d77 100644
--- a/lib/org-ruby/html_output_buffer.rb
+++ b/lib/org-ruby/html_output_buffer.rb
@@ -52,16 +52,12 @@ module Orgmode
if ModeTag[mode] then
output_indentation
css_class = ""
- css_class = " class=\"src\"" if mode == :src
+ css_class = " class=\"src\"" if mode == :src and @block_lang.empty?
+ css_class = " class=\"src src-#{@block_lang}\"" if mode == :src and not @block_lang.empty?
css_class = " class=\"example\"" if (mode == :example || mode == :inline_example)
css_class = " style=\"text-align: center\"" if mode == :center
@logger.debug "#{mode}: <#{ModeTag[mode]}#{css_class}>\n"
@output << "<#{ModeTag[mode]}#{css_class}>\n" unless mode == :table and skip_tables?
- # Special case to add code tags to src blogs and specify language
- if mode == :src
- @logger.debug "<code class=\"#{@block_lang}\">\n"
- @output << "<code class=\"#{@block_lang}\">\n"
- end
# Entering a new mode obliterates the title decoration
@title_decoration = ""
end
@@ -74,11 +70,6 @@ module Orgmode
m = super(mode)
if ModeTag[m] then
output_indentation
- if mode == :src
- @logger.debug "</code>\n"
- @output << "</code>\n"
- end
-
# Need to close the floating li elements before closing the list
if (m == :unordered_list or
m == :ordered_list or
diff --git a/spec/html_examples/advanced-code.html b/spec/html_examples/advanced-code.html
index d19933c..f52581c 100644
--- a/spec/html_examples/advanced-code.html
+++ b/spec/html_examples/advanced-code.html
@@ -16,8 +16,7 @@
<p>Two ASCII blobs.</p>
<h1><span class="heading-number heading-number-1">2 </span>BEGIN_SRC</h1>
<p>And this:</p>
-<pre class="src">
-<code class="ruby">
+<pre class="src src-ruby">
# Finds all emphasis matches in a string.
# Supply a block that will get the marker and body as parameters.
def match_all(str)
@@ -25,11 +24,9 @@
yield $2, $3
end
end
-</code>
</pre>
<p>Now let’s test case-insensitive code blocks.</p>
-<pre class="src">
-<code class="ruby">
+<pre class="src src-ruby">
# Finds all emphasis matches in a string.
# Supply a block that will get the marker and body as parameters.
def match_all(str)
@@ -37,10 +34,8 @@
yield $2, $3
end
end
-</code>
</pre>
-<pre class="src">
-<code class="clojure">
+<pre class="src src-clojure">
(def fib-seq
(concat
[0 1]
@@ -49,33 +44,26 @@
user> (take 20 fib-seq)
(0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181)
-</code>
</pre>
<p>Even if no language is set, it is still wrapped in code tags but class is empty.</p>
<pre class="src">
-<code class="">
echo 'Defaults env_keeps="http_proxy https_proxy ftp_proxy"' | sudo tee -a /etc/sudoers
-</code>
</pre>
<h1><span class="heading-number heading-number-1">3 </span>It should be possible to write a colon at the beginning of an example</h1>
<blockquote>
<p>I really love to write about :symbols. They sure are the best things in the world!</p>
</blockquote>
-<pre class="src">
-<code class="ruby">
+<pre class="src src-ruby">
{
:one => 1,
:two => 2
}
-</code>
</pre>
-<pre class="src">
-<code class="clojure">
+<pre class="src src-clojure">
(defproject helloworld "0.1"
:dependencies [[org.clojure/clojure
"1.1.0-master-SNAPSHOT"]
[org.clojure/clojure-contrib
"1.0-SNAPSHOT"]]
:main helloworld)
-</code>
</pre>
diff --git a/spec/html_examples/properties_drawer.html b/spec/html_examples/properties_drawer.html
index afd0ce1..45a0c7b 100644
--- a/spec/html_examples/properties_drawer.html
+++ b/spec/html_examples/properties_drawer.html
@@ -1,33 +1,25 @@
<h1 class="title">The mount point of the fullest disk</h1>
<h2>query all mounted disks</h2>
-<pre class="src">
-<code class="sh">
+<pre class="src src-sh">
df \
-</code>
</pre>
<h2>strip the header row</h2>
-<pre class="src">
-<code class="sh">
+<pre class="src src-sh">
<table>
<tr><td>sed '1d' \</tr>
</table>
-</code>
</pre>
<h2>sort by the percent full</h2>
-<pre class="src">
-<code class="sh">
+<pre class="src src-sh">
<table>
<tr><td>awk '{print $5 " " $6}'</td><td>sort -n</td><td>tail -1 \</tr>
</table>
-</code>
</pre>
<h2>extract the mount point</h2>
-<pre class="src">
-<code class="sh">
+<pre class="src src-sh">
<table>
<tr><td>awk '{print $2}'</tr>
</table>
-</code>
</pre>
<h1>Properties drawer example</h1>
<p>These properties are metadata so they should not be visible.</p>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-org.git
More information about the Pkg-ruby-extras-commits
mailing list