htmltoword 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Htmltoword
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -132,6 +132,9 @@
132
132
  </xsl:template>
133
133
 
134
134
  <xsl:template match="span[contains(concat(' ', @class, ' '), ' h ')]">
135
+ <xsl:comment>
136
+ This template adds MS Word highlighting ability.
137
+ </xsl:comment>
135
138
  <xsl:variable name="color">
136
139
  <xsl:choose>
137
140
  <xsl:when test="./@data-style='pink'">magenta</xsl:when>
@@ -140,12 +143,26 @@
140
143
  <xsl:otherwise><xsl:value-of select="./@data-style"/></xsl:otherwise>
141
144
  </xsl:choose>
142
145
  </xsl:variable>
143
- <w:r>
144
- <w:rPr>
145
- <w:highlight w:val="{$color}"/>
146
- </w:rPr>
147
- <w:t xml:space="preserve"><xsl:value-of select="."/></w:t>
148
- </w:r>
146
+ <xsl:choose>
147
+ <xsl:when test="preceding-sibling::h1 or preceding-sibling::h2 or preceding-sibling::h3 or preceding-sibling::h4 or preceding-sibling::h5 or preceding-sibling::h6 or preceding-sibling::table or preceding-sibling::p or preceding-sibling::ol or preceding-sibling::ul or preceding-sibling::div or following-sibling::h1 or following-sibling::h2 or following-sibling::h3 or following-sibling::h4 or following-sibling::h5 or following-sibling::h6 or following-sibling::table or following-sibling::p or following-sibling::ol or following-sibling::ul or following-sibling::div">
148
+ <w:p>
149
+ <w:r>
150
+ <w:rPr>
151
+ <w:highlight w:val="{$color}"/>
152
+ </w:rPr>
153
+ <w:t xml:space="preserve"><xsl:value-of select="."/></w:t>
154
+ </w:r>
155
+ </w:p>
156
+ </xsl:when>
157
+ <xsl:otherwise>
158
+ <w:r>
159
+ <w:rPr>
160
+ <w:highlight w:val="{$color}"/>
161
+ </w:rPr>
162
+ <w:t xml:space="preserve"><xsl:value-of select="."/></w:t>
163
+ </w:r>
164
+ </xsl:otherwise>
165
+ </xsl:choose>
149
166
  </xsl:template>
150
167
 
151
168
  <xsl:template match="div[contains(concat(' ', @class, ' '), ' -page-break ')]">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmltoword
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-16 00:00:00.000000000 Z
12
+ date: 2013-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack