-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
29 lines (22 loc) · 1008 Bytes
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Redmine::Plugin.register :redmine_docson do
name 'Redmine Docson plugin'
author 'Michele Tessaro'
description 'Wiki macro plugin for inserting docson widgets into Wiki pages and Issues'
version '0.1.2'
url 'https://github.com/mikitex70/redmine_docson'
author_url 'https://github.com/mikitex70'
requires_redmine version: '2.6'..'3.4'
settings(partial: 'settings/docson_settings',
default: {'docson_web_path' => '/docson', 'docson_schemas_path' => '/jsonSchemas'})
Redmine::WikiFormatting::Macros.register do
desc <<EOF
Docson widget plugin. Example usage:
{{docson(path/to/json/schema)}}
JSON schema path must be relative to redmine public folder.
EOF
macro :docson do |obj, args|
content = "<script src=\"#{Setting.plugin_redmine_docson['docson_web_path']}/widget.js\" data-schema=\"#{Setting.plugin_redmine_docson['docson_schemas_path']}/#{args[0]}\"></script>"
return CGI::unescapeHTML(content).html_safe
end
end
end