ruby-dita 0.3.1 → 0.3.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f41ece3ad990f2f6fdf3b602d36ef3bac139cb1
4
- data.tar.gz: 1c504ab70a19959676cab6fb51d87eca32abd123
3
+ metadata.gz: db724e37465a97acf81e41a17a80354cd3a3f9d9
4
+ data.tar.gz: 22993c8318907d247007eece6297747c4fd4dbc1
5
5
  SHA512:
6
- metadata.gz: 6a0ff8cf76f4d57a3f27b5dcf2439a4bdbb04cbbe8f7f6ac619ef1dbd0ab9890ad9aa557a62b3461b0f96b4848996213c813f93e17edd64698ba9a8f67e58314
7
- data.tar.gz: 70e259e5a7fbf820f6f6f215b2ff045ee66aa5925fa5d2ecd9b8cb443cf7418de908fedbb70222ec2a02122f28b1eb9ad1841d3c9562c87878bbe491bc2fb9b3
6
+ metadata.gz: 6188dc563c41202342e0148c25880ca1cd9a3d78ad63fa0884ad7e2c3aace528d7d22105b08ebe0698b6a617be7190e98ea432b7a7f61994b83f975734a5fa29
7
+ data.tar.gz: 0d458387a0b9280c5db0388d3ca55594efcb9365263b489841aa92c775b1dc413c185dde0475e0a54bdb362cd895f1411ac62e53f0557f2fe6c49475899bba94
@@ -11,5 +11,6 @@ module Dita
11
11
  t[:id] = "topic#{t.object_id.to_s}"
12
12
  t << Element.new('title', [title])
13
13
  t << Element.new('body', content) if content
14
+ t
14
15
  end
15
16
  end
data/lib/ruby-dita.rb CHANGED
@@ -13,6 +13,18 @@ module Dita
13
13
  super(path, GRAMMAR_PATH)
14
14
  end
15
15
 
16
+ # @param path [String] where to save output file
17
+ # @param output [Doc] document to save; if output.grammar is same as Dita.grammar, adds Dita doctype declaration
18
+ # @return [Doc] same as @param output
19
+ def save(path, output=doc)
20
+ if output.grammar.rules.size == Dita.grammar.rules.size # TODO find better way to compare these!!
21
+ File.write(path, %(<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">#{output.root.to_s}))
22
+ else
23
+ super(path, output)
24
+ end
25
+ output
26
+ end
27
+
16
28
  # @return [GrammarClass] returns Dita grammar as standalone object
17
29
  def self.grammar
18
30
  Ox.parse_obj File.read GRAMMAR_PATH
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-dita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kong