wordpress-exporter 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +13 -5
- data/lib/version.rb +1 -1
- data/lib/wordpress/author.rb +71 -0
- data/lib/wordpress/blog.rb +13 -2
- data/lib/wordpress/export.rb +2 -0
- data/lib/wordpress/post.rb +12 -3
- data/lib/wordpress/post_author.rb +36 -0
- data/spec/fixtures/blog/entries/author/author_10.json +8 -0
- data/spec/fixtures/blog/entries/author/author_12.json +8 -0
- data/spec/fixtures/blog/entries/blog/blog_1.json +10 -0
- data/spec/fixtures/blog/entries/post/post_1.json +5 -1
- data/spec/fixtures/blog/entries/post/post_11.json +4 -0
- data/spec/fixtures/blog/entries/post/post_15.json +4 -0
- data/spec/fixtures/blog/entries/post/post_21.json +4 -0
- data/spec/fixtures/blog/entries/post/post_3.json +4 -0
- data/spec/fixtures/blog/entries/post/post_5.json +4 -0
- data/spec/fixtures/blog/entries/post/post_9.json +4 -0
- data/spec/fixtures/default_contentful_structure.json +24 -0
- data/spec/fixtures/wordpress.xml +11 -2
- data/spec/fixtures/wordpress_empty_dates.xml +121 -0
- data/spec/lib/wordpress/author_spec.rb +54 -0
- data/spec/lib/wordpress/blog_spec.rb +3 -1
- data/spec/lib/wordpress/export_spec.rb +1 -1
- data/spec/lib/wordpress/post_author_spec.rb +31 -0
- data/spec/lib/wordpress/post_spec.rb +30 -8
- data/wordpress_settings/default_contentful_structure.json +24 -0
- data/wordpress_settings/export_wordpress.xml +31 -22
- data/wordpress_settings/wordpress.xml +11 -2
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee68a654298d0158da2be565889e5680138568ad
|
4
|
+
data.tar.gz: 4c944aa69d14a895595a81e1e0bb382aabd759f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a591a8207f98c063f6d36cd0ba4cd665b9c5554331fb9e698e25df56eb7af8d69f9de3e4a6781ff224291b6c6e9eceaaaa55333ff78ea0eea0924e889281ce
|
7
|
+
data.tar.gz: 4ff0a030e6f3f8cbe0299a6320a990ea4133f3498e680d5359a52411f50f1ec284b81f1e493d5fc8aa4474280f30480ab0eb0f04da40784313cb881f190008cd
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
3
|
+
## Master
|
4
|
+
|
5
|
+
## 0.1.0
|
6
|
+
### Fixed
|
7
|
+
* Posts without `wp:post_date` or `wp:post_date_gmt` now get defaulted to `Date.today` instead of throwing an error [#8](https://github.com/contentful/wordpress-exporter.rb/issues/8)
|
8
|
+
|
9
|
+
### Added
|
10
|
+
* Author Extraction [#10](https://github.com/contentful/wordpress-exporter.rb/pull/10)
|
11
|
+
|
12
|
+
|
2
13
|
## 0.0.2
|
3
14
|
### Fixed
|
4
15
|
* Issues with `attachment_description`
|
5
16
|
|
17
|
+
|
6
18
|
## 0.0.1
|
7
19
|
### Other
|
8
20
|
* Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wordpress-exporter (0.0.
|
4
|
+
wordpress-exporter (0.0.2)
|
5
5
|
activesupport (~> 4.1)
|
6
6
|
escort (~> 0.4.0)
|
7
7
|
http (~> 0.6)
|
@@ -13,7 +13,7 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activesupport (4.2.
|
16
|
+
activesupport (4.2.4)
|
17
17
|
i18n (~> 0.7)
|
18
18
|
json (~> 1.7, >= 1.7.7)
|
19
19
|
minitest (~> 5.1)
|
@@ -22,19 +22,24 @@ GEM
|
|
22
22
|
addressable (2.3.8)
|
23
23
|
diff-lcs (1.2.5)
|
24
24
|
docile (1.1.5)
|
25
|
+
domain_name (0.5.25)
|
26
|
+
unf (>= 0.0.5, < 1.0.0)
|
25
27
|
escort (0.4.0)
|
26
28
|
nesty
|
27
|
-
http (0.8
|
29
|
+
http (0.9.8)
|
28
30
|
addressable (~> 2.3)
|
31
|
+
http-cookie (~> 1.0)
|
29
32
|
http-form_data (~> 1.0.1)
|
30
33
|
http_parser.rb (~> 0.6.0)
|
34
|
+
http-cookie (1.0.2)
|
35
|
+
domain_name (~> 0.5)
|
31
36
|
http-form_data (1.0.1)
|
32
37
|
http_parser.rb (0.6.0)
|
33
38
|
i18n (0.7.0)
|
34
39
|
json (1.8.2)
|
35
40
|
mini_portile (0.6.0)
|
36
|
-
minitest (5.
|
37
|
-
multi_json (1.11.
|
41
|
+
minitest (5.8.1)
|
42
|
+
multi_json (1.11.2)
|
38
43
|
nesty (1.0.2)
|
39
44
|
nokogiri (1.6.3.1)
|
40
45
|
mini_portile (= 0.6.0)
|
@@ -65,6 +70,9 @@ GEM
|
|
65
70
|
thread_safe (0.3.5)
|
66
71
|
tzinfo (1.2.2)
|
67
72
|
thread_safe (~> 0.1)
|
73
|
+
unf (0.1.4)
|
74
|
+
unf_ext
|
75
|
+
unf_ext (0.0.7.1)
|
68
76
|
|
69
77
|
PLATFORMS
|
70
78
|
ruby
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative 'blog'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Exporter
|
5
|
+
module Wordpress
|
6
|
+
class Author < Blog
|
7
|
+
attr_reader :xml, :settings
|
8
|
+
|
9
|
+
def initialize(xml, settings)
|
10
|
+
@xml = xml
|
11
|
+
@settings = settings
|
12
|
+
end
|
13
|
+
|
14
|
+
def author_extractor
|
15
|
+
output_logger.info 'Extracting authors...'
|
16
|
+
create_directory("#{settings.entries_dir}/author")
|
17
|
+
extract_authors
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def extract_authors
|
23
|
+
authors.each_with_object([]) do |author, authors|
|
24
|
+
normalized_author = extracted_data(author)
|
25
|
+
write_json_to_file("#{settings.entries_dir}/author/#{id(author)}.json", normalized_author)
|
26
|
+
authors << normalized_author
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def extracted_data(author)
|
31
|
+
{
|
32
|
+
id: id(author),
|
33
|
+
email: email(author),
|
34
|
+
display_name: display_name(author),
|
35
|
+
first_name: first_name(author),
|
36
|
+
last_name: last_name(author),
|
37
|
+
wordpress_login: login(author)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def authors
|
42
|
+
xml.xpath('//wp:author').to_a
|
43
|
+
end
|
44
|
+
|
45
|
+
def id(author)
|
46
|
+
"author_#{author.xpath('wp:author_id').text}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def login(author)
|
50
|
+
author.xpath('wp:author_login').text
|
51
|
+
end
|
52
|
+
|
53
|
+
def email(author)
|
54
|
+
author.xpath('wp:author_email').text
|
55
|
+
end
|
56
|
+
|
57
|
+
def display_name(author)
|
58
|
+
author.xpath('wp:author_display_name').text
|
59
|
+
end
|
60
|
+
|
61
|
+
def first_name(author)
|
62
|
+
author.xpath('wp:author_first_name').text
|
63
|
+
end
|
64
|
+
|
65
|
+
def last_name(author)
|
66
|
+
author.xpath('wp:author_last_name').text
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/wordpress/blog.rb
CHANGED
@@ -17,10 +17,16 @@ module Contentful
|
|
17
17
|
extract_blog
|
18
18
|
end
|
19
19
|
|
20
|
-
def link_entry(
|
21
|
-
|
20
|
+
def link_entry(entry_or_entries)
|
21
|
+
link = ->(entry) {
|
22
22
|
entry.keep_if { |key, _v| key if key == :id }
|
23
23
|
entry.merge!(type: 'Entry')
|
24
|
+
}
|
25
|
+
|
26
|
+
if entry_or_entries.is_a? Array
|
27
|
+
entry_or_entries.each(&link)
|
28
|
+
else
|
29
|
+
link.call(entry_or_entries)
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
@@ -56,12 +62,17 @@ module Contentful
|
|
56
62
|
{
|
57
63
|
id: 'blog_id',
|
58
64
|
title: title,
|
65
|
+
authors: link_entry(authors),
|
59
66
|
posts: link_entry(posts),
|
60
67
|
categories: link_entry(categories),
|
61
68
|
tags: link_entry(tags)
|
62
69
|
}
|
63
70
|
end
|
64
71
|
|
72
|
+
def authors
|
73
|
+
Author.new(xml, settings).author_extractor
|
74
|
+
end
|
75
|
+
|
65
76
|
def posts
|
66
77
|
Post.new(xml, settings).post_extractor
|
67
78
|
end
|
data/lib/wordpress/export.rb
CHANGED
@@ -4,11 +4,13 @@ require 'fileutils'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
require_relative 'blog'
|
7
|
+
require_relative 'author'
|
7
8
|
require_relative 'post'
|
8
9
|
require_relative 'category'
|
9
10
|
require_relative 'tag'
|
10
11
|
require_relative 'post_category_domain'
|
11
12
|
require_relative 'post_attachment'
|
13
|
+
require_relative 'post_author'
|
12
14
|
|
13
15
|
module Contentful
|
14
16
|
module Exporter
|
data/lib/wordpress/post.rb
CHANGED
@@ -45,6 +45,10 @@ module Contentful
|
|
45
45
|
PostAttachment.new(xml_post, settings).attachment_extractor
|
46
46
|
end
|
47
47
|
|
48
|
+
def author(xml_post)
|
49
|
+
PostAuthor.new(xml, xml_post, settings).author_extractor
|
50
|
+
end
|
51
|
+
|
48
52
|
def tags(xml_post)
|
49
53
|
PostCategoryDomain.new(xml, xml_post, settings).extract_tags
|
50
54
|
end
|
@@ -54,13 +58,12 @@ module Contentful
|
|
54
58
|
end
|
55
59
|
|
56
60
|
def basic_post_data(xml_post)
|
57
|
-
created = Date.strptime(created_at(xml_post))
|
58
61
|
{
|
59
62
|
id: post_id(xml_post),
|
60
63
|
title: title(xml_post),
|
61
64
|
wordpress_url: url(xml_post),
|
62
65
|
content: content(xml_post),
|
63
|
-
created_at:
|
66
|
+
created_at: created_at(xml_post)
|
64
67
|
}
|
65
68
|
end
|
66
69
|
|
@@ -68,6 +71,7 @@ module Contentful
|
|
68
71
|
attachment = attachment(xml_post)
|
69
72
|
tags = link_entry(tags(xml_post))
|
70
73
|
categories = link_entry(categories(xml_post))
|
74
|
+
post_entry.merge!(author: link_entry(author(xml_post)))
|
71
75
|
post_entry.merge!(attachment: link_asset(attachment)) unless attachment.nil?
|
72
76
|
post_entry.merge!(tags: tags) unless tags.empty?
|
73
77
|
post_entry.merge!(categories: categories) unless categories.empty?
|
@@ -86,7 +90,12 @@ module Contentful
|
|
86
90
|
end
|
87
91
|
|
88
92
|
def created_at(xml_post)
|
89
|
-
|
93
|
+
['wp:post_date', 'wp:post_date_gmt'].each do |date_field|
|
94
|
+
date_string = xml_post.xpath(date_field).text
|
95
|
+
return Date.strptime(date_string) unless date_string.empty?
|
96
|
+
end
|
97
|
+
output_logger.warn "Post <#{post_id(xml_post)}> didn't have Creation Date - defaulting to #{Date.today}"
|
98
|
+
Date.today
|
90
99
|
end
|
91
100
|
end
|
92
101
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative 'post'
|
2
|
+
|
3
|
+
module Contentful
|
4
|
+
module Exporter
|
5
|
+
module Wordpress
|
6
|
+
class PostAuthor < Post
|
7
|
+
attr_reader :post, :xml, :settings
|
8
|
+
|
9
|
+
def initialize(xml, post, settings)
|
10
|
+
@xml = xml
|
11
|
+
@post = post
|
12
|
+
@settings = settings
|
13
|
+
end
|
14
|
+
|
15
|
+
def author_extractor
|
16
|
+
output_logger.info 'Extracting post author...'
|
17
|
+
{ id: author_id }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def author_id
|
23
|
+
"author_#{author_id_by_login(author_login)}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def author_id_by_login(login)
|
27
|
+
xml.xpath("//wp:author[wp:author_login=\"#{login}\"]/wp:author_id").text
|
28
|
+
end
|
29
|
+
|
30
|
+
def author_login
|
31
|
+
post.at_xpath('dc:creator').text
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -3,5 +3,9 @@
|
|
3
3
|
"title": "Informacje",
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/informacje/",
|
5
5
|
"content": "This is an example of a page. Unlike posts, which are displayed on your blog’s front page in the order they’re published, pages are better suited for more timeless content that you want to be easily accessible, like your About or Contact information. Click the Edit link to make changes to this page or <a title=\"Direct link to Add New in the Admin Dashboard\" href=\"/wp-admin/post-new.php?post_type=page\">add another page</a>.",
|
6
|
-
"created_at": "2014-11-26"
|
6
|
+
"created_at": "2014-11-26",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
}
|
7
11
|
}
|
@@ -4,6 +4,10 @@
|
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/2014/11/26/wpis-numer-dwa-2/",
|
5
5
|
"content": "[caption id=\"\" align=\"alignnone\" width=\"500\"]<a href=\"http://www.mojegotowanie.pl/var/self/storage/images/media/images/artykuly/pigwa/1961757-1-pol-PL/pigwa_popup.jpg\"><img class=\"\" src=\"http://www.mojegotowanie.pl/var/self/storage/images/media/images/artykuly/pigwa/1961757-1-pol-PL/pigwa_popup.jpg\" alt=\"piwa alter tekscik\" width=\"500\" height=\"366\" /></a> pigwy etykieta[/caption]\n<h1 class=\"entry-title\" style=\"text-align:center;\"> tekst wpis numer dwa content /2222</h1>",
|
6
6
|
"created_at": "2014-11-26",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
},
|
7
11
|
"tags": [
|
8
12
|
{
|
9
13
|
"id": "tag_2656354",
|
@@ -4,6 +4,10 @@
|
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/2014/11/26/wpis-numer-dwa-2/screen-shot-2014-11-27-at-12-34-47-pm/#main",
|
5
5
|
"content": "opis opis",
|
6
6
|
"created_at": "2014-11-27",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
},
|
7
11
|
"attachment": {
|
8
12
|
"id": "attachment_post_15",
|
9
13
|
"type": "File"
|
@@ -4,6 +4,10 @@
|
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/2014/11/26/wpis-numer-dwa/screen-shot-2014-11-27-at-12-34-47-pm-2/#main",
|
5
5
|
"content": "",
|
6
6
|
"created_at": "2014-11-27",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
},
|
7
11
|
"attachment": {
|
8
12
|
"id": "attachment_post_21",
|
9
13
|
"type": "File"
|
@@ -4,6 +4,10 @@
|
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/2014/11/26/pierwszy-wpis/",
|
5
5
|
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit lacinia dui, vitae venenatis elit adipiscing at. Pellentesque blandit eros quis magna <a href=\"http://www.dropstore.pl/\">gravida et semper</a> turpis bibendum. Donec tristique velit ac lectus luctus a porttitor felis hendrerit. Sed feugiat mi id quam molestie sollicitudin. In rhoncus congue turpis, a iaculis est vehicula ut. Ut fermentum nunc eget augue posuere lacinia. In fermentum nunc et felis scelerisque bibendum. In hac habitasse platea dictumst. Fusce cursus vulput\n\n<hr />\n\nate velit non pulvinar. Sed lacinia adipiscing erat, nec fringilla ante aliquam sit amet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque rutrum suscipit auctor. Donec accumsan egestas magna accumsan iaculis. Sed sagittis velit ac ipsum dignissim vestibulum. Donec elementum quam vel diam consequat commodo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis massa odio, ultricies ornare sagittis et, imperdiet quis dui. Phasellus faucibus auctor porttitor. Vestibulum ac nulla diam, id dignissim erat. Nulla facilisi. Nam volutpat eleifend mauris, ac pretium eros bibendum eget. Morbi nec nulla risus, non ultrices velit. Pellentesque et neque leo, id vestibulum velit. Integer mauris mi, semper et porttitor eu, dictum vel quam. Morbi ultrices erat eu ante tempus lacinia. Phasellus rhoncus consectetur fermentum. Praesent eget ante metus, vel dictum diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla blandit velit tortor, sit amet dapibus sapien. Phasellus dictum facilisis mauris, convallis placerat turpis tincidunt ac. Maecenas dapibus nisl in metus ornare ac ornare massa dapibus. Nam ut pretium felis. Donec lobortis, urna eget sodales elementum, lectus turpis ullamcorper ipsum, eu imperdiet sem massa a quam. Ut rutrum, neque sed dictum interdum, sapien augue tincidunt nunc, id mollis felis turpis a mi. Mauris tur\n\npis sapien, imperdiet eget mollis eu, rutrum ut lacus. Nam laoreet nisi quis ligula consequat mollis. Ut sed dolor at mi adipiscing egestas. Aenean ultrices molestie leo eget hendrerit. Duis pharetra neque molestie velit pretium aliquam. Praesent convallis, libero vel tincidunt eleifend, libero orci tristique urna, sed vestibulum quam magna id sem. Proin adipiscing varius malesuada. Aenean condimentum, sem vitae mattis imperdiet, lacus nunc mattis nulla, iaculis fringilla sem turpis quis felis. Donec tempus tellus aliquam metus ornare eleifend. Nullam non dui quis velit suscipit pulvinar eu a elit. In nisl erat, ultrices non blandit quis, vestibulum vitae dolor. Nam nisl lacus, rutrum eu pharetra eu, venenatis et leo. Etiam eget orci arcu.\n\nQuisque sit amet feugiat dolor. Quisque porta dictum tellus sed faucibus. Donec hendrerit velit vel neque vehicula hendrerit. Mauris pulvinar condimentum massa, a molestie nibh malesuada vel. Nulla sit amet turpis eget augue iaculis cursus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.",
|
6
6
|
"created_at": "2014-11-26",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
},
|
7
11
|
"categories": [
|
8
12
|
{
|
9
13
|
"id": "category_14786",
|
@@ -4,6 +4,10 @@
|
|
4
4
|
"wordpress_url": "http://szpryc.wordpress.com/2014/11/26/wpis-numer-dwa/",
|
5
5
|
"content": "22Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit lacinia dui, vitae venenatis elit adipiscing at. Pellentesque blandit eros quis magna <a href=\"http://www.dropstore.pl/\">gravida et semper</a> turpis bibendum. Donec tristique velit ac lectus luctus a porttitor felis hendrerit. Sed feugiat mi id quam molestie sollicitudin. In rhoncus congue turpis, a iaculis est vehicula ut. Ut fermentum nunc eget augue posuere lacinia. In fermentum nunc et felis scelerisque bibendum. In hac habitasse platea dictumst. Fusce cursus vulput\n\n<hr />\n\nate velit non pulvinar. Sed lacinia adipiscing erat, nec fringilla ante aliquam sit amet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque rutrum suscipit auctor. Donec accumsan egestas magna accumsan iaculis. Sed sagittis velit ac ipsum dignissim vestibulum. Donec elementum quam vel diam consequat commodo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis massa odio, ultricies ornare sagittis et, imperdiet quis dui. Phasellus faucibus auctor porttitor. Vestibulum ac nulla diam, id dignissim erat. Nulla facilisi. Nam volutpat eleifend mauris, ac pretium eros bibendum eget. Morbi nec nulla risus, non ultrices velit. Pellentesque et neque leo, id vestibulum velit. Integer mauris mi, semper et porttitor eu, dictum vel quam. Morbi ultrices erat eu ante tempus lacinia. Phasellus rhoncus consectetur fermentum. Praesent eget ante metus, vel dictum diam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nulla blandit velit tortor, sit amet dapibus sapien. Phasellus dictum facilisis mauris, convallis placerat turpis tincidunt ac. Maecenas dapibus nisl in metus ornare ac ornare massa dapibus. Nam ut pretium felis. Donec lobortis, urna eget sodales elementum, lectus turpis ullamcorper ipsum, eu imperdiet sem massa a quam. Ut rutrum, neque sed dictum interdum, sapien augue tincidunt nunc, id mollis felis turpis a mi. Mauris tur\n\npis sapien, imperdiet eget mollis eu, rutrum ut lacus. Nam laoreet nisi quis ligula consequat mollis. Ut sed dolor at mi adipiscing egestas. Aenean ultrices molestie leo eget hendrerit. Duis pharetra neque molestie velit pretium aliquam. Praesent convallis, libero vel tincidunt eleifend, libero orci tristique urna, sed vestibulum quam magna id sem. Proin adipiscing varius malesuada. Aenean condimentum, sem vitae mattis imperdiet, lacus nunc mattis nulla, iaculis fringilla sem turpis quis felis. Donec tempus tellus aliquam metus ornare eleifend. Nullam non dui quis velit suscipit pulvinar eu a elit. In nisl erat, ultrices non blandit quis, vestibulum vitae dolor. Nam nisl lacus, rutrum eu pharetra eu, venenatis et leo. Etiam eget orci arcu.\n\nQuisque sit amet feugiat dolor. Quisque porta dictum tellus sed faucibus. Donec hendrerit velit vel neque vehicula hendrerit. Mauris pulvinar condimentum massa, a molestie nibh malesuada vel. Nulla sit amet turpis eget augue iaculis cursus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.22",
|
6
6
|
"created_at": "2014-11-26",
|
7
|
+
"author": {
|
8
|
+
"id": "author_10",
|
9
|
+
"type": "Entry"
|
10
|
+
},
|
7
11
|
"categories": [
|
8
12
|
{
|
9
13
|
"id": "category_14786",
|
@@ -5,6 +5,12 @@
|
|
5
5
|
"description": null,
|
6
6
|
"displayField": "title",
|
7
7
|
"fields": {
|
8
|
+
"Authors": {
|
9
|
+
"id": "authors",
|
10
|
+
"type": "Array",
|
11
|
+
"link_type": "Entry",
|
12
|
+
"link": "Link"
|
13
|
+
},
|
8
14
|
"Posts": {
|
9
15
|
"id": "posts",
|
10
16
|
"type": "Array",
|
@@ -26,6 +32,19 @@
|
|
26
32
|
}
|
27
33
|
}
|
28
34
|
},
|
35
|
+
"Author": {
|
36
|
+
"id": "author",
|
37
|
+
"name": "Author",
|
38
|
+
"description": null,
|
39
|
+
"displayField": "display_name",
|
40
|
+
"fields": {
|
41
|
+
"email": "Text",
|
42
|
+
"display_name": "Text",
|
43
|
+
"first_name": "Text",
|
44
|
+
"last_name": "Text",
|
45
|
+
"wordpress_login": "Text"
|
46
|
+
}
|
47
|
+
},
|
29
48
|
"Tag": {
|
30
49
|
"id": "tag",
|
31
50
|
"name": "Tag",
|
@@ -44,6 +63,11 @@
|
|
44
63
|
"fields": {
|
45
64
|
"title": "Text",
|
46
65
|
"content": "Text",
|
66
|
+
"Author": {
|
67
|
+
"id": "author",
|
68
|
+
"type": "Link",
|
69
|
+
"link_type": "Entry"
|
70
|
+
},
|
47
71
|
"Tags": {
|
48
72
|
"id": "tags",
|
49
73
|
"type": "Array",
|
data/spec/fixtures/wordpress.xml
CHANGED
@@ -9,13 +9,22 @@
|
|
9
9
|
<wp:wxr_version>1.2</wp:wxr_version>
|
10
10
|
<wp:base_site_url>http://wordpress.com/</wp:base_site_url>
|
11
11
|
<wp:base_blog_url>http://szpryc.wordpress.com</wp:base_blog_url>
|
12
|
-
<wp:
|
12
|
+
<wp:author>
|
13
|
+
<wp:author_id>10</wp:author_id>
|
13
14
|
<wp:author_login>szpryc</wp:author_login>
|
14
15
|
<wp:author_email>komarpro@gmail.com</wp:author_email>
|
15
16
|
<wp:author_display_name><![CDATA[szpryc]]></wp:author_display_name>
|
16
17
|
<wp:author_first_name><![CDATA[]]></wp:author_first_name>
|
17
18
|
<wp:author_last_name><![CDATA[]]></wp:author_last_name>
|
18
|
-
</wp:
|
19
|
+
</wp:author>
|
20
|
+
<wp:author>
|
21
|
+
<wp:author_id>12</wp:author_id>
|
22
|
+
<wp:author_login>testytesterson</wp:author_login>
|
23
|
+
<wp:author_email>testy.testerson@gmail.com</wp:author_email>
|
24
|
+
<wp:author_display_name><![CDATA[Testy Testerson]]></wp:author_display_name>
|
25
|
+
<wp:author_first_name><![CDATA[Testy]]></wp:author_first_name>
|
26
|
+
<wp:author_last_name><![CDATA[Testerson]]></wp:author_last_name>
|
27
|
+
</wp:author>
|
19
28
|
<wp:category>
|
20
29
|
<wp:term_id>14786</wp:term_id>
|
21
30
|
<wp:category_nicename>bez-kategorii</wp:category_nicename>
|
@@ -0,0 +1,121 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/">
|
3
|
+
<channel>
|
4
|
+
<title>Moj blog 2</title>
|
5
|
+
<link>http://szpryc.wordpress.com</link>
|
6
|
+
<description/>
|
7
|
+
<pubDate>Mon, 01 Dec 2014 09:12:28 +0000</pubDate>
|
8
|
+
<language>pl</language>
|
9
|
+
<wp:wxr_version>1.2</wp:wxr_version>
|
10
|
+
<wp:base_site_url>http://wordpress.com/</wp:base_site_url>
|
11
|
+
<wp:base_blog_url>http://szpryc.wordpress.com</wp:base_blog_url>
|
12
|
+
<wp:author>
|
13
|
+
<wp:author_id>10</wp:author_id>
|
14
|
+
<wp:author_login>szpryc</wp:author_login>
|
15
|
+
<wp:author_email>komarpro@gmail.com</wp:author_email>
|
16
|
+
<wp:author_display_name><![CDATA[szpryc]]></wp:author_display_name>
|
17
|
+
<wp:author_first_name><![CDATA[]]></wp:author_first_name>
|
18
|
+
<wp:author_last_name><![CDATA[]]></wp:author_last_name>
|
19
|
+
</wp:author>
|
20
|
+
<wp:author>
|
21
|
+
<wp:author_id>12</wp:author_id>
|
22
|
+
<wp:author_login>testytesterson</wp:author_login>
|
23
|
+
<wp:author_email>testy.testerson@gmail.com</wp:author_email>
|
24
|
+
<wp:author_display_name><![CDATA[Testy Testerson]]></wp:author_display_name>
|
25
|
+
<wp:author_first_name><![CDATA[Testy]]></wp:author_first_name>
|
26
|
+
<wp:author_last_name><![CDATA[Testerson]]></wp:author_last_name>
|
27
|
+
</wp:author>
|
28
|
+
<wp:category>
|
29
|
+
<wp:term_id>14786</wp:term_id>
|
30
|
+
<wp:category_nicename>bez-kategorii</wp:category_nicename>
|
31
|
+
<wp:category_parent/>
|
32
|
+
<wp:cat_name><![CDATA[Bez kategorii]]></wp:cat_name>
|
33
|
+
</wp:category>
|
34
|
+
<wp:category>
|
35
|
+
<wp:term_id>2214351</wp:term_id>
|
36
|
+
<wp:category_nicename>chatka</wp:category_nicename>
|
37
|
+
<wp:category_parent/>
|
38
|
+
<wp:cat_name><![CDATA[chatka]]></wp:cat_name>
|
39
|
+
</wp:category>
|
40
|
+
<wp:category>
|
41
|
+
<wp:term_id>8076</wp:term_id>
|
42
|
+
<wp:category_nicename>dom</wp:category_nicename>
|
43
|
+
<wp:category_parent/>
|
44
|
+
<wp:cat_name><![CDATA[dom]]></wp:cat_name>
|
45
|
+
</wp:category>
|
46
|
+
<wp:category>
|
47
|
+
<wp:term_id>11599757</wp:term_id>
|
48
|
+
<wp:category_nicename>puchatka</wp:category_nicename>
|
49
|
+
<wp:category_parent/>
|
50
|
+
<wp:cat_name><![CDATA[puchatka]]></wp:cat_name>
|
51
|
+
</wp:category>
|
52
|
+
<wp:tag>
|
53
|
+
<wp:term_id>2656354</wp:term_id>
|
54
|
+
<wp:tag_slug>testowy</wp:tag_slug>
|
55
|
+
<wp:tag_name><![CDATA[testowy]]></wp:tag_name>
|
56
|
+
</wp:tag>
|
57
|
+
<wp:tag>
|
58
|
+
<wp:term_id>306830130</wp:term_id>
|
59
|
+
<wp:tag_slug>testowy2</wp:tag_slug>
|
60
|
+
<wp:tag_name><![CDATA[testowy2]]></wp:tag_name>
|
61
|
+
</wp:tag>
|
62
|
+
<generator>http://wordpress.com/</generator>
|
63
|
+
<image>
|
64
|
+
<url>https://s2.wp.com/i/buttonw-com.png</url>
|
65
|
+
<title> » Moj blog 2</title>
|
66
|
+
<link>http://szpryc.wordpress.com</link>
|
67
|
+
</image>
|
68
|
+
<item>
|
69
|
+
<title>Informacje</title>
|
70
|
+
<link>http://szpryc.wordpress.com/informacje/</link>
|
71
|
+
<pubDate>Wed, 26 Nov 2014 11:49:06 +0000</pubDate>
|
72
|
+
<dc:creator>szpryc</dc:creator>
|
73
|
+
<guid isPermaLink="false">http://szpryc.wordpress.com/?page_id=1</guid>
|
74
|
+
<description/>
|
75
|
+
<content:encoded><![CDATA[This is an example of a page. Unlike posts, which are displayed on your blog’s front page in the order they’re published, pages are better suited for more timeless content that you want to be easily accessible, like your About or Contact information. Click the Edit link to make changes to this page or <a title="Direct link to Add New in the Admin Dashboard" href="/wp-admin/post-new.php?post_type=page">add another page</a>.]]></content:encoded>
|
76
|
+
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
|
77
|
+
<wp:post_id>1</wp:post_id>
|
78
|
+
<wp:post_date></wp:post_date>
|
79
|
+
<wp:post_date_gmt></wp:post_date_gmt>
|
80
|
+
<wp:comment_status>open</wp:comment_status>
|
81
|
+
<wp:ping_status>open</wp:ping_status>
|
82
|
+
<wp:post_name>informacje</wp:post_name>
|
83
|
+
<wp:status>publish</wp:status>
|
84
|
+
<wp:post_parent>0</wp:post_parent>
|
85
|
+
<wp:menu_order>0</wp:menu_order>
|
86
|
+
<wp:post_type>page</wp:post_type>
|
87
|
+
<wp:post_password/>
|
88
|
+
<wp:is_sticky>0</wp:is_sticky>
|
89
|
+
<wp:postmeta>
|
90
|
+
<wp:meta_key>_wp_page_template</wp:meta_key>
|
91
|
+
<wp:meta_value><![CDATA[default]]></wp:meta_value>
|
92
|
+
</wp:postmeta>
|
93
|
+
</item>
|
94
|
+
<item>
|
95
|
+
<title>Informacje</title>
|
96
|
+
<link>http://szpryc.wordpress.com/informacje/</link>
|
97
|
+
<pubDate>Wed, 26 Nov 2014 11:49:06 +0000</pubDate>
|
98
|
+
<dc:creator>szpryc</dc:creator>
|
99
|
+
<guid isPermaLink="false">http://szpryc.wordpress.com/?page_id=1</guid>
|
100
|
+
<description/>
|
101
|
+
<content:encoded><![CDATA[This is an example of a page. Unlike posts, which are displayed on your blog’s front page in the order they’re published, pages are better suited for more timeless content that you want to be easily accessible, like your About or Contact information. Click the Edit link to make changes to this page or <a title="Direct link to Add New in the Admin Dashboard" href="/wp-admin/post-new.php?post_type=page">add another page</a>.]]></content:encoded>
|
102
|
+
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
|
103
|
+
<wp:post_id>1</wp:post_id>
|
104
|
+
<wp:post_date></wp:post_date>
|
105
|
+
<wp:post_date_gmt>2015-06-20 18:04:13 +0000</wp:post_date_gmt>
|
106
|
+
<wp:comment_status>open</wp:comment_status>
|
107
|
+
<wp:ping_status>open</wp:ping_status>
|
108
|
+
<wp:post_name>informacje</wp:post_name>
|
109
|
+
<wp:status>publish</wp:status>
|
110
|
+
<wp:post_parent>0</wp:post_parent>
|
111
|
+
<wp:menu_order>0</wp:menu_order>
|
112
|
+
<wp:post_type>page</wp:post_type>
|
113
|
+
<wp:post_password/>
|
114
|
+
<wp:is_sticky>0</wp:is_sticky>
|
115
|
+
<wp:postmeta>
|
116
|
+
<wp:meta_key>_wp_page_template</wp:meta_key>
|
117
|
+
<wp:meta_value><![CDATA[default]]></wp:meta_value>
|
118
|
+
</wp:postmeta>
|
119
|
+
</item>
|
120
|
+
</channel>
|
121
|
+
</rss>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/wordpress/author'
|
3
|
+
require './lib/wordpress/blog'
|
4
|
+
|
5
|
+
module Contentful
|
6
|
+
module Exporter
|
7
|
+
module Wordpress
|
8
|
+
describe Author do
|
9
|
+
include_context 'shared_configuration'
|
10
|
+
|
11
|
+
before do
|
12
|
+
xml_doc = Nokogiri::XML(File.open('spec/fixtures/wordpress.xml'))
|
13
|
+
@author = Author.new(xml_doc, @settings)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'initialize' do
|
17
|
+
expect(@author.settings).to be_kind_of Contentful::Configuration
|
18
|
+
expect(@author.xml).to be_kind_of Nokogiri::XML::Document
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'extract_authors' do
|
22
|
+
authors = @author.send(:extract_authors)
|
23
|
+
expect(authors).to be_kind_of Array
|
24
|
+
expect(authors.count).to eq 2
|
25
|
+
expect(authors.first).to include(id: 'author_10',
|
26
|
+
email: 'komarpro@gmail.com',
|
27
|
+
display_name: 'szpryc',
|
28
|
+
first_name: '',
|
29
|
+
last_name: '',
|
30
|
+
wordpress_login: 'szpryc')
|
31
|
+
expect(authors.last).to include(id: 'author_12',
|
32
|
+
email: 'testy.testerson@gmail.com',
|
33
|
+
display_name: 'Testy Testerson',
|
34
|
+
first_name: 'Testy',
|
35
|
+
last_name: 'Testerson',
|
36
|
+
wordpress_login: 'testytesterson')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'extracted_data' do
|
40
|
+
authors_xml = @author.xml.xpath('//wp:author').to_a
|
41
|
+
author = @author.send(:extracted_data, authors_xml.last)
|
42
|
+
expect(author).to be_kind_of Hash
|
43
|
+
expect(author.count).to eq 6
|
44
|
+
expect(author).to include(id: 'author_12',
|
45
|
+
email: 'testy.testerson@gmail.com',
|
46
|
+
display_name: 'Testy Testerson',
|
47
|
+
first_name: 'Testy',
|
48
|
+
last_name: 'Testerson',
|
49
|
+
wordpress_login: 'testytesterson')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -48,9 +48,11 @@ module Contentful
|
|
48
48
|
|
49
49
|
it 'valid blog entry' do
|
50
50
|
blog = JSON.parse(File.read('spec/fixtures/blog/entries/blog/blog_1.json'))
|
51
|
-
expect(blog.count).to eq
|
51
|
+
expect(blog.count).to eq 6
|
52
52
|
expect(blog['id']).to eq 'blog_id'
|
53
53
|
expect(blog['title']).to eq 'Moj blog 2'
|
54
|
+
expect(blog['authors'].count).to eq 2
|
55
|
+
expect(blog['authors'].first).to include('id' => 'author_10', 'type' => 'Entry')
|
54
56
|
expect(blog['posts'].count).to eq 7
|
55
57
|
expect(blog['posts'].first).to include('id' => 'post_1', 'type' => 'Entry')
|
56
58
|
expect(blog['categories'].count).to eq 4
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/wordpress/post_author'
|
3
|
+
require './lib/wordpress/post'
|
4
|
+
require './lib/wordpress/blog'
|
5
|
+
|
6
|
+
module Contentful
|
7
|
+
module Exporter
|
8
|
+
module Wordpress
|
9
|
+
describe PostAuthor do
|
10
|
+
include_context 'shared_configuration'
|
11
|
+
|
12
|
+
before do
|
13
|
+
xml_doc = Nokogiri::XML(File.open('spec/fixtures/wordpress.xml'))
|
14
|
+
post = xml_doc.xpath('//item').to_a[4]
|
15
|
+
@p_author = PostAuthor.new(xml_doc, post, @settings)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'initialize' do
|
19
|
+
expect(@p_author.settings).to be_kind_of Contentful::Configuration
|
20
|
+
expect(@p_author.xml).to be_kind_of Nokogiri::XML::Document
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'extract_author' do
|
24
|
+
author = @p_author.send(:author_extractor)
|
25
|
+
expect(author).to be_kind_of Hash
|
26
|
+
expect(author[:id]).to eq 'author_10'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -20,14 +20,36 @@ module Contentful
|
|
20
20
|
expect(@post.xml).to be_kind_of Nokogiri::XML::Document
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
describe 'extract_data' do
|
24
|
+
it 'extracts data from correctly formed xml' do
|
25
|
+
post_xml = @xml_doc.xpath('//item').to_a.first
|
26
|
+
post = @post.send(:extract_data, post_xml)
|
27
|
+
expect(post.count).to eq 6
|
28
|
+
expect(post[:id]).to eq 'post_1'
|
29
|
+
expect(post[:author]).to eq({ id: 'author_10', type: 'Entry' })
|
30
|
+
expect(post[:title]).to eq 'Informacje'
|
31
|
+
expect(post[:wordpress_url]).to eq 'http://szpryc.wordpress.com/informacje/'
|
32
|
+
expect(post[:created_at]).to eq Date.parse('2014-11-26')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'extracts :created_at as Date.today when wp:post_date and wp:post_date_gmt are missing' do
|
36
|
+
xml_doc = Nokogiri::XML(File.open('spec/fixtures/wordpress_empty_dates.xml'))
|
37
|
+
post_xml = xml_doc.xpath('//item').to_a.first
|
38
|
+
|
39
|
+
expect_any_instance_of(Logger).to receive(:warn).with("Post <post_1> didn't have Creation Date - defaulting to #{Date.today}")
|
40
|
+
|
41
|
+
post = Post.new(xml_doc, @settings).send(:extract_data, post_xml)
|
42
|
+
|
43
|
+
expect(post[:created_at]).to eq Date.today
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'tries to fetch :created_at from wp:post_date_gmt if wp:post_date is missing' do
|
47
|
+
xml_doc = Nokogiri::XML(File.open('spec/fixtures/wordpress_empty_dates.xml'))
|
48
|
+
post_xml = xml_doc.xpath('//item').to_a[1]
|
49
|
+
post = Post.new(xml_doc, @settings).send(:extract_data, post_xml)
|
50
|
+
|
51
|
+
expect(post[:created_at]).to eq Date.parse('2015-06-20')
|
52
|
+
end
|
31
53
|
end
|
32
54
|
|
33
55
|
it 'post_id(post)' do
|
@@ -5,6 +5,12 @@
|
|
5
5
|
"description": null,
|
6
6
|
"displayField": "title",
|
7
7
|
"fields": {
|
8
|
+
"Authors": {
|
9
|
+
"id": "authors",
|
10
|
+
"type": "Array",
|
11
|
+
"link_type": "Entry",
|
12
|
+
"link": "Link"
|
13
|
+
},
|
8
14
|
"Posts": {
|
9
15
|
"id": "posts",
|
10
16
|
"type": "Array",
|
@@ -26,6 +32,19 @@
|
|
26
32
|
}
|
27
33
|
}
|
28
34
|
},
|
35
|
+
"Author": {
|
36
|
+
"id": "author",
|
37
|
+
"name": "Author",
|
38
|
+
"description": null,
|
39
|
+
"displayField": "display_name",
|
40
|
+
"fields": {
|
41
|
+
"email": "Text",
|
42
|
+
"display_name": "Text",
|
43
|
+
"first_name": "Text",
|
44
|
+
"last_name": "Text",
|
45
|
+
"wordpress_login": "Text"
|
46
|
+
}
|
47
|
+
},
|
29
48
|
"Tag": {
|
30
49
|
"id": "tag",
|
31
50
|
"name": "Tag",
|
@@ -44,6 +63,11 @@
|
|
44
63
|
"fields": {
|
45
64
|
"title": "Text",
|
46
65
|
"content": "Text",
|
66
|
+
"Author": {
|
67
|
+
"id": "author",
|
68
|
+
"type": "Link",
|
69
|
+
"link_type": "Entry"
|
70
|
+
},
|
47
71
|
"Tags": {
|
48
72
|
"id": "tags",
|
49
73
|
"type": "Array",
|
@@ -29,12 +29,21 @@
|
|
29
29
|
<wp:base_site_url>http://wordpress.com/</wp:base_site_url>
|
30
30
|
<wp:base_blog_url>http://szpryciarz.wordpress.com</wp:base_blog_url>
|
31
31
|
<wp:author>
|
32
|
+
<wp:author_id>10</wp:author_id>
|
32
33
|
<wp:author_login>szpryc</wp:author_login>
|
33
34
|
<wp:author_email>komarpro@gmail.com</wp:author_email>
|
34
35
|
<wp:author_display_name><![CDATA[szpryc]]></wp:author_display_name>
|
35
36
|
<wp:author_first_name><![CDATA[]]></wp:author_first_name>
|
36
37
|
<wp:author_last_name><![CDATA[]]></wp:author_last_name>
|
37
38
|
</wp:author>
|
39
|
+
<wp:author>
|
40
|
+
<wp:author_id>12</wp:author_id>
|
41
|
+
<wp:author_login>testytesterson</wp:author_login>
|
42
|
+
<wp:author_email>testy.testerson@gmail.com</wp:author_email>
|
43
|
+
<wp:author_display_name><![CDATA[Testy Testerson]]></wp:author_display_name>
|
44
|
+
<wp:author_first_name><![CDATA[Testy]]></wp:author_first_name>
|
45
|
+
<wp:author_last_name><![CDATA[Testerson]]></wp:author_last_name>
|
46
|
+
</wp:author>
|
38
47
|
<wp:category>
|
39
48
|
<wp:term_id>14786</wp:term_id>
|
40
49
|
<wp:category_nicename>bez-kategorii</wp:category_nicename>
|
@@ -127,22 +136,22 @@
|
|
127
136
|
<dc:creator>szpryc</dc:creator>
|
128
137
|
<guid isPermaLink="false">http://szpryciarz.wordpress.com/?p=7</guid>
|
129
138
|
<description/>
|
130
|
-
<content:encoded><![CDATA[<strong>Bold text</strong>, <em>italic text</em>
|
131
|
-
|
132
|
-
<code> int a = 1</code>
|
133
|
-
<ol>
|
134
|
-
<li>Nice</li>
|
135
|
-
<li>Content</li>
|
136
|
-
</ol>
|
137
|
-
|
138
|
-
<img src="http://upload.wikimedia.org/wikipedia/en/d/da/Contentful_Logo_with_Tagline.png" alt="Contentful" />
|
139
|
-
|
140
|
-
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
141
|
-
|
142
|
-
<ul>
|
143
|
-
Pro
|
144
|
-
</ul>
|
145
|
-
|
139
|
+
<content:encoded><![CDATA[<strong>Bold text</strong>, <em>italic text</em>
|
140
|
+
|
141
|
+
<code> int a = 1</code>
|
142
|
+
<ol>
|
143
|
+
<li>Nice</li>
|
144
|
+
<li>Content</li>
|
145
|
+
</ol>
|
146
|
+
|
147
|
+
<img src="http://upload.wikimedia.org/wikipedia/en/d/da/Contentful_Logo_with_Tagline.png" alt="Contentful" />
|
148
|
+
|
149
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
150
|
+
|
151
|
+
<ul>
|
152
|
+
Pro
|
153
|
+
</ul>
|
154
|
+
|
146
155
|
]]></content:encoded>
|
147
156
|
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
|
148
157
|
<wp:post_id>7</wp:post_id>
|
@@ -202,12 +211,12 @@ Pro
|
|
202
211
|
<dc:creator>szpryc</dc:creator>
|
203
212
|
<guid isPermaLink="false">http://szpryciarz.wordpress.com/?p=11</guid>
|
204
213
|
<description/>
|
205
|
-
<content:encoded><![CDATA[Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
|
206
|
-
|
207
|
-
<strong>Fat fat</strong>, <em>Wooha</em>
|
208
|
-
|
209
|
-
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
210
|
-
|
214
|
+
<content:encoded><![CDATA[Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
|
215
|
+
|
216
|
+
<strong>Fat fat</strong>, <em>Wooha</em>
|
217
|
+
|
218
|
+
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
|
219
|
+
|
211
220
|
<img src="http://upload.wikimedia.org/wikipedia/commons/f/f9/Orange_and_cross_section.jpg" alt="Oranges" />]]></content:encoded>
|
212
221
|
<excerpt:encoded><![CDATA[]]></excerpt:encoded>
|
213
222
|
<wp:post_id>11</wp:post_id>
|
@@ -28,13 +28,22 @@
|
|
28
28
|
<wp:wxr_version>1.2</wp:wxr_version>
|
29
29
|
<wp:base_site_url>http://wordpress.com/</wp:base_site_url>
|
30
30
|
<wp:base_blog_url>http://szpryc.wordpress.com</wp:base_blog_url>
|
31
|
-
<wp:
|
31
|
+
<wp:author>
|
32
|
+
<wp:author_id>10</wp:author_id>
|
32
33
|
<wp:author_login>szpryc</wp:author_login>
|
33
34
|
<wp:author_email>komarpro@gmail.com</wp:author_email>
|
34
35
|
<wp:author_display_name><![CDATA[szpryc]]></wp:author_display_name>
|
35
36
|
<wp:author_first_name><![CDATA[]]></wp:author_first_name>
|
36
37
|
<wp:author_last_name><![CDATA[]]></wp:author_last_name>
|
37
|
-
</wp:
|
38
|
+
</wp:author>
|
39
|
+
<wp:author>
|
40
|
+
<wp:author_id>12</wp:author_id>
|
41
|
+
<wp:author_login>testytesterson</wp:author_login>
|
42
|
+
<wp:author_email>testy.testerson@gmail.com</wp:author_email>
|
43
|
+
<wp:author_display_name><![CDATA[Testy Testerson]]></wp:author_display_name>
|
44
|
+
<wp:author_first_name><![CDATA[Testy]]></wp:author_first_name>
|
45
|
+
<wp:author_last_name><![CDATA[Testerson]]></wp:author_last_name>
|
46
|
+
</wp:author>
|
38
47
|
<wp:category>
|
39
48
|
<wp:term_id>14786</wp:term_id>
|
40
49
|
<wp:category_nicename>bez-kategorii</wp:category_nicename>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordpress-exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Contentful GmbH (Andreas Tiefenthaler)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -189,15 +189,19 @@ files:
|
|
189
189
|
- lib/converters/markup_converter.rb
|
190
190
|
- lib/migrator.rb
|
191
191
|
- lib/version.rb
|
192
|
+
- lib/wordpress/author.rb
|
192
193
|
- lib/wordpress/blog.rb
|
193
194
|
- lib/wordpress/category.rb
|
194
195
|
- lib/wordpress/export.rb
|
195
196
|
- lib/wordpress/post.rb
|
196
197
|
- lib/wordpress/post_attachment.rb
|
198
|
+
- lib/wordpress/post_author.rb
|
197
199
|
- lib/wordpress/post_category_domain.rb
|
198
200
|
- lib/wordpress/tag.rb
|
199
201
|
- spec/fixtures/blog/assets/attachment_post/attachment_post_15.json
|
200
202
|
- spec/fixtures/blog/assets/attachment_post/attachment_post_21.json
|
203
|
+
- spec/fixtures/blog/entries/author/author_10.json
|
204
|
+
- spec/fixtures/blog/entries/author/author_12.json
|
201
205
|
- spec/fixtures/blog/entries/blog/blog_1.json
|
202
206
|
- spec/fixtures/blog/entries/category/category_11599757.json
|
203
207
|
- spec/fixtures/blog/entries/category/category_14786.json
|
@@ -214,12 +218,15 @@ files:
|
|
214
218
|
- spec/fixtures/blog/entries/tag/tag_306830130.json
|
215
219
|
- spec/fixtures/default_contentful_structure.json
|
216
220
|
- spec/fixtures/wordpress.xml
|
221
|
+
- spec/fixtures/wordpress_empty_dates.xml
|
217
222
|
- spec/lib/configuration_spec.rb
|
218
223
|
- spec/lib/converters/markup_converter_spec.rb
|
224
|
+
- spec/lib/wordpress/author_spec.rb
|
219
225
|
- spec/lib/wordpress/blog_spec.rb
|
220
226
|
- spec/lib/wordpress/category_spec.rb
|
221
227
|
- spec/lib/wordpress/export_spec.rb
|
222
228
|
- spec/lib/wordpress/post_attachment_spec.rb
|
229
|
+
- spec/lib/wordpress/post_author_spec.rb
|
223
230
|
- spec/lib/wordpress/post_category_domain_spec.rb
|
224
231
|
- spec/lib/wordpress/post_spec.rb
|
225
232
|
- spec/lib/wordpress/tag_spec.rb
|
@@ -253,13 +260,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
260
|
version: '0'
|
254
261
|
requirements: []
|
255
262
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.
|
263
|
+
rubygems_version: 2.5.0
|
257
264
|
signing_key:
|
258
265
|
specification_version: 4
|
259
266
|
summary: Exporter for WordPress based blogs
|
260
267
|
test_files:
|
261
268
|
- spec/fixtures/blog/assets/attachment_post/attachment_post_15.json
|
262
269
|
- spec/fixtures/blog/assets/attachment_post/attachment_post_21.json
|
270
|
+
- spec/fixtures/blog/entries/author/author_10.json
|
271
|
+
- spec/fixtures/blog/entries/author/author_12.json
|
263
272
|
- spec/fixtures/blog/entries/blog/blog_1.json
|
264
273
|
- spec/fixtures/blog/entries/category/category_11599757.json
|
265
274
|
- spec/fixtures/blog/entries/category/category_14786.json
|
@@ -276,12 +285,15 @@ test_files:
|
|
276
285
|
- spec/fixtures/blog/entries/tag/tag_306830130.json
|
277
286
|
- spec/fixtures/default_contentful_structure.json
|
278
287
|
- spec/fixtures/wordpress.xml
|
288
|
+
- spec/fixtures/wordpress_empty_dates.xml
|
279
289
|
- spec/lib/configuration_spec.rb
|
280
290
|
- spec/lib/converters/markup_converter_spec.rb
|
291
|
+
- spec/lib/wordpress/author_spec.rb
|
281
292
|
- spec/lib/wordpress/blog_spec.rb
|
282
293
|
- spec/lib/wordpress/category_spec.rb
|
283
294
|
- spec/lib/wordpress/export_spec.rb
|
284
295
|
- spec/lib/wordpress/post_attachment_spec.rb
|
296
|
+
- spec/lib/wordpress/post_author_spec.rb
|
285
297
|
- spec/lib/wordpress/post_category_domain_spec.rb
|
286
298
|
- spec/lib/wordpress/post_spec.rb
|
287
299
|
- spec/lib/wordpress/tag_spec.rb
|