publify_core 9.2.10 → 10.0.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 +57 -18
- data/app/assets/javascripts/lang/ar_AR.js +17 -0
- data/app/controllers/admin/{content_controller.rb → articles_controller.rb} +24 -24
- data/app/controllers/admin/dashboard_controller.rb +3 -3
- data/app/controllers/admin/feedback_controller.rb +23 -23
- data/app/controllers/admin/pages_controller.rb +2 -2
- data/app/controllers/admin/post_types_controller.rb +10 -4
- data/app/controllers/admin/redirects_controller.rb +10 -6
- data/app/controllers/admin/resources_controller.rb +2 -2
- data/app/controllers/admin/sidebar_controller.rb +2 -2
- data/app/controllers/admin/tags_controller.rb +5 -3
- data/app/controllers/admin/themes_controller.rb +1 -2
- data/app/controllers/admin/users_controller.rb +5 -3
- data/app/controllers/articles_controller.rb +5 -5
- data/app/controllers/authors_controller.rb +2 -2
- data/app/controllers/base_controller.rb +0 -3
- data/app/controllers/feedback_controller.rb +3 -3
- data/app/controllers/tags_controller.rb +3 -3
- data/app/helpers/authors_helper.rb +1 -1
- data/app/helpers/base_helper.rb +6 -6
- data/app/models/ability.rb +1 -1
- data/app/models/archives_sidebar.rb +3 -3
- data/app/models/article.rb +13 -13
- data/app/models/blog.rb +3 -6
- data/app/models/content.rb +1 -3
- data/app/models/content_base.rb +2 -13
- data/app/models/feedback.rb +1 -2
- data/app/models/meta_sidebar.rb +1 -1
- data/app/models/note.rb +2 -2
- data/app/models/redirect.rb +0 -1
- data/app/models/sidebar.rb +1 -1
- data/app/models/static_sidebar.rb +1 -1
- data/app/models/tag.rb +7 -8
- data/app/models/tag_sidebar.rb +3 -3
- data/app/models/text_filter.rb +17 -43
- data/app/models/user.rb +2 -2
- data/app/services/title_builder.rb +4 -4
- data/app/views/admin/{content → articles}/_article_list.html.erb +3 -3
- data/app/views/admin/{content → articles}/_form.html.erb +11 -1
- data/app/views/admin/{content → articles}/index.html.erb +1 -1
- data/app/views/admin/dashboard/_drafts.html.erb +2 -2
- data/app/views/admin/dashboard/_overview.html.erb +1 -1
- data/app/views/admin/dashboard/_welcome.html.erb +4 -4
- data/app/views/admin/dashboard/index.html.erb +0 -7
- data/app/views/admin/feedback/article.html.erb +12 -6
- data/app/views/admin/feedback/edit.html.erb +14 -2
- data/app/views/admin/feedback/index.html.erb +6 -7
- data/app/views/admin/pages/_form.html.erb +13 -14
- data/app/views/admin/seo/show.html.erb +12 -1
- data/app/views/admin/shared/_menu.html.erb +5 -4
- data/app/views/admin/tags/_index_and_form.html.erb +2 -1
- data/app/views/articles/_comment_errors.html.erb +11 -1
- data/app/views/articles/read.html.erb +1 -1
- data/app/views/layouts/administration.html.erb +9 -17
- data/config/i18n-tasks.yml +8 -1
- data/config/initializers/devise.rb +1 -1
- data/config/locales/ar.yml +885 -0
- data/config/locales/da.yml +12 -12
- data/config/locales/de.yml +12 -12
- data/config/locales/en.yml +12 -12
- data/config/locales/es-MX.yml +12 -12
- data/config/locales/fr.yml +12 -12
- data/config/locales/he.yml +12 -12
- data/config/locales/it.yml +12 -12
- data/config/locales/ja.yml +13 -13
- data/config/locales/lt.yml +12 -12
- data/config/locales/{nb-NO.yml → nb.yml} +13 -13
- data/config/locales/nl.yml +13 -13
- data/config/locales/pl.yml +12 -12
- data/config/locales/pt-BR.yml +12 -12
- data/config/locales/ro.yml +12 -12
- data/config/locales/ru.yml +13 -13
- data/config/locales/sidebars.ar.yml +20 -0
- data/config/locales/{sidebars.nb-NO.yml → sidebars.nb.yml} +1 -1
- data/config/locales/zh-CN.yml +12 -12
- data/config/locales/zh-TW.yml +12 -12
- data/config/routes.rb +2 -2
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +1 -0
- data/db/migrate/20150808052637_add_blog_ids.rb +3 -1
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +1 -0
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +2 -0
- data/db/migrate/20190208152646_move_text_filter_to_name.rb +17 -17
- data/db/migrate/20221007091049_remove_table_sitealizer.rb +19 -0
- data/db/migrate/20221010092846_remove_page_caches_table.rb +15 -0
- data/db/migrate/20221012163214_remove_itunes_fields_from_resources.rb +14 -0
- data/db/seeds.rb +0 -4
- data/lib/publify_core/content_text_helpers.rb +11 -0
- data/lib/publify_core/lang.rb +1 -1
- data/lib/publify_core/testing_support/factories/articles.rb +55 -0
- data/lib/publify_core/testing_support/factories/blogs.rb +24 -0
- data/lib/publify_core/testing_support/factories/comments.rb +40 -0
- data/lib/publify_core/testing_support/factories/contents.rb +7 -0
- data/lib/publify_core/testing_support/factories/notes.rb +17 -0
- data/lib/publify_core/testing_support/factories/pages.rb +13 -0
- data/lib/publify_core/testing_support/factories/post_types.rb +8 -0
- data/lib/publify_core/testing_support/factories/redirects.rb +9 -0
- data/lib/publify_core/testing_support/factories/resources.rb +16 -0
- data/lib/publify_core/testing_support/factories/sequences.rb +12 -0
- data/lib/publify_core/testing_support/factories/sidebars.rb +10 -0
- data/lib/publify_core/testing_support/factories/tags.rb +9 -0
- data/lib/publify_core/testing_support/factories/trackbacks.rb +13 -0
- data/lib/publify_core/testing_support/factories/users.rb +43 -0
- data/lib/publify_core/version.rb +1 -1
- data/lib/publify_core.rb +3 -3
- data/lib/publify_textfilter_markdown.rb +8 -9
- data/lib/publify_textfilter_markdown_smartquotes.rb +20 -0
- data/lib/publify_textfilter_twitterfilter.rb +36 -18
- data/lib/sidebar_field.rb +2 -2
- data/lib/sidebar_registry.rb +0 -12
- data/lib/text_filter_plugin.rb +23 -30
- metadata +213 -105
- data/lib/publify_core/testing_support/factories.rb +0 -240
- data/lib/publify_textfilter_textile.rb +0 -24
- data/lib/tasks/i18n.rake +0 -9
- /data/app/views/admin/{content → articles}/autosave.js.erb +0 -0
- /data/app/views/admin/{content → articles}/edit.html.erb +0 -0
- /data/app/views/admin/{content → articles}/index.js.erb +0 -0
- /data/app/views/admin/{content → articles}/new.html.erb +0 -0
data/config/locales/zh-TW.yml
CHANGED
@@ -19,14 +19,8 @@ zh-TW:
|
|
19
19
|
attributes:
|
20
20
|
title:
|
21
21
|
blank: can't be blank
|
22
|
-
template:
|
23
|
-
body: ''
|
24
|
-
header: ''
|
25
22
|
admin:
|
26
|
-
|
27
|
-
not_allowed: Error, you are not allowed to perform this action
|
28
|
-
successfully_deleted: This %{name} was deleted successfully
|
29
|
-
content:
|
23
|
+
articles:
|
30
24
|
access_granted:
|
31
25
|
error: Error, you are not allowed to perform this action
|
32
26
|
article_list:
|
@@ -85,6 +79,11 @@ zh-TW:
|
|
85
79
|
withdrawn: Withdrawn
|
86
80
|
update:
|
87
81
|
success: Article was successfully updated
|
82
|
+
base:
|
83
|
+
not_allowed: Error, you are not allowed to perform this action
|
84
|
+
successfully_created: "%{name} was successfully created."
|
85
|
+
successfully_deleted: This %{name} was deleted successfully
|
86
|
+
successfully_updated: "%{name} was successfully updated."
|
88
87
|
dashboard:
|
89
88
|
comment:
|
90
89
|
by: By
|
@@ -95,9 +94,6 @@ zh-TW:
|
|
95
94
|
no_drafts_yet: No drafts yet, why don't you write one
|
96
95
|
your_drafts: Your drafts
|
97
96
|
index:
|
98
|
-
textile_deprecated_html: The Textile text filter has been deprecated and will
|
99
|
-
be removed soon. Some of your content still uses this filter. Run the <code>publify:textile_to_markdown</code>
|
100
|
-
rake task to convert it to Markdown, or convert your content manually.
|
101
97
|
welcome_back: 歡迎回來, %{user_name}!
|
102
98
|
overview:
|
103
99
|
change_your_blog_presentation: 修改你的部落格外觀
|
@@ -155,14 +151,17 @@ zh-TW:
|
|
155
151
|
feedback:
|
156
152
|
article:
|
157
153
|
action_or_other_html: "%{first_action} 或 %{second_action}"
|
154
|
+
actions: Actions
|
158
155
|
add_a_comment: Add a comment
|
159
156
|
author: 作者
|
160
157
|
cancel: 取消
|
161
158
|
comments_for_html: 做出評論 %{title}
|
159
|
+
content: Content
|
160
|
+
created_at: Created at
|
162
161
|
email: Email
|
163
162
|
no_feedback: There is no feedback yet. Why don't you create some?
|
164
163
|
save: 存檔
|
165
|
-
|
164
|
+
status: 身分
|
166
165
|
url: Url
|
167
166
|
your_comment: Your comment
|
168
167
|
bulkops:
|
@@ -209,7 +208,6 @@ zh-TW:
|
|
209
208
|
no_feedback: There is no feedback yet. Why don't you create some?
|
210
209
|
presumed_ham: Presumed ham
|
211
210
|
presumed_spam: Presumed spam
|
212
|
-
select_all: Select all
|
213
211
|
spam: Spam
|
214
212
|
status: 身分
|
215
213
|
unapproved_comments: Unapproved comments
|
@@ -563,6 +561,7 @@ zh-TW:
|
|
563
561
|
sidebar_plugins: Sidebar plugins
|
564
562
|
tags: 標示標籤
|
565
563
|
titles: Titles
|
564
|
+
view_blog: View blog
|
566
565
|
write: Write
|
567
566
|
twitter_alert:
|
568
567
|
fill_the_twitter_credentials: fill in the OAuth credentials
|
@@ -775,6 +774,7 @@ zh-TW:
|
|
775
774
|
helper:
|
776
775
|
at: at
|
777
776
|
langs:
|
777
|
+
ar_AR: Arabic
|
778
778
|
da_DK: Danish
|
779
779
|
de_DE: German
|
780
780
|
en_US: English (US)
|
data/config/routes.rb
CHANGED
@@ -81,8 +81,8 @@ Rails.application.routes.draw do
|
|
81
81
|
namespace :admin do
|
82
82
|
root "dashboard#index", as: "dashboard"
|
83
83
|
|
84
|
-
resources :
|
85
|
-
|
84
|
+
resources :articles, only: [:index, :new, :edit, :create, :update, :destroy],
|
85
|
+
format: false do
|
86
86
|
collection do
|
87
87
|
get "auto_complete_for_article_keywords"
|
88
88
|
post "autosave"
|
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
class AddBlogIds < ActiveRecord::Migration[4.2]
|
4
4
|
class Blog < ActiveRecord::Base; end
|
5
|
+
|
5
6
|
class Content < ActiveRecord::Base; end
|
7
|
+
|
6
8
|
class Sidebar < ActiveRecord::Base; end
|
7
9
|
|
8
10
|
def up
|
@@ -22,7 +24,7 @@ class AddBlogIds < ActiveRecord::Migration[4.2]
|
|
22
24
|
def down
|
23
25
|
if adapter_name == "PostgreSQL"
|
24
26
|
indexes(:contents).each do |index|
|
25
|
-
remove_index(:contents, name: index.name) if
|
27
|
+
remove_index(:contents, name: index.name) if index.name.include?("blog_id")
|
26
28
|
end
|
27
29
|
else
|
28
30
|
begin
|
@@ -46,23 +46,23 @@ class MoveTextFilterToName < ActiveRecord::Migration[5.2]
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def down
|
49
|
-
TextFilter
|
50
|
-
create_with(description: "None", markup: "none", filters: [], params: {})
|
51
|
-
find_or_create_by!(name: "none")
|
52
|
-
TextFilter
|
53
|
-
create_with(description: "Markdown", markup: "markdown", filters: [], params: {})
|
54
|
-
find_or_create_by!(name: "markdown")
|
55
|
-
TextFilter
|
56
|
-
create_with(description: "SmartyPants", markup: "none", filters: [:smartypants],
|
57
|
-
|
58
|
-
find_or_create_by!(name: "smartypants")
|
59
|
-
TextFilter
|
60
|
-
create_with(description: "Markdown with SmartyPants", markup: "markdown",
|
61
|
-
|
62
|
-
find_or_create_by!(name: "markdown smartypants")
|
63
|
-
TextFilter
|
64
|
-
create_with(description: "Textile", markup: "textile", filters: [], params: {})
|
65
|
-
find_or_create_by!(name: "textile")
|
49
|
+
TextFilter
|
50
|
+
.create_with(description: "None", markup: "none", filters: [], params: {})
|
51
|
+
.find_or_create_by!(name: "none")
|
52
|
+
TextFilter
|
53
|
+
.create_with(description: "Markdown", markup: "markdown", filters: [], params: {})
|
54
|
+
.find_or_create_by!(name: "markdown")
|
55
|
+
TextFilter
|
56
|
+
.create_with(description: "SmartyPants", markup: "none", filters: [:smartypants],
|
57
|
+
params: {})
|
58
|
+
.find_or_create_by!(name: "smartypants")
|
59
|
+
TextFilter
|
60
|
+
.create_with(description: "Markdown with SmartyPants", markup: "markdown",
|
61
|
+
filters: [:smartypants], params: {})
|
62
|
+
.find_or_create_by!(name: "markdown smartypants")
|
63
|
+
TextFilter
|
64
|
+
.create_with(description: "Textile", markup: "textile", filters: [], params: {})
|
65
|
+
.find_or_create_by!(name: "textile")
|
66
66
|
|
67
67
|
Content.find_each do |content|
|
68
68
|
filter_name = content.text_filter_name
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RemoveTableSitealizer < ActiveRecord::Migration[6.1]
|
4
|
+
def up
|
5
|
+
drop_table :sitealizer
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
create_table :sitealizer do |t|
|
10
|
+
t.string :path
|
11
|
+
t.string :ip
|
12
|
+
t.string :referer
|
13
|
+
t.string :language
|
14
|
+
t.string :user_agent
|
15
|
+
t.datetime :created_at
|
16
|
+
t.date :created_on
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RemovePageCachesTable < ActiveRecord::Migration[6.1]
|
4
|
+
def up
|
5
|
+
drop_table :page_caches
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
create_table :page_caches do |t|
|
10
|
+
t.string :name
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :page_caches, :name
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RemoveItunesFieldsFromResources < ActiveRecord::Migration[6.1]
|
4
|
+
def change
|
5
|
+
remove_column :resources, :itunes_metadata, :boolean
|
6
|
+
remove_column :resources, :itunes_author, :string
|
7
|
+
remove_column :resources, :itunes_subtitle, :string
|
8
|
+
remove_column :resources, :itunes_duration, :integer
|
9
|
+
remove_column :resources, :itunes_summary, :text
|
10
|
+
remove_column :resources, :itunes_keywords, :string
|
11
|
+
remove_column :resources, :itunes_category, :string
|
12
|
+
remove_column :resources, :itunes_explicit, :boolean
|
13
|
+
end
|
14
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -19,7 +19,3 @@ unless blog.sidebars.any?
|
|
19
19
|
StaticSidebar.create!(active_position: 3, blog_id: blog.id)
|
20
20
|
MetaSidebar.create!(active_position: 4, blog_id: blog.id)
|
21
21
|
end
|
22
|
-
|
23
|
-
unless File.directory?("#{::Rails.root}/public/files")
|
24
|
-
Dir.mkdir("#{::Rails.root}/public/files")
|
25
|
-
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_autolink/helpers"
|
4
|
+
|
5
|
+
module PublifyCore
|
6
|
+
class ContentTextHelpers
|
7
|
+
include ActionView::Helpers::UrlHelper
|
8
|
+
include ActionView::Helpers::TextHelper
|
9
|
+
include ActionView::Helpers::SanitizeHelper
|
10
|
+
end
|
11
|
+
end
|
data/lib/publify_core/lang.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :article do
|
5
|
+
title { "A big article" }
|
6
|
+
body { "A content with several data" }
|
7
|
+
extended { "extended content for fun" }
|
8
|
+
guid
|
9
|
+
published_at { Time.zone.now }
|
10
|
+
user
|
11
|
+
allow_comments { true }
|
12
|
+
state { :published }
|
13
|
+
allow_pings { true }
|
14
|
+
text_filter_name { "markdown" }
|
15
|
+
|
16
|
+
after :build do |article|
|
17
|
+
article.blog ||= Blog.first || create(:blog)
|
18
|
+
end
|
19
|
+
|
20
|
+
after :stub do |article|
|
21
|
+
article.blog ||= Blog.first || create(:blog)
|
22
|
+
end
|
23
|
+
|
24
|
+
trait :with_tags do
|
25
|
+
keywords { "a tag" }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
factory :unpublished_article, parent: :article do
|
30
|
+
published_at { nil }
|
31
|
+
state { :draft }
|
32
|
+
end
|
33
|
+
|
34
|
+
factory :full_article, parent: :article do
|
35
|
+
after :create do |article|
|
36
|
+
article.resources << create(:resource)
|
37
|
+
article.tags << create(:tag)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
factory :utf8article, parent: :article do
|
42
|
+
title { "ルビー" }
|
43
|
+
permalink { "ルビー" }
|
44
|
+
end
|
45
|
+
|
46
|
+
factory :second_article, parent: :article do
|
47
|
+
title { "Another big article" }
|
48
|
+
end
|
49
|
+
|
50
|
+
factory :article_with_accent_in_html, parent: :article do
|
51
|
+
title { "article with accent" }
|
52
|
+
body { "écoute The future is cool!" }
|
53
|
+
permalink { "article-with-accent" }
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :blog do
|
5
|
+
base_url { "http://test.host/blog" }
|
6
|
+
hide_extended_on_rss { true }
|
7
|
+
blog_name { "test blog" }
|
8
|
+
limit_article_display { 2 }
|
9
|
+
sp_url_limit { 3 }
|
10
|
+
plugin_avatar { "" }
|
11
|
+
blog_subtitle { "test subtitle" }
|
12
|
+
limit_rss_display { 10 }
|
13
|
+
geourl_location { "" }
|
14
|
+
default_allow_pings { false }
|
15
|
+
send_outbound_pings { false }
|
16
|
+
sp_global { true }
|
17
|
+
default_allow_comments { true }
|
18
|
+
email_from { "scott@sigkill.org" }
|
19
|
+
sp_article_auto_close { 0 }
|
20
|
+
permalink_format { "/%year%/%month%/%day%/%title%" }
|
21
|
+
rss_description_text { "rss description text" }
|
22
|
+
lang { "en_US" }
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :comment do
|
5
|
+
article
|
6
|
+
author { "Bob Foo" }
|
7
|
+
url { "http://fakeurl.com" }
|
8
|
+
body { "Comment body" }
|
9
|
+
guid
|
10
|
+
state { "ham" }
|
11
|
+
|
12
|
+
factory :unconfirmed_comment do
|
13
|
+
state { "presumed_ham" }
|
14
|
+
end
|
15
|
+
|
16
|
+
factory :published_comment do
|
17
|
+
state { "ham" }
|
18
|
+
end
|
19
|
+
|
20
|
+
factory :not_published_comment do
|
21
|
+
state { "spam" }
|
22
|
+
end
|
23
|
+
|
24
|
+
factory :ham_comment do
|
25
|
+
state { "ham" }
|
26
|
+
end
|
27
|
+
|
28
|
+
factory :presumed_ham_comment do
|
29
|
+
state { "presumed_ham" }
|
30
|
+
end
|
31
|
+
|
32
|
+
factory :presumed_spam_comment do
|
33
|
+
state { "presumed_spam" }
|
34
|
+
end
|
35
|
+
|
36
|
+
factory :spam_comment do
|
37
|
+
state { "spam" }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :note do
|
5
|
+
body { "this is a note" }
|
6
|
+
published_at { Time.zone.now }
|
7
|
+
user
|
8
|
+
state { "published" }
|
9
|
+
text_filter_name { "markdown" }
|
10
|
+
guid
|
11
|
+
blog { Blog.first || create(:blog) }
|
12
|
+
end
|
13
|
+
|
14
|
+
factory :unpublished_note, parent: :note do
|
15
|
+
state { "draft" }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :page do
|
5
|
+
name { FactoryBot.generate(:name) }
|
6
|
+
title { "Page One Title" }
|
7
|
+
body { FactoryBot.generate(:body) }
|
8
|
+
published_at { Time.zone.now }
|
9
|
+
user
|
10
|
+
blog { Blog.first || create(:blog) }
|
11
|
+
state { "published" }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :resource do
|
5
|
+
upload { PublifyCore::TestingSupport::UploadFixtures.file_upload }
|
6
|
+
mime { "image/jpeg" }
|
7
|
+
size { 110 }
|
8
|
+
blog { Blog.first || create(:blog) }
|
9
|
+
end
|
10
|
+
|
11
|
+
factory :avatar, parent: :resource do
|
12
|
+
upload { "avatar.jpg" }
|
13
|
+
mime { "image/jpeg" }
|
14
|
+
size { 600 }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
sequence(:name) { |n| "name_#{n}" }
|
5
|
+
sequence(:body) { |n| "body #{n}" * ((n % 5) + 3) }
|
6
|
+
sequence(:user) { |n| "user#{n}" }
|
7
|
+
sequence(:email) { |n| "user#{n}@example.com" }
|
8
|
+
sequence(:guid) { |n| "deadbeef#{n}" }
|
9
|
+
sequence(:label) { |n| "lab_#{n}" }
|
10
|
+
sequence(:file_name) { |f| "file_name_#{f}" }
|
11
|
+
sequence(:time) { |n| Time.new(2012, 3, 26, 19, 56).in_time_zone - n }
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :trackback do
|
5
|
+
state { "ham" }
|
6
|
+
article
|
7
|
+
blog_name { "Trackback Blog" }
|
8
|
+
title { "Trackback Entry" }
|
9
|
+
url { "http://www.example.com" }
|
10
|
+
excerpt { "This is an excerpt" }
|
11
|
+
guid { "dsafsadffsdsf" }
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :user do
|
5
|
+
login { FactoryBot.generate(:user) }
|
6
|
+
email { generate(:email) }
|
7
|
+
name { "Bond" }
|
8
|
+
nickname { "James Bond" }
|
9
|
+
notify_via_email { false }
|
10
|
+
notify_on_new_articles { false }
|
11
|
+
notify_on_comments { false }
|
12
|
+
password { "top-Secret12!$#" }
|
13
|
+
state { "active" }
|
14
|
+
profile { User::CONTRIBUTOR }
|
15
|
+
|
16
|
+
trait :without_twitter do
|
17
|
+
twitter { nil }
|
18
|
+
association :resource, nil
|
19
|
+
end
|
20
|
+
|
21
|
+
trait :with_a_full_profile do
|
22
|
+
description { "I am a poor lonesone factory generated user" }
|
23
|
+
url { "http://myblog.net" }
|
24
|
+
msn { "random@mail.com" }
|
25
|
+
aim { "randomaccount" }
|
26
|
+
yahoo { "anotherrandomaccount" }
|
27
|
+
twitter { "@random" }
|
28
|
+
jabber { "random@account.com" }
|
29
|
+
end
|
30
|
+
|
31
|
+
trait :as_admin do
|
32
|
+
profile { User::ADMIN }
|
33
|
+
end
|
34
|
+
|
35
|
+
trait :as_publisher do
|
36
|
+
profile { User::PUBLISHER }
|
37
|
+
end
|
38
|
+
|
39
|
+
trait :as_contributor do
|
40
|
+
profile { User::CONTRIBUTOR }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/publify_core/version.rb
CHANGED
data/lib/publify_core.rb
CHANGED
@@ -7,13 +7,13 @@ require "devise_zxcvbn"
|
|
7
7
|
require "publify_core/version"
|
8
8
|
require "publify_core/engine"
|
9
9
|
require "publify_core/lang"
|
10
|
+
require "publify_core/content_text_helpers"
|
10
11
|
|
11
12
|
require "carrierwave"
|
12
|
-
require "dynamic_form"
|
13
13
|
require "jquery-rails"
|
14
14
|
require "jquery-ui-rails"
|
15
15
|
require "kaminari"
|
16
|
-
require "
|
16
|
+
require "rails-i18n"
|
17
17
|
require "rails-timeago"
|
18
18
|
require "recaptcha/rails"
|
19
19
|
require "sassc-rails"
|
@@ -22,8 +22,8 @@ require "email_notify"
|
|
22
22
|
require "publify_guid"
|
23
23
|
require "publify_textfilter_none"
|
24
24
|
require "publify_textfilter_markdown"
|
25
|
+
require "publify_textfilter_markdown_smartquotes"
|
25
26
|
require "publify_textfilter_smartypants"
|
26
|
-
require "publify_textfilter_textile"
|
27
27
|
require "publify_textfilter_twitterfilter"
|
28
28
|
require "publify_time"
|
29
29
|
require "sidebar_registry"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "text_filter_plugin"
|
4
|
-
require "
|
4
|
+
require "commonmarker"
|
5
5
|
|
6
6
|
# TODO: Move to a different namespace
|
7
7
|
class PublifyApp
|
@@ -9,7 +9,7 @@ class PublifyApp
|
|
9
9
|
class Markdown < TextFilterPlugin::Markup
|
10
10
|
plugin_display_name "Markdown"
|
11
11
|
plugin_description "Markdown markup language from" \
|
12
|
-
|
12
|
+
' <a href="http://daringfireball.com/">Daring Fireball</a>'
|
13
13
|
|
14
14
|
def self.help_text
|
15
15
|
<<~TXT
|
@@ -19,9 +19,9 @@ class PublifyApp
|
|
19
19
|
available from the author's site, but here's a short summary:
|
20
20
|
|
21
21
|
* **Paragraphs**: Start a new paragraph by skipping a line.
|
22
|
-
* **Italics**: Put text in *italics* by enclosing it in either
|
23
|
-
|
24
|
-
* **Bold**: Put text in **bold** by enclosing it in two
|
22
|
+
* **Italics**: Put text in *italics* by enclosing it in either * or
|
23
|
+
_: `*italics*` turns into *italics*.
|
24
|
+
* **Bold**: Put text in **bold** by enclosing it in two *s:
|
25
25
|
`**bold**` turns into **bold**.
|
26
26
|
* **Pre-formatted text**: Enclosing a short block of text in
|
27
27
|
backquotes (`) displays it in a monospaced font and converts HTML
|
@@ -46,11 +46,10 @@ class PublifyApp
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.filtertext(text)
|
49
|
-
# FIXME: Workaround for
|
50
|
-
# HTML tag. See <http://deveiate.org/projects/BlueCloth/ticket/70>.
|
49
|
+
# FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
|
51
50
|
escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
|
52
|
-
html =
|
53
|
-
html.gsub(%r{(</?publify)X}, '\1:')
|
51
|
+
html = CommonMarker.render_html(escaped_macros, :UNSAFE)
|
52
|
+
html.gsub(%r{(</?publify)X}, '\1:').strip
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "text_filter_plugin"
|
4
|
+
require "publify_textfilter_markdown"
|
5
|
+
|
6
|
+
module PublifyTextfilter
|
7
|
+
class MarkdownSmartquotes < PublifyApp::Textfilter::Markdown
|
8
|
+
plugin_display_name "Markdown with smart quotes"
|
9
|
+
plugin_description "Markdown markup language from" \
|
10
|
+
' <a href="http://daringfireball.com/">Daring Fireball</a>' \
|
11
|
+
" with automatic use of typographically correct quotes and dashes"
|
12
|
+
|
13
|
+
def self.filtertext(text)
|
14
|
+
# FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
|
15
|
+
escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
|
16
|
+
html = CommonMarker.render_doc(escaped_macros, :SMART).to_html(:UNSAFE)
|
17
|
+
html.gsub(%r{(</?publify)X}, '\1:').strip
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|