avv2word 1.1.21 → 1.1.22

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
  SHA256:
3
- metadata.gz: 12608a2eee602a49862149373bcca101d30c41dda0f01299aafcddc82339fc5d
4
- data.tar.gz: 777335a6b1c245634f6f5c489838c586fe44c281fdf628deb089550b0281143e
3
+ metadata.gz: 18ca63416516a26399bd8a8bc4fdb124b154a5378a75402a4fe73f1beb7a4513
4
+ data.tar.gz: 46ea7f727f63f50582f3ab6a4b017a860b6005be74f5e3a7e6ec2a0502cb7588
5
5
  SHA512:
6
- metadata.gz: 6844840f037c70f8643ff54f21f533fb55f68606879aa72f4c41266e483e8183a138ade09c9dec28154f783a01271da4ff45518707c4218037616a4d10c2932e
7
- data.tar.gz: 51790dc531a1be5fd1aac15e5194f13a835e6534635c255cbc4eacd2cd01aba2982b44cab2531ca484199d93973fa46f54158902ca3b75d1612317d11433540b
6
+ metadata.gz: 4cd938448158a6c89947bf8333f69524c6569df29ad205baa9e74acd431d1119ee20dfe38768709f1dc6c467ef615487e3ed38425e35ae505a90e77600a976a8
7
+ data.tar.gz: 6c09d87a1fd542ce1a5251cc9031e5bb8b9089f344189c50036090ed80fc1fe0d8bbfba29c74c85fb300155e782e6293fc6518c95f50be341dc0ab348eb5f4e4
@@ -208,15 +208,66 @@ module Avv2word
208
208
  fn_node2.xpath("w:p/w:r/w:t").first.content = " " + footnote
209
209
  end
210
210
  fn_node.remove
211
-
212
211
  @replaceable_files["word/footnotes.xml"] = doc.to_xml
212
+
213
213
  # add relation
214
214
  rels = Nokogiri::XML(@replaceable_files["word/_rels/document.xml.rels"])
215
- new_rel = '<Relationship Id="rIdXX" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/>'
216
- new_rel.sub!(/XX/, (rels.xpath("//xmlns:Relationship").size+1).to_s )
217
- new_rel = Nokogiri::XML.parse(new_rel).child
218
- rels.children.first << new_rel
215
+ [ #'<Relationship Id="rIdXX" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/>',
216
+ '<Relationship Id="rIdXX" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/>'
217
+ ].each do |new_rel|
218
+ new_rel.sub!(/XX/, (rels.xpath("//xmlns:Relationship").size+1).to_s )
219
+ rels.children.first << Nokogiri::XML.parse(new_rel).child
220
+ end
219
221
  @replaceable_files["word/_rels/document.xml.rels"] = rels.to_xml
222
+
223
+ # settings
224
+ if @replaceable_files["word/settings.xml"]
225
+ sets = Nokogiri::XML(@replaceable_files["word/settings.xml"])
226
+ else
227
+ sets = nil
228
+ Zip::File.open(@template_path) do |zipfile|
229
+ sets = Nokogiri::XML.parse(zipfile.read("word/settings.xml"))
230
+ end
231
+ end
232
+ ['<w:footnotePr><w:footnote w:id="-1"/><w:footnote w:id="0"/></w:footnotePr>',
233
+ #'<w:endnotePr><w:endnote w:id="-1"/><w:endnote w:id="0"/></w:endnotePr>'
234
+ ].each do |new_type|
235
+ sets.children.first << Nokogiri::XML.parse(new_type).child
236
+ end
237
+ @replaceable_files["word/settings.xml"] = sets.to_xml
238
+
239
+ # styles
240
+ if @replaceable_files["word/styles.xml"]
241
+ styles = Nokogiri::XML(@replaceable_files["word/styles.xml"])
242
+ else
243
+ styles = nil
244
+ Zip::File.open(@template_path) do |zipfile|
245
+ styles = Nokogiri::XML.parse(zipfile.read("word/styles.xml"))
246
+ end
247
+ end
248
+ [ '<w:style w:type="paragraph" w:styleId="FootnoteText"><w:name w:val="footnote text"/><w:basedOn w:val="Normal"/><w:link w:val="FootnoteTextChar"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:rsid w:val="008D12FB"/></w:style>',
249
+ '<w:style w:type="character" w:customStyle="1" w:styleId="FootnoteTextChar"><w:name w:val="Footnote Text Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="FootnoteText"/><w:uiPriority w:val="99"/><w:semiHidden/><w:rsid w:val="008D12FB"/></w:style>',
250
+ '<w:style w:type="character" w:styleId="FootnoteReference"><w:name w:val="footnote reference"/><w:basedOn w:val="DefaultParagraphFont"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:rsid w:val="008D12FB"/><w:rPr><w:vertAlign w:val="superscript"/></w:rPr></w:style>'
251
+ ].each do |new_style|
252
+ styles.children.first << Nokogiri::XML.parse(new_style).child
253
+ end
254
+ [ '<w:lsdException w:name="footnote text" w:semiHidden="1" w:unhideWhenUsed="1"/>',
255
+ '<w:lsdException w:name="footnote reference" w:semiHidden="1" w:unhideWhenUsed="1"/>'
256
+ ].each do |new_latent_style|
257
+ styles.xpath("/w:styles/w:latentStyles").first << Nokogiri::XML.parse(new_latent_style).child
258
+ end
259
+ @replaceable_files["word/styles.xml"] = styles.to_xml
260
+
261
+ # content type
262
+ Zip::File.open(@template_path) do |zipfile|
263
+ types = Nokogiri::XML.parse(zipfile.read("[Content_Types].xml"))
264
+ [ # '<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>',
265
+ '<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>'
266
+ ].each do |new_type|
267
+ types.children.first << Nokogiri::XML.parse(new_type).child
268
+ end
269
+ @replaceable_files["[Content_Types].xml"] = types.to_xml
270
+ end
220
271
  end
221
272
 
222
273
  def inject_image_relations(relations, noko_html_source)
@@ -1,3 +1,3 @@
1
1
  module Avv2word
2
- VERSION = '1.1.21'
2
+ VERSION = '1.1.22'
3
3
  end
@@ -15,7 +15,6 @@
15
15
  xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
16
16
  xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
17
17
  mc:Ignorable="w14 wp14">
18
-
19
18
  <xsl:template match="footnote">
20
19
  <xsl:number level="any" count="footnote" format="1"/>
21
20
  <w:r>
@@ -23,7 +22,6 @@
23
22
  <w:rStyle w:val="FootnoteReference"/>
24
23
  </w:rPr>
25
24
  <w:footnoteReference w:id="{format-number(count(preceding::footnote)+1,'0')}"/>
26
- <xsl:apply-templates select="@*|node()"/>
27
25
  </w:r>
28
26
  </xsl:template>
29
27
  </xsl:stylesheet>
@@ -74,6 +74,7 @@
74
74
  <xsl:with-param name="hanging" select="@hanging"/>
75
75
  <xsl:with-param name="style-format" select="@style-format"/>
76
76
  <xsl:with-param name="indented-first" select="@indented-first"/>
77
+ <xsl:with-param name="data-start" select="@data-start"/>
77
78
  </xsl:call-template>
78
79
  <xsl:call-template name="item"/>
79
80
  </w:abstractNum>
@@ -86,6 +87,7 @@
86
87
  <xsl:with-param name="hanging" select="@hanging"/>
87
88
  <xsl:with-param name="style-format" select="@style-format"/>
88
89
  <xsl:with-param name="indented-first" select="@indented-first"/>
90
+ <xsl:with-param name="data-start" select="@data-start"/>
89
91
  </xsl:call-template>
90
92
  <xsl:call-template name="item"/>
91
93
  </xsl:when>
@@ -121,8 +123,9 @@
121
123
  <xsl:param name="hanging" />
122
124
  <xsl:param name="style-format" />
123
125
  <xsl:param name="indented-first" />
126
+ <xsl:param name="data-start"/>
124
127
  <w:lvl w:ilvl="{$ilvl}">
125
- <w:start w:val="1"/>
128
+ <w:start w:val="{$data-start}"/>
126
129
  <w:numFmt w:val="{func:substring-before-if-contains($style, ',')}"/>
127
130
  <w:lvlText w:val="{$style-format}"/>
128
131
  <w:lvlJc w:val="left"/>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avv2word
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.21
4
+ version: 1.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marián Bilas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-12 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack