docx 0.2.0 → 0.2.01

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWNiNjA4ZjliOGU1MTQxZjdhNjhmYmU4OWQxMzkyMDM2MzMxOTI4Ng==
4
+ Mjc5ZDY4NzcyOGE5ZWUzZWMxZGI4ODFjMmFkOWRhNGY1YzNkMDM3Yw==
5
5
  data.tar.gz: !binary |-
6
- NTU2OWE0N2FkZWMzMmM4NDJkYjMwMTg0NTcyOWVhMmFlNGE4MTliZg==
6
+ N2I0ZjZlMjUxMjI5ZmQ4NTUwZThmY2FkNTkxYTQzYzdlNzZiMTg3Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OWJiMGQ5NmQ1OGFhYTdhODIyNzYyM2U4Yjk3NzQyMWY3YzUxNDZmOGY1NDAz
10
- MDZlMDFkM2I0MWM5MzFmNTM0NGEyNDlmZTQ3ZmI4Yzg3NzUyZDliMzlkY2Ri
11
- MzdiYmRhOTc0ZDhiYzg2ZGVmZTkzOTVhMTkwN2MzMDE4MDU4YjI=
9
+ MmFjYWIxZDYzMmFhOTVkNDEyZTQ1NjI2Zjc1NmUyNzZhYTc4YTVjNTM2OTM5
10
+ OTVlZWZlMDc5YTdmMDIwY2JhMzY5ZDY4NGQ4YTY1NTc1NjhlZDMwYTljNDAy
11
+ NDljMjc3YTEzNWNmMjNiNjUzZjI4ZmQ5ZjYxYmMwMDNmYjQzNTk=
12
12
  data.tar.gz: !binary |-
13
- NGMxZTdkMTQ3ODkxM2MyYTkyODAzZTRhMTQ1ZWU4NGU4MjI0Y2Y2MWM2Zjdj
14
- Y2IyMzc5NGMyNjRkYTNkM2VmYzY5ZjhkMTE4MjczNDNhYTEzMGJiMWEwNWZh
15
- NTBiZjkxMjc2MTQ2NDM1OTMzZjhiNGQ3ZGYxYTljNzNmZTQ0NmY=
13
+ MTVmMmM1ZDAyYWVkNjdjMDZmMDFjMjkwMTliNDllNWZjOWUyZGI5MWYyYjUz
14
+ ODdkMWRjNDAwYTgwNTg1MmNhN2ViNDYzNjI2MGM3NzE2NGQyMjUxMjBhZDdm
15
+ OTJiYzlhZjU3MWU5YjNhMDBkMzg2ZjNlZjg2MzM1OGM1MzNjNjQ=
Binary file
@@ -0,0 +1 @@
1
+ ��"��'�8�~�K�M9f{�.��Uߍ+e� ��t qIkrL2a�GH�1���ByO ܟ�������e�����-FV�*��)yv�C$T����<Ʉ�λ�%z."���\i��'z�K��L*
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # docx
2
2
 
3
- a ruby library/gem for interacting with `.docx` files
3
+ a ruby library/gem for interacting with `.docx` files. currently capabilities include reading paragraphs/bookmarks, inserting text at bookmarks, and saving the document.
4
4
 
5
5
  ## usage
6
6
 
@@ -10,15 +10,33 @@ requires ruby (only tested with 1.9.3 so far)
10
10
 
11
11
  gem install docx
12
12
 
13
- ### basic
13
+ ### reading
14
14
 
15
15
  ``` ruby
16
16
  require 'docx'
17
17
 
18
18
  d = Docx::Document.open('example.docx')
19
- d.each_paragraph do |p|
19
+ # Array of paragraphs
20
+ d.paragraphs.each do |p|
20
21
  puts d
21
22
  end
23
+
24
+ # Hash of Bookmarks. Bookmark names as keys correspond to bookmark objects.
25
+ d.bookmarks.each_pair do |bookmark_name, bookmark_object|
26
+ puts bookmark_name
27
+ end
28
+ ```
29
+
30
+ ### writing
31
+
32
+ ``` ruby
33
+ require 'docx'
34
+
35
+ d = Docx::Document.open('example.docx')
36
+ # Insert a single line after a bookmark
37
+ d.bookmarks['example_bookmark'].insert_after("Hello world.")
38
+ # Each value in array is put on a separate line
39
+ d.bookmarks['example_bookmark'].insert_multiple_lines_after(['Hello', 'World', 'foo'])
22
40
  ```
23
41
 
24
42
  ### advanced
@@ -27,15 +45,16 @@ end
27
45
  require 'docx'
28
46
 
29
47
  d = Docx::Document.open('example.docx')
30
- d.each_paragraph do |p|
31
- p.each_text_run do |run|
32
- run.italicized?
33
- run.bolded?
34
- run.underlined?
35
- run.formatting
36
- run.text
37
- end
48
+
49
+ # The Nokogiri node on which an element is based can be accessed using #node
50
+ d.paragraphs.each do |p|
51
+ puts p.node.inspect
38
52
  end
53
+
54
+ # The #xpath and #at_xpath are delegated to the node from the element, saving a step
55
+ p_element = d.paragraphs.first
56
+ p_children = p_element.xpath("//child::*") # selects all children
57
+ p_child = p_element.at_xpath("//child::*") # selects first child
39
58
  ```
40
59
 
41
60
  ## Development
@@ -1,3 +1,3 @@
1
1
  module Docx
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.01'
3
3
  end
metadata CHANGED
@@ -1,14 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.01
5
5
  platform: ruby
6
6
  authors:
7
+ - Christopher Hunt
7
8
  - Marcus Ortiz
8
9
  autorequire:
9
10
  bindir: bin
10
- cert_chain: []
11
- date: 2013-04-15 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURjRENDQWxpZ0F3SUJB
14
+ Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREEvTVJFd0R3WURWUVFEREFoamFI
15
+ SmgKYUhWdWRERVZNQk1HQ2dtU0pvbVQ4aXhrQVJrV0JXZHRZV2xzTVJNd0VR
16
+ WUtDWkltaVpQeUxHUUJHUllEWTI5dApNQjRYRFRFek1EUXhOVEl3TURFeU4x
17
+ b1hEVEUwTURReE5USXdNREV5TjFvd1B6RVJNQThHQTFVRUF3d0lZMmh5CllX
18
+ aDFiblF4RlRBVEJnb0praWFKay9Jc1pBRVpGZ1ZuYldGcGJERVRNQkVHQ2dt
19
+ U0pvbVQ4aXhrQVJrV0EyTnYKYlRDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFB
20
+ RGdnRVBBREND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HV0h4ekNNMHpIdU5OWEJsQTdnRWQyNFAKQ0llcEtTdnlwQUdP
37
+ ckhRbGdpOTNPbkxEWjdKa3pCMk1wcDA0em5NSllQOGZIdGJCTkE2bFUxL2tK
38
+ NEV0UFhmRQpLdFE1SGpuNFVDNTg0R0pyR01haFVnbXhMbmZleXVZWXVZTlFF
39
+ M1VzVlVQYXl6eGtQVW9DOFZzT0orV1ZmMnMrCkcxL1VkNGRVYkVtOGdRL2J4
40
+ bDM1TzBBdkhCcz0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
41
+ date: 2013-04-16 00:00:00.000000000 Z
12
42
  dependencies:
13
43
  - !ruby/object:Gem::Dependency
14
44
  name: nokogiri
@@ -39,7 +69,8 @@ dependencies:
39
69
  - !ruby/object:Gem::Version
40
70
  version: '0.9'
41
71
  description: a ruby library/gem for interacting with .docx files
42
- email: mportiz08@gmail.com
72
+ email:
73
+ - chrahunt@gmail.com
43
74
  executables: []
44
75
  extensions: []
45
76
  extra_rdoc_files: []
@@ -60,7 +91,7 @@ files:
60
91
  - lib/docx/test.rb
61
92
  - lib/docx/version.rb
62
93
  - lib/docx.rb
63
- homepage: https://github.com/mportiz08/docx
94
+ homepage: https://github.com/chrahunt/docx
64
95
  licenses: []
65
96
  metadata: {}
66
97
  post_install_message:
@@ -0,0 +1,2 @@
1
+ R�e�\��J~�.M�W.9U�:�@
2
+ �$�����v��� C��+�I��(����ɾ�Z��p��h_�ߚ�O���<�^r�F�G�U�i�<%4-�띾=��B��{����.�)�4 e�x 9�?7�m3�ڌ��R�W�\�n�d�����D���y`=�q��kꝁ/%ԝ*ۚ��\��;��Q <������/-&H}�fG6�wb�)DU5�H���f0d<})�'��d�� ��|�t ��M)���2�