[DRE-commits] [ruby-org] 61/303: Now supports the option for exporting todo keywords.
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:28 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 fb4801f4b69c7ae3ef5547ca2ca1ac99324fe8d2
Author: Brian Dewey <bdewey at gmail.com>
Date: Tue Dec 29 16:34:27 2009 -0800
Now supports the option for exporting todo keywords.
---
lib/org-ruby/headline.rb | 6 +++++-
lib/org-ruby/parser.rb | 6 +++++-
spec/html_examples/export-keywords.html | 4 ++++
spec/html_examples/export-keywords.org | 18 ++++++++++++++++++
spec/parser_spec.rb | 3 +++
5 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/lib/org-ruby/headline.rb b/lib/org-ruby/headline.rb
index 2df59cf..ddc620e 100644
--- a/lib/org-ruby/headline.rb
+++ b/lib/org-ruby/headline.rb
@@ -72,7 +72,11 @@ module Orgmode
else
decoration = ""
end
- output = "<h#{@level}#{decoration}>#{@headline_text}</h#{@level}>\n"
+ output = "<h#{@level}#{decoration}>"
+ if @parser and @parser.export_todo? then
+ output << "<span class=\"#{@keyword}\">#{@keyword} </span>"
+ end
+ output << "#{@headline_text}</h#{@level}>\n"
output << Line.to_html(@body_lines)
output
end
diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb
index ba4144e..6ddb5af 100644
--- a/lib/org-ruby/parser.rb
+++ b/lib/org-ruby/parser.rb
@@ -24,7 +24,11 @@ module Orgmode
# This contains in-buffer options; a special case of in-buffer settings.
attr_reader :options
-
+
+ def export_todo?
+ "t" == @options["todo"]
+ end
+
# I can construct a parser object either with an array of lines
# or with a single string that I will split along \n boundaries.
def initialize(lines)
diff --git a/spec/html_examples/export-keywords.html b/spec/html_examples/export-keywords.html
new file mode 100644
index 0000000..6cd4aa8
--- /dev/null
+++ b/spec/html_examples/export-keywords.html
@@ -0,0 +1,4 @@
+<p class="title">export-keywords.org</p>
+<p>Testing that I can export keywords.</p>
+<h1><span class="TODO">TODO </span>This is a todo item.</h1>
+<h1><span class="DONE">DONE </span>this item is done!</h1>
diff --git a/spec/html_examples/export-keywords.org b/spec/html_examples/export-keywords.org
new file mode 100644
index 0000000..8081222
--- /dev/null
+++ b/spec/html_examples/export-keywords.org
@@ -0,0 +1,18 @@
+#+TITLE: export-keywords.org
+#+AUTHOR:
+#+EMAIL: brian at BRIAN-DESK
+#+DATE: 2009-12-29 Tue
+#+DESCRIPTION:
+#+KEYWORDS:
+#+LANGUAGE: en
+#+OPTIONS: H:3 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
+#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc
+#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
+#+EXPORT_SELECT_TAGS: export
+#+EXPORT_EXCLUDE_TAGS: noexport
+#+LINK_UP:
+#+LINK_HOME:
+Testing that I can export keywords.
+
+* TODO This is a todo item.
+* DONE this item is done!
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 0e5884a..46cc110 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -56,6 +56,9 @@ describe Orgmode::Parser do
parser.options["TeX"].should eql("t")
parser.options["todo"].should eql("t")
parser.options["\\n"].should eql("nil")
+ parser.export_todo?.should be_true
+ parser.options.delete("todo")
+ parser.export_todo?.should be_false
end
it "should skip in-buffer settings inside EXAMPLE blocks" do
--
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