Holy crap, it works

This commit is contained in:
Tim Sharpe
2010-10-01 15:44:32 +10:00
parent 251d5c8201
commit 1111dbb9a2
2 changed files with 27 additions and 0 deletions
+1
View File
@@ -18,6 +18,7 @@ require 'gollum/page'
require 'gollum/file'
require 'gollum/markup'
require 'gollum/albino'
require 'gollum/websequencediagram'
module Gollum
VERSION = '1.0.1'
+26
View File
@@ -17,6 +17,7 @@ module Gollum
@tagmap = {}
@codemap = {}
@texmap = {}
@wsdmap = {}
end
# Render the content with Gollum wiki syntax on top of the file's own
@@ -32,6 +33,7 @@ module Gollum
SANITIZATION_OPTIONS
data = extract_tex(@data)
data = extract_code(data)
data = extract_wsd(data)
data = extract_tags(data)
begin
data = GitHub::Markup.render(@name, data)
@@ -43,6 +45,7 @@ module Gollum
end
data = process_tags(data)
data = process_code(data)
data = process_wsd(data)
data = Sanitize.clean(data, sanitize_options)
data = process_tex(data)
data.gsub!(/<p><\/p>/, '')
@@ -371,5 +374,28 @@ module Gollum
end
data
end
#########################################################################
#
# Sequence Diagrams
#
#########################################################################
def extract_wsd(data)
data.gsub(/^\{\{\{ ?(.+?)\r?\n(.+?)\r?\n\}\}\}\r?$/m) do
id = Digest::SHA1.hexdigest($2)
@wsdmap[id] = { :style => $1, :code => $2 }
id
end
end
def process_wsd(data)
@wsdmap.each do |id, spec|
style = spec[:style]
code = spec[:code]
data.gsub!(id, Gollum::WebSequenceDiagram.new(code, style).to_tag)
end
data
end
end
end