[DRE-commits] [ruby-org] 119/303: Headlines marked with the COMMENT keyword are not exported as specified in the comment lines section from the org-mode documentation. <http://orgmode.org/org.html#Comment-lines>
Jérémy Bobbio
lunar at alioth.debian.org
Fri Aug 9 17:33:40 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 52cac3de59acc40070fc9e5c6859e460c2c986cd
Author: Waldemar Quevedo <waldemar.quevedo at gmail.com>
Date: Sun Nov 20 02:08:27 2011 +0900
Headlines marked with the COMMENT keyword are not exported
as specified in the comment lines section from the org-mode documentation.
<http://orgmode.org/org.html#Comment-lines>
---
lib/org-ruby/headline.rb | 8 ++++++++
lib/org-ruby/parser.rb | 4 ++++
spec/headline_spec.rb | 5 +++++
3 files changed, 17 insertions(+)
diff --git a/lib/org-ruby/headline.rb b/lib/org-ruby/headline.rb
index b3f609b..33481bb 100644
--- a/lib/org-ruby/headline.rb
+++ b/lib/org-ruby/headline.rb
@@ -41,6 +41,9 @@ module Orgmode
KeywordsRegexp = Regexp.new("^(#{Keywords.join('|')})\$")
+ # This matches a headline marked as COMMENT
+ CommentHeadlineRegexp = /^COMMENT\s+/
+
def initialize(line, parser = nil, offset=0)
super(line, parser)
@body_lines = []
@@ -74,6 +77,11 @@ module Orgmode
line =~ LineRegexp
end
+ # Determines if a headline has the COMMENT keyword.
+ def comment_headline?
+ @headline_text =~ CommentHeadlineRegexp
+ end
+
# Overrides Line.paragraph_type.
def paragraph_type
:"heading#{@level}"
diff --git a/lib/org-ruby/parser.rb b/lib/org-ruby/parser.rb
index 7c5a02b..06a1870 100644
--- a/lib/org-ruby/parser.rb
+++ b/lib/org-ruby/parser.rb
@@ -329,6 +329,10 @@ module Orgmode
inherit_export_level = headline.level
end
end
+ if headline.comment_headline?
+ headline.export_state = :exclude
+ inherit_export_level = headline.level
+ end
end
end
end
diff --git a/spec/headline_spec.rb b/spec/headline_spec.rb
index bc0193b..7b7103b 100644
--- a/spec/headline_spec.rb
+++ b/spec/headline_spec.rb
@@ -56,5 +56,10 @@ describe Orgmode::Headline do
h.headline_text.should eql("Feed cat")
h.keyword.should eql("TODO")
end
+
+ it "should recognize headlines marked as COMMENT" do
+ h = Orgmode::Headline.new "* COMMENT This headline is a comment"
+ h.comment_headline?.should_not be_nil
+ end
end
--
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