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 +4 -4
- data/lib/ruby-dita/topic.rb +1 -0
- data/lib/ruby-dita.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db724e37465a97acf81e41a17a80354cd3a3f9d9
|
4
|
+
data.tar.gz: 22993c8318907d247007eece6297747c4fd4dbc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6188dc563c41202342e0148c25880ca1cd9a3d78ad63fa0884ad7e2c3aace528d7d22105b08ebe0698b6a617be7190e98ea432b7a7f61994b83f975734a5fa29
|
7
|
+
data.tar.gz: 0d458387a0b9280c5db0388d3ca55594efcb9365263b489841aa92c775b1dc413c185dde0475e0a54bdb362cd895f1411ac62e53f0557f2fe6c49475899bba94
|
data/lib/ruby-dita/topic.rb
CHANGED
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
|