glyph 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. data/Rakefile +19 -40
  2. data/benchmark.rb +1 -2
  3. data/book/config.yml +8 -8
  4. data/book/document.glyph +18 -19
  5. data/book/images/glyph/commands_tasks.png +0 -0
  6. data/book/lib/layouts/bookindex.glyph +113 -111
  7. data/book/lib/layouts/bookpage.glyph +112 -108
  8. data/book/lib/macros/reference.rb +2 -2
  9. data/book/lib/tasks/tasks.rake +1 -1
  10. data/book/text/acknowledgements.glyph +1 -0
  11. data/book/text/changelog.glyph +140 -112
  12. data/book/text/compiling/compiling.glyph +36 -24
  13. data/book/text/compiling/lite_mode.glyph +11 -11
  14. data/book/text/compiling/programmatic_usage.glyph +57 -57
  15. data/book/text/config/document.glyph +7 -1
  16. data/book/text/config/options.glyph +5 -3
  17. data/book/text/config/output.glyph +41 -8
  18. data/book/text/extending/bookmarks_headers.glyph +13 -11
  19. data/book/text/extending/command.glyph +1 -1
  20. data/book/text/extending/commands_tasks.glyph +2 -2
  21. data/book/text/extending/internals.glyph +29 -29
  22. data/book/text/extending/interpreting.glyph +48 -9
  23. data/book/text/extending/macro_def.glyph +80 -32
  24. data/book/text/extending/output_format.glyph +2 -2
  25. data/book/text/extending/placeholders.glyph +27 -15
  26. data/book/text/extending/validators.glyph +1 -1
  27. data/book/text/getting_started/configuration.glyph +1 -1
  28. data/book/text/getting_started/create_project.glyph +4 -5
  29. data/book/text/getting_started/structure.glyph +2 -2
  30. data/book/text/macros/macros_core.glyph +341 -199
  31. data/book/text/macros/macros_filters.glyph +1 -1
  32. data/book/text/macros/macros_inline.glyph +3 -3
  33. data/book/text/macros/macros_structure.glyph +1 -1
  34. data/book/text/ref_commands.glyph +98 -93
  35. data/book/text/snippets.glyph +18 -0
  36. data/book/text/stats/bookmarks.glyph +16 -16
  37. data/book/text/stats/links.glyph +23 -23
  38. data/book/text/stats/macros.glyph +14 -14
  39. data/book/text/stats/snippets.glyph +26 -26
  40. data/book/text/stats/stats.glyph +14 -15
  41. data/book/text/text_editing/attribute_intro.glyph +8 -8
  42. data/book/text/text_editing/code.glyph +16 -16
  43. data/book/text/text_editing/conditionals.glyph +12 -13
  44. data/book/text/text_editing/esc_quot.glyph +3 -3
  45. data/book/text/text_editing/evaluation.glyph +57 -3
  46. data/book/text/text_editing/inclusions.glyph +34 -25
  47. data/book/text/text_editing/macro_composition.glyph +28 -0
  48. data/book/text/text_editing/macro_intro.glyph +4 -4
  49. data/book/text/text_editing/section_aliases.glyph +23 -23
  50. data/book/text/text_editing/sections.glyph +22 -22
  51. data/book/text/text_editing/stylesheets.glyph +33 -33
  52. data/book/text/text_editing/topics.glyph +6 -6
  53. data/book/text/text_editing/xml_fallback.glyph +1 -1
  54. data/book/text/troubleshooting/errors_command.glyph +4 -4
  55. data/book/text/troubleshooting/errors_generic.glyph +16 -10
  56. data/book/text/troubleshooting/errors_macro.glyph +18 -21
  57. data/book/text/troubleshooting/errors_parser.glyph +7 -7
  58. data/config.yml +51 -29
  59. data/document.glyph +18 -18
  60. data/glyph.gemspec +39 -287
  61. data/layouts/web5/topic.glyph +1 -1
  62. data/lib/glyph.rb +42 -10
  63. data/lib/glyph/analyzer.rb +5 -2
  64. data/lib/glyph/bookmark.rb +3 -1
  65. data/lib/glyph/commands.rb +11 -9
  66. data/lib/glyph/commands/add.rb +3 -1
  67. data/lib/glyph/commands/compile.rb +10 -7
  68. data/lib/glyph/commands/config.rb +7 -5
  69. data/lib/glyph/commands/init.rb +2 -0
  70. data/lib/glyph/commands/outline.rb +2 -0
  71. data/lib/glyph/commands/stats.rb +3 -0
  72. data/lib/glyph/commands/todo.rb +2 -0
  73. data/lib/glyph/config.rb +2 -0
  74. data/lib/glyph/document.rb +34 -9
  75. data/lib/glyph/interpreter.rb +2 -0
  76. data/lib/glyph/macro.rb +97 -25
  77. data/lib/glyph/macro_validators.rb +9 -6
  78. data/lib/glyph/node.rb +3 -1
  79. data/lib/glyph/parser.rb +68 -33
  80. data/lib/glyph/reporter.rb +3 -1
  81. data/lib/glyph/syntax_node.rb +23 -28
  82. data/lib/glyph/system_extensions.rb +21 -0
  83. data/lib/glyph/utils.rb +24 -4
  84. data/macros/block.rb +111 -0
  85. data/macros/core.rb +163 -33
  86. data/macros/filters.rb +3 -2
  87. data/macros/inline.rb +97 -0
  88. data/macros/reps/html.rb +180 -0
  89. data/macros/reps/html5.rb +100 -0
  90. data/macros/reps/web.rb +4 -0
  91. data/macros/reps/web5.rb +4 -0
  92. data/macros/structure.rb +229 -0
  93. data/macros/xml.rb +29 -24
  94. data/spec/config.yml +7 -0
  95. data/spec/files/article.glyph +2 -2
  96. data/spec/files/web_doc.glyph +9 -5
  97. data/spec/lib/commands_spec.rb +13 -9
  98. data/spec/lib/config_spec.rb +2 -2
  99. data/spec/lib/document_spec.rb +10 -0
  100. data/spec/lib/glyph_spec.rb +30 -8
  101. data/spec/lib/macro_spec.rb +39 -4
  102. data/spec/lib/macro_validators_spec.rb +3 -4
  103. data/spec/lib/parser_spec.rb +7 -0
  104. data/spec/lib/reporter_spec.rb +1 -0
  105. data/spec/lib/syntax_node_spec.rb +40 -6
  106. data/spec/macros/core_spec.rb +154 -21
  107. data/spec/macros/filters_spec.rb +1 -1
  108. data/spec/macros/html5_spec.rb +4 -5
  109. data/spec/macros/macros_spec.rb +6 -7
  110. data/spec/macros/web5_spec.rb +3 -3
  111. data/spec/macros/web_spec.rb +10 -7
  112. data/spec/macros/xml_spec.rb +11 -2
  113. data/spec/spec_helper.rb +11 -5
  114. data/spec/tasks/generate_spec.rb +40 -5
  115. data/spec/tasks/load_spec.rb +1 -13
  116. data/styles/coderay.css +147 -38
  117. data/styles/default.css +19 -22
  118. data/styles/pagination.css +30 -30
  119. data/tasks/generate.rake +54 -18
  120. data/tasks/load.rake +9 -24
  121. data/tasks/project.rake +0 -2
  122. metadata +208 -207
  123. data/.gitignore +0 -7
  124. data/VERSION +0 -1
  125. data/book/snippets.yml +0 -18
  126. data/lib/glyph/macro_helpers.rb +0 -282
  127. data/macros/html/block.rb +0 -124
  128. data/macros/html/inline.rb +0 -42
  129. data/macros/html/structure.rb +0 -191
  130. data/macros/html5/block.rb +0 -69
  131. data/macros/html5/inline.rb +0 -24
  132. data/macros/html5/structure.rb +0 -140
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- .DS_Store
2
- thumbs.db
3
- .rvmrc*
4
- .bundle
5
- Gemfile.lock
6
- book/output
7
- book/output/*
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.2
data/book/snippets.yml DELETED
@@ -1,18 +0,0 @@
1
- ---
2
- :glang: Glyph Language
3
- :macros: Glyph Macros
4
- :sq_esc: Square brackets must be escaped unless used as macro delimiters or within a quoting macro.
5
- :gcode: "The following Glyph code:"
6
- :htmlcode: "Is translated into the following HTML code:"
7
- :markups: Textile or Markdown
8
- :filter_by_ext: "the $>[options.filters_by_file_extension] is @true@"
9
- :called_on_files: "If &[filter_by_ext], this macro is called automatically on =>[#m_include|included] files"
10
- :only_after_declaration: "can only be used _after_ its declaration"
11
- :coderay: "=>[http://coderay.rubychan.de/|Coderay]"
12
- :uv: "=>[http://ultraviolet.rubyforge.org/|Ultraviolet]"
13
- :yardoc: "http://yardoc.org/docs/h3rald-glyph"
14
- :unsafe: "This macro cannot be used in =>[#modes|safe mode]."
15
- :bin_params: "-p[0|The first expression to test]-p[1|The second expression to test]"
16
- :img_file: "The name of the image file (relative to the code[images/] folder)."
17
- :img_attrs: "Any attribute supported by the =>[http://www.w3schools.com/tags/tag_IMG.asp|img tag]."
18
- :opt: "em[(optional)]"
@@ -1,282 +0,0 @@
1
- module Glyph
2
- class Macro
3
-
4
- # This module includes some output-agnostic methods used by the most common Glyph macros.
5
- # @since 0.4.0
6
- module Helpers
7
-
8
- # Renders a link
9
- # @param [String] target the target of the link
10
- # @param[String] title the title of the link
11
- # @yield [link_path, link_title] the block to call to render the link
12
- # @yieldparam [String] link_path the path to the link target
13
- # @yieldparam [String] link_title the title of the link
14
- def link_element_for(target, title, &block)
15
- if target.match /^#/ then
16
- @node[:document].links << target
17
- anchor = target.gsub /^#/, ''
18
- bmk = bookmark? anchor
19
- if !bmk then
20
- placeholder do |document|
21
- bmk = document.bookmark?(anchor)
22
- macro_error "Bookmark '#{anchor}' does not exist" unless bmk
23
- bmk_title = title
24
- bmk_title = bmk.title if bmk_title.blank?
25
- block.call bmk.link(@source_file), bmk_title
26
- end
27
- else
28
- bmk_title = title
29
- bmk_title = bmk.title if bmk_title.blank?
30
- block.call bmk.link(@source_file), bmk_title
31
- end
32
- else
33
- if Glyph['options.url_validation'] && !@node[:document].links.include?(target) then
34
- begin
35
- url = URI.parse(target.gsub(/\\\./, ''))
36
- rescue Exception => e
37
- macro_warning "Invalid URL: #{url||target}", e
38
- end
39
- response = Net::HTTP.get_response(url)
40
- debug "Checking link URL: #{url} (#{response.code})"
41
- if response.code.to_i > 302 then
42
- macro_warning "Linked URL '#{url}' returned status #{response.code} (#{response.message})"
43
- end
44
- end
45
- @node[:document].links << target
46
- title ||= target
47
- block.call target, title
48
- end
49
- end
50
-
51
- # Renders a For More Information note
52
- # @param [String] topic the topic of the note
53
- # @param [String] href the reference to link to
54
- # @yield [topic, link] the block used to render the FMI note
55
- def fmi_element_for(topic, href, &block)
56
- link = placeholder do |document|
57
- interpret "link[#{href}]"
58
- end
59
- block.call topic, link
60
- end
61
-
62
- # Renders a draft comment element
63
- # @yield [value] the block used to render the comment
64
- # @yieldparam [String] value the comment text
65
- def draftcomment_element(&block)
66
- if Glyph['document.draft'] then
67
- block.call value
68
- else
69
- ""
70
- end
71
- end
72
-
73
- # Renders a todo element
74
- # @yield [value] the block used to render the todo element
75
- # @yieldparam [String] value the todo text
76
- def todo_element(&block)
77
- todo = {:source => @source_name, :text => value}
78
- @node[:document].todos << todo unless @node[:document].todos.include? todo
79
- if Glyph['document.draft'] then
80
- block.call value
81
- else
82
- ""
83
- end
84
- end
85
-
86
- # Renders an image element
87
- # @param [String] image the image to render
88
- # @param [String] alt the value of the image's ALT tag
89
- # @yield [alt, dest_file] the block used to render the image
90
- def image_element_for(image, alt, &block)
91
- src_file = Glyph.lite? ? image : Glyph::PROJECT/"images/#{image}"
92
- dest_file = Glyph.lite? ? image : "images/#{image}"
93
- warning "Image '#{image}' not found" unless Pathname.new(src_file).exist?
94
- block.call alt, dest_file
95
- end
96
-
97
- # Renders a figure element
98
- # @param [String] image the image to render
99
- # @param [String] alt the value of the image's ALT tag
100
- # @param [String] caption
101
- # @yield alt, dest_file, caption] the block used to render the figure
102
- def figure_element_for(image, alt, caption, &block)
103
- src_file = Glyph.lite? ? image : Glyph::PROJECT/"images/#{image}"
104
- dest_file = Glyph.lite? ? image : "images/#{image}"
105
- warning "Figure '#{image}' not found" unless Pathname.new(src_file).exist?
106
- block.call alt, dest_file, caption
107
- end
108
-
109
- # Renders a title element
110
- def title_element(&block)
111
- unless Glyph["document.title"].blank? then
112
- block.call
113
- else
114
- ""
115
- end
116
- end
117
-
118
- # Renders a subtitle element
119
- def subtitle_element(&block)
120
- unless Glyph["document.subtitle"].blank? then
121
- block.call
122
- else
123
- ""
124
- end
125
- end
126
-
127
- # Renders an author element
128
- def author_element(&block)
129
- unless Glyph['document.author'].blank? then
130
- block.call
131
- else
132
- ""
133
- end
134
- end
135
-
136
- # Renders a revision element
137
- def revision_element(&block)
138
- unless Glyph["document.revision"].blank? then
139
- block.call
140
- else
141
- ""
142
- end
143
- end
144
-
145
- # Renders a Table of Contents
146
- # @param [Integer] depth the maximum header level
147
- # @param [String] title the title of the TOC
148
- # @param [Hash] procs the Proc objects used to render the TOC
149
- # @option procs [Proc] :link used to render TOC header links (parameters: Glyph::Header).
150
- # @option procs [Proc] :toc_list used to render the TOC list (parameters: a Proc used to traverse the document tree, the Glyph::Bookmark used for the TOC header, a Glyph::Document)
151
- # @option procs [Proc] :toc_item used to render a TOC item (parameters: an Array of header classes, a String used for the header link)
152
- # @option procs [Proc] :toc_sublist used to render a TOC sublist (parameters: a String containing the contents of the list)
153
- def toc_element_for(depth, title, procs={})
154
- return @node[:document].toc[:contents] if @node[:document].toc[:contents]
155
- link_header = procs[:link]
156
- toc = placeholder do |document|
157
- descend_section = lambda do |n1, added_headers|
158
- list = ""
159
- added_headers ||= []
160
- n1.descend do |n2, level|
161
- #if n2.is_a?(Glyph::MacroNode) && Glyph['system.structure.headers'].include?(n2[:name]) then
162
- if n2.is_a?(Glyph::MacroNode) && n2[:name].in?(Glyph.titled_sections) then
163
- if Glyph.multiple_output_files? then
164
- # Only consider topics/booklets when building TOC for web/web5
165
- next if !n2.attribute(:src) && n2.child_macros.select{|child| child.attribute(:src)}.blank?
166
- end
167
- next if n2.find_parent{|node| Glyph['system.structure.special'].include? node[:name] }
168
- header_hash = n2[:header]
169
- next if depth && header_hash && (header_hash.level-1 > depth.to_i) || header_hash && !header_hash.toc?
170
- next if added_headers.include? header_hash
171
- added_headers << header_hash
172
- # Check if part of frontmatter, bodymatter or backmatter
173
- container = n2.find_parent do |node|
174
- node.is_a?(Glyph::MacroNode) &&
175
- node[:name].in?([:frontmatter, :bodymatter, :appendix, :backmatter])
176
- end[:name] rescue nil
177
- list << procs[:toc_item].call([container, n2[:name]], link_header.call(header_hash)) if header_hash
178
- child_list = ""
179
- n2.children.each do |c|
180
- child_list << descend_section.call(c, added_headers)
181
- end
182
- list << procs[:toc_sublist].call(child_list) unless child_list.blank?
183
- end
184
- end
185
- list
186
- end
187
- title ||= "Table of Contents"
188
- bmk = @node[:document].bookmark?(:toc) || bookmark(:id => :toc, :file => @source_file, :title => title)
189
- procs[:toc_list].call descend_section, bmk, document
190
- end
191
- @node[:document].toc[:contents] = toc.to_s
192
- toc
193
- end
194
-
195
- # Renders a section element
196
- # @param [Hash] procs the Proc objects used to render the section
197
- # @option procs [Proc] :title used to render the section header (parameters: the header level, the section ID, the section title)
198
- # @option procs [Proc] :body used to render the section body (parameters: the section title, the section body)
199
- def section_element_for(procs={})
200
- h = ""
201
- if attr(:title) then
202
- level = 1
203
- @node.ascend do |n|
204
- break if n.respond_to?(:attribute) && n.attribute(:class) && n.attribute(:class).children.join.strip == "topic"
205
- #if n.is_a?(Glyph::MacroNode) && Glyph["system.structure.headers"].include?(n[:name]) then
206
- if n.is_a?(Glyph::MacroNode) && n[:name].in?(Glyph.titled_sections) then
207
- level+=1
208
- end
209
- end
210
- ident = (attr(:id) || "h_#{@node[:document].headers.length+1}").to_sym
211
- # The bookmark is added when the section is first processed; therefore it will exist already when a topic layout is processed
212
- bmk = @node[:document].bookmark?(ident)
213
- bmk ||= header :title => attr(:title),
214
- :level => level,
215
- :id => ident,
216
- :toc => !attr(:notoc),
217
- :definition => @source_file,
218
- :file => (attr(:src) || @source_file)
219
- @node[:header] = bmk
220
- h = procs[:title].call level, bmk, attr(:title)
221
- end
222
- if attr(:src) then
223
- # Create topic
224
- if Glyph.multiple_output_files?
225
- topic_id = (attr(:id) || "t_#{@node[:document].topics.length}").to_sym
226
- layout = attr(:layout) || Glyph["output.#{Glyph['document.output']}.layouts.topic"] || :topic
227
- layout_name = "layout:#{layout}".to_sym
228
- macro_error "Layout '#{layout}' not found" unless Glyph::MACROS[layout_name]
229
- result = interpret %{#{layout_name}[
230
- @title[#{attr(:title)}]
231
- @id[#{topic_id}]
232
- @contents[include[@topic[true]#{attr(:src)}]]
233
- ]}
234
- bmk = @node[:document].bookmark? topic_id
235
- if bmk then
236
- # Fix file for topic bookmark
237
- @node[:document].bookmark?(topic_id).file = attr(:src)
238
- else
239
- bookmark :title => attr(:title), :id => topic_id, :file => attr(:src), :definition => @source_file
240
- end
241
- topic_src = attr(:src)
242
- topic_src += ".glyph" unless topic_src.match /\..+$/
243
- @node[:document].topics << {:src => topic_src, :title => attr(:title), :id => topic_id, :contents => result}
244
- # Process section contents
245
- procs[:body].call h, value
246
- # Return nothing
247
- nil
248
- else
249
- v = raw_value
250
- @node.children.delete_if{|c| !c.is_a?(Glyph::AttributeNode)}
251
- body = interpret "include[#{attr(:src)}]#{v}"
252
- procs[:body].call h, body
253
- end
254
- else
255
- procs[:body].call h, value
256
- end
257
- end
258
-
259
- # Renders a navigation element
260
- # @param [String] topic_id the ID of the current topic
261
- # @param [Hash] procs the Proc objects used to render the navigation element
262
- # @option procs [Proc] :previous the link to the previous topic
263
- # @option procs [Proc] :next the link to the next topic
264
- # @option procs [Proc] :contents the link to the document contents
265
- def navigation_element_for(topic_id, procs={})
266
- # Get the previous topic
267
- previous_topic = @node[:document].topics.last
268
- previous_link = procs[:previous].call previous_topic
269
- # The next topic is not going to be available yet, use a placeholder
270
- next_link = placeholder do |document|
271
- current_topic = document.topics.select{|t| t[:id] == topic_id}[0] rescue nil
272
- next_topic = document.topics[document.topics.index(current_topic)+1] rescue nil
273
- procs[:next].call next_topic
274
- end
275
- contents_link = procs[:contents].call
276
- procs[:navigation].call contents_link, previous_link, next_link
277
- end
278
-
279
-
280
- end
281
- end
282
- end
data/macros/html/block.rb DELETED
@@ -1,124 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- macro :note do
4
- %{<div class="#{@name}">
5
- <span class="note-title">#{@name.to_s.capitalize}</span>#{value}
6
-
7
- </div>}
8
- end
9
-
10
- macro :box do
11
- exact_parameters 2
12
- %{<div class="box">
13
- <div class="box-title">#{param(0)}</div>
14
- #{param(1)}
15
-
16
- </div>}
17
- end
18
-
19
- macro :codeblock do
20
- exact_parameters 1
21
- %{
22
- <div class="code">
23
- <pre>
24
- <code>
25
- #{value}
26
- </code>
27
- </pre>
28
- </div>}
29
- end
30
-
31
- macro :image do
32
- min_parameters 1
33
- max_parameters 3
34
- image = param(0)
35
- alt = "@alt[-]" unless attr(:alt)
36
- image_element_for image, alt do |alt, dest_file|
37
- interpret "img[#{alt}@src[#{Glyph["output.#{Glyph['document.output']}.base"]}#{dest_file}]#{@node.attrs.join}]"
38
- end
39
- end
40
-
41
- macro :figure do
42
- min_parameters 1
43
- max_parameters 2
44
- image = param(0)
45
- alt = "@alt[-]" unless attr(:alt)
46
- caption = "div[@class[caption]#{param(1)}]" rescue nil
47
- figure_element_for image, alt, caption do |alt, dest_file, caption|
48
- interpret %{div[@class[figure]
49
- img[#{alt}@src[#{Glyph["output.#{Glyph['document.output']}.base"]}#{dest_file}]#{@node.attrs.join}]
50
- #{caption}
51
- ]}
52
- end
53
- end
54
-
55
- macro :title do
56
- no_parameters
57
- title_element do
58
- %{<h1>
59
- #{Glyph["document.title"]}
60
- </h1>}
61
- end
62
- end
63
-
64
- macro :subtitle do
65
- no_parameters
66
- subtitle_element do
67
- %{<h2>
68
- #{Glyph["document.subtitle"]}
69
- </h2>}
70
- end
71
- end
72
-
73
- macro :author do
74
- no_parameters
75
- author_element do
76
- %{<div class="author">
77
- by <em>#{Glyph["document.author"]}</em>
78
- </div>}
79
- end
80
- end
81
-
82
- macro :pubdate do
83
- no_parameters
84
- %{<div class="pubdate">
85
- #{Time.now.strftime("%B %Y")}
86
- </div>}
87
- end
88
-
89
- macro :revision do
90
- no_parameters
91
- revision_element do
92
- %{<div class="revision">#{Glyph['document.revision']}</div>}
93
- end
94
- end
95
-
96
- macro :navigation do
97
- exact_parameters 1
98
- procs = {}
99
- procs[:contents] = lambda do
100
- %{<a href="#{Glyph["output.#{Glyph['document.output']}.base"]}index.html">Contents</a>}
101
- end
102
- procs[:previous] = lambda do |topic|
103
- if topic then
104
- %{<a href="#{Glyph["output.#{Glyph['document.output']}.base"]}#{topic[:src].gsub(/\..+$/, '.html')}">#{topic[:title]} &larr;</a>}
105
- else
106
- ""
107
- end
108
- end
109
- procs[:next] = lambda do |topic|
110
- if topic then
111
- %{<a href="#{Glyph["output.#{Glyph['document.output']}.base"]}#{topic[:src].gsub(/\..+$/, '.html')}">&rarr; #{topic[:title]}</a>}
112
- else
113
- ""
114
- end
115
- end
116
- procs[:navigation] = lambda do |contents, prev_link, next_link|
117
- %{<div class="navigation">#{prev_link}#{contents}#{next_link}</div>}
118
- end
119
- navigation_element_for param(0).to_sym, procs
120
- end
121
-
122
- macro_alias :important => :note
123
- macro_alias :tip => :note
124
- macro_alias :caution => :note
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- macro :anchor do
4
- min_parameters 1
5
- max_parameters 2
6
- bookmark :id => param(0), :title => param(1), :file => @source_file
7
- %{<a id="#{param(0)}">#{(param(1) rescue nil)}</a>}
8
- end
9
-
10
- macro :link do
11
- min_parameters 1
12
- max_parameters 2
13
- link_element_for param(0), param(1) do |target, title|
14
- %{<a href="#{target}">#{title}</a>}
15
- end
16
- end
17
-
18
- macro :fmi do
19
- exact_parameters 2, :level => :warning
20
- fmi_element_for param(0), param(1) do |topic, link|
21
- %{<span class="fmi">for more information on #{topic}, see #{link}</span>}
22
- end
23
- end
24
-
25
- macro :draftcomment do
26
- draftcomment_element do |value|
27
- %{<span class="comment"><span class="comment-pre"><strong>Comment:</strong> </span>#{value}</span>}
28
- end
29
- end
30
-
31
- macro :todo do
32
- exact_parameters 1
33
- todo_element do |value|
34
- %{<span class="todo"><span class="todo-pre"><strong>TODO:</strong> </span>#{value}</span>}
35
- end
36
- end
37
-
38
- macro_alias :bookmark => :anchor
39
- macro_alias '#' => :anchor
40
- macro_alias '=>' => :link
41
- macro_alias '!' => :todo
42
- macro_alias :dc => :draftcomment