mymedia-kvx 0.1.1 → 0.2.0

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: 80fe7282ed1c15eea7ea49965b3112637d416dac
4
- data.tar.gz: 7ea18618228eba66d5ef7a2cbd8711a0e40db0b8
3
+ metadata.gz: 607dfe595e27693b8ecb3f4660ca1da1441eee67
4
+ data.tar.gz: 8f685ec20d5d2ceccf63e185a6981138fd3131c3
5
5
  SHA512:
6
- metadata.gz: 16e38c79a300a2f24f10c6d7c939ff2551b0b18755006f4535bfe923cd1be2ee5aeaa874dc9c5737b9b0a91fa690c73e4e3fbeac953cbc2a3fad7875eca97210
7
- data.tar.gz: 6ca423d73434ea93b5bc13e0c949a4c6c1fa42f221f0c0e46b4d0597f632acd9385c710965be938977565e26aa3e7cf35ae2380ab6a5c89c1a2de27e4fbe32d1
6
+ metadata.gz: 882295d9cdc0a0264df79ab262c86d8874d58b6b971ac9ac6a0af4c7d39514b5bd18ba145d0637e12cfb146ab0a5e4b5dfe2eb69cb66aeef72c41fbe07f891be
7
+ data.tar.gz: 7d82e1e554947658c1295140096a0857f15d7ec552ec70665e12167e7336f4b2d6fd13f1399ba25f771eacef6ca303654e2e184d66df9d7e3c0ff131eebd1df6
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/mymedia-kvx.rb CHANGED
@@ -17,7 +17,7 @@ class MyMediaKvx < MyMedia::Base
17
17
 
18
18
  @media_src = "%s/media/%s" % [@home, public_type]
19
19
  @prefix = 'k'
20
- @target_ext = '.xml'
20
+ @target_ext = '.html'
21
21
 
22
22
  @media_type = media_type
23
23
  @ext = ext
@@ -33,6 +33,9 @@ class MyMediaKvx < MyMedia::Base
33
33
  raise "file not found : " + src_path unless File.exists? src_path
34
34
 
35
35
  file_publish(src_path, raw_msg) do |destination, raw_destination|
36
+
37
+ raw_dest_xml = raw_destination.sub(/html$/,'xml')
38
+ dest_xml = destination.sub(/html$/,'xml')
36
39
 
37
40
  if not raw_msg or raw_msg.empty? then
38
41
  raw_msg = File.basename(src_path) + " updated: " + Time.now.to_s
@@ -40,8 +43,8 @@ class MyMediaKvx < MyMedia::Base
40
43
 
41
44
  if File.extname(src_path) == '.txt' then
42
45
 
43
- kvx, raw_msg = copy_edit(src_path, destination)
44
- copy_edit(src_path, raw_destination)
46
+ kvx, raw_msg = copy_edit(src_path, dest_xml)
47
+ copy_edit(src_path, raw_dest_xml)
45
48
 
46
49
  else
47
50
 
@@ -50,9 +53,14 @@ class MyMediaKvx < MyMedia::Base
50
53
 
51
54
  kvx.summary[:original_source] = File.basename(src_path)
52
55
 
53
- File.write destination, kvx.to_s
56
+ File.write dest_xml, kvx.to_s
54
57
 
55
58
  end
59
+
60
+ # transform the XML to an HTML file
61
+
62
+ File.write raw_destination, xsltproc("#{@home}/r/xsl/#{@public_type}.xsl", raw_dest_xml)
63
+ File.write destination, xsltproc("#{@home}/#{@www}/xsl/#{@public_type}.xsl", dest_xml)
56
64
 
57
65
  if not File.basename(src_path)[/#{@prefix}\d{6}T\d{4}\.txt/] then
58
66
 
@@ -106,4 +114,10 @@ class MyMediaKvx < MyMedia::Base
106
114
  [kvx, raw_msg]
107
115
  end
108
116
 
117
+ def xsltproc(xslpath, xmlpath)
118
+
119
+ Nokogiri::XSLT(File.open(xslpath))\
120
+ .transform(Nokogiri::XML(File.open(xmlpath))).to_xhtml(indent: 0)
121
+ end
122
+
109
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mymedia-kvx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- (����<t�c`1__h*��v������b_����� ������D���MdzSB22햁M���йbbF�������c��jc���<Nr]�-X43;6;��`�@^"���\Q5y��{��xfw��, .��h _ Vi�<o�&~8��z���˺��4�We[��Ә(7���-����pq�@sI��);*�u,�)1�"a��?��yB����5r��U�Gv�E_Q,��h�.�lR ������P���
1
+ Z��ѧ��f|Ыv_k��L�*��F8J���D]&�=WKd]����>�$���p{i|hLu�^�/0���bk^`gN��4���rc�,v3���64qg�ŕ���V��$��A�:��E��V���9��I�:���2��5y���k�%�/�e�.��R|/t��NN�%B`�j�Q{4�P���Z�7�b
2
+ �8���