summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/reference.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util/reference.rb')
-rw-r--r--lib/puppet/util/reference.rb55
1 files changed, 3 insertions, 52 deletions
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
index 62bab643e..4f2058e69 100644
--- a/lib/puppet/util/reference.rb
+++ b/lib/puppet/util/reference.rb
@@ -15,7 +15,7 @@ class Puppet::Util::Reference
end
def self.modes
- %w{pdf trac text markdown}
+ %w{pdf text}
end
def self.newreference(name, options = {}, &block)
@@ -32,7 +32,7 @@ class Puppet::Util::Reference
section = reference(name) or raise "Could not find section #{name}"
depth = section.depth if section.depth < depth
end
- text = ".. contents:: :depth: 2\n\n"
+ text = "{:toc}\n\n"
end
def self.pdf(text)
@@ -67,32 +67,6 @@ class Puppet::Util::Reference
end
- def self.markdown(name, text)
- puts "Creating markdown for #{name} reference."
- dir = "/tmp/#{Puppet::PUPPETVERSION}"
- FileUtils.mkdir(dir) unless File.directory?(dir)
- Puppet::Util.secure_open(dir + "/#{name}.rst", "w") do |f|
- f.puts text
- end
- pandoc = %x{which pandoc}
- if $CHILD_STATUS != 0 or pandoc =~ /no /
- pandoc = %x{which pandoc}
- end
- if $CHILD_STATUS != 0 or pandoc =~ /no /
- raise "Could not find pandoc"
- end
- pandoc.chomp!
- cmd = %{#{pandoc} -s -r rst -w markdown #{dir}/#{name}.rst -o #{dir}/#{name}.mdwn}
- output = %x{#{cmd}}
- unless $CHILD_STATUS == 0
- $stderr.puts "Pandoc failed to create #{name} reference."
- $stderr.puts output
- exit(1)
- end
-
- File.unlink(dir + "/#{name}.rst")
- end
-
def self.references
instance_loader(:reference).loadall
loaded_instances(:reference).sort { |a,b| a.to_s <=> b.to_s }
@@ -167,7 +141,7 @@ class Puppet::Util::Reference
# First the header
text = h(@title, 1)
text += "\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on #{Time.now.to_s})*\n\n"
- text += ".. contents:: :depth: #{@depth}\n\n" if withcontents
+ text += "{:toc}\n\n" if withcontents
text += @header
@@ -181,27 +155,4 @@ class Puppet::Util::Reference
def to_text(withcontents = true)
strip_trac(to_rest(withcontents))
end
-
- def to_trac(with_contents = true)
- "{{{\n#!rst\n#{self.to_rest(with_contents)}\n}}}"
- end
-
- def trac
- Puppet::Util.secure_open("/tmp/puppetdoc.txt", "w") do |f|
- f.puts self.to_trac
- end
-
- puts "Writing #{@name} reference to trac as #{@page}"
- cmd = %{sudo trac-admin /opt/rl/trac/puppet wiki import %s /tmp/puppetdoc.txt} % self.page
- output = %x{#{cmd}}
- unless $CHILD_STATUS == 0
- $stderr.puts "trac-admin failed"
- $stderr.puts output
- exit(1)
- end
- unless output =~ /^\s+/
- $stderr.puts output
- end
- end
end
-