gitlab-markup 1.6.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 216b27009d51155a59aa00c6ea107ba15617c493
4
- data.tar.gz: e22c1a28edaff57ff060a98c772b4ded2fc6370c
3
+ metadata.gz: 82795809627f394f8c953c348cd41b408fb3b205
4
+ data.tar.gz: 8ad6727f7393d9e0206dc7227b32a14931102448
5
5
  SHA512:
6
- metadata.gz: 5291f6b31d67fbb75e7630defd4d4d2bb265100d88e48cfb73264c62d828bc65619e197c31d4b4dc25e50063410baec5141308d549ccf1065beea23ddb851419
7
- data.tar.gz: 348298df2c87487252cf2174ca51675429d0a877d3bd24ca7d92ababbb0672332ef984e532c6149df3d346dcc203fd1f767a263ed7c39bddc8414357599cd96d
6
+ metadata.gz: 18a7fde6790047ac49d7269835ef78747e8514b68e5c0cfe1ba8564ce2ddab30b23f9fb9c5fa3767412c1bd129d1b5dfce880c305eaee3bd522ac547dc7efa1a
7
+ data.tar.gz: b8ace4828588e671f59c6f8a184e9443819542a0b26526a2180d66e8edfdff8c4cf0979e130c27149c6a303aaedf813215463d2600aae000557c0cd77b576493
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.6.3 (2017-10-30)
2
+
3
+ * Support PlantUML caption option and `uml::` directive
4
+
1
5
  ## 1.6.2 (2017-09-20)
2
6
 
3
7
  * Support PlantUML blocks in reStructuredText
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '1.6.2'
3
+ VERSION = '1.6.3'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -47,7 +47,7 @@ except:
47
47
  import codecs
48
48
  import io
49
49
 
50
- from docutils import nodes
50
+ from docutils import nodes, statemachine
51
51
  from docutils.parsers.rst import directives, roles
52
52
  from docutils.parsers.rst.directives.body import CodeBlock
53
53
  from docutils.core import publish_parts
@@ -85,9 +85,25 @@ class PlantumlDirective(CodeBlock):
85
85
  picked up in GitLab by the generic Banzai::Filter::PlantumlFilter
86
86
  """
87
87
 
88
+ option_spec = CodeBlock.option_spec.copy()
89
+ option_spec.update({
90
+ 'caption': directives.unchanged
91
+ })
92
+
88
93
  def run(self):
89
94
  self.arguments = ['plantuml']
90
- return super(PlantumlDirective, self).run()
95
+ node = super(PlantumlDirective, self).run()
96
+
97
+ if 'caption' in self.options:
98
+ # create an anonymous container to parse the caption content
99
+ container = nodes.Element()
100
+ content = statemachine.StringList([self.options['caption']])
101
+ self.state.nested_parse(content, self.content_offset, container)
102
+ caption = nodes.caption(self.options['caption'], '', *container)
103
+
104
+ node.append(caption)
105
+
106
+ return node
91
107
 
92
108
 
93
109
  class GitHubHTMLTranslator(HTMLTranslator, object):
@@ -112,6 +128,7 @@ class GitHubHTMLTranslator(HTMLTranslator, object):
112
128
 
113
129
  def visit_literal_block(self, node):
114
130
  classes = node.attributes['classes']
131
+
115
132
  if len(classes) >= 2 and classes[0] == 'code':
116
133
  language = classes[1]
117
134
  del classes[:]
@@ -198,7 +215,9 @@ def main():
198
215
  directives.register_directive('doctest', DoctestDirective)
199
216
 
200
217
  # Render source code in Sphinx plantuml blocks
218
+ # Also support uml:: directive for compatibility with sphinxcontrib-plantuml
201
219
  directives.register_directive('plantuml', PlantumlDirective)
220
+ directives.register_directive('uml', PlantumlDirective)
202
221
 
203
222
  parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS)
204
223
  if 'html_body' in parts:
@@ -73,7 +73,17 @@ someone@somewhere.org
73
73
 
74
74
  Press :kbd:`Ctrl+C` to quit
75
75
 
76
-
77
76
  .. raw:: html
78
77
 
79
78
  <p><strong>RAW HTML!</strong></p><style> p {color:blue;} </style>
79
+
80
+ .. plantuml::
81
+ :caption: Caption with **bold** and *italic*
82
+
83
+ Bob -> Alice: hello
84
+ Alice -> Bob: Go Away
85
+
86
+ .. uml::
87
+
88
+ Bob -> Alice: hello
89
+ Alice -> Bob: Go Away
@@ -90,4 +90,14 @@ but no problem!</td>
90
90
  <p><a href="mailto:someone@somewhere.org">someone@somewhere.org</a></p>
91
91
 
92
92
  <p>Press <kbd>Ctrl+C</kbd> to quit</p>
93
-
93
+ <pre>
94
+ <code lang="plantuml">
95
+ Bob -&gt; Alice: hello
96
+ Alice -&gt; Bob: Go Away</code>
97
+ </pre>
98
+ <p>Caption with <strong>bold</strong> and <em>italic</em></p>
99
+ <pre>
100
+ <code lang="plantuml">
101
+ Bob -&gt; Alice: hello
102
+ Alice -&gt; Bob: Go Away</code>
103
+ </pre>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-20 00:00:00.000000000 Z
11
+ date: 2017-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport