Holy crap, it works
This commit is contained in:
@@ -18,6 +18,7 @@ require 'gollum/page'
|
|||||||
require 'gollum/file'
|
require 'gollum/file'
|
||||||
require 'gollum/markup'
|
require 'gollum/markup'
|
||||||
require 'gollum/albino'
|
require 'gollum/albino'
|
||||||
|
require 'gollum/websequencediagram'
|
||||||
|
|
||||||
module Gollum
|
module Gollum
|
||||||
VERSION = '1.0.1'
|
VERSION = '1.0.1'
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ module Gollum
|
|||||||
@tagmap = {}
|
@tagmap = {}
|
||||||
@codemap = {}
|
@codemap = {}
|
||||||
@texmap = {}
|
@texmap = {}
|
||||||
|
@wsdmap = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Render the content with Gollum wiki syntax on top of the file's own
|
# Render the content with Gollum wiki syntax on top of the file's own
|
||||||
@@ -32,6 +33,7 @@ module Gollum
|
|||||||
SANITIZATION_OPTIONS
|
SANITIZATION_OPTIONS
|
||||||
data = extract_tex(@data)
|
data = extract_tex(@data)
|
||||||
data = extract_code(data)
|
data = extract_code(data)
|
||||||
|
data = extract_wsd(data)
|
||||||
data = extract_tags(data)
|
data = extract_tags(data)
|
||||||
begin
|
begin
|
||||||
data = GitHub::Markup.render(@name, data)
|
data = GitHub::Markup.render(@name, data)
|
||||||
@@ -43,6 +45,7 @@ module Gollum
|
|||||||
end
|
end
|
||||||
data = process_tags(data)
|
data = process_tags(data)
|
||||||
data = process_code(data)
|
data = process_code(data)
|
||||||
|
data = process_wsd(data)
|
||||||
data = Sanitize.clean(data, sanitize_options)
|
data = Sanitize.clean(data, sanitize_options)
|
||||||
data = process_tex(data)
|
data = process_tex(data)
|
||||||
data.gsub!(/<p><\/p>/, '')
|
data.gsub!(/<p><\/p>/, '')
|
||||||
@@ -371,5 +374,28 @@ module Gollum
|
|||||||
end
|
end
|
||||||
data
|
data
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user