publify_core 10.0.0 → 10.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -1
  3. data/app/assets/javascripts/markup_help_popup.js +25 -0
  4. data/app/assets/javascripts/optional_field_toggle.js +7 -0
  5. data/app/assets/javascripts/preview_comment.js +10 -0
  6. data/app/assets/javascripts/publify.js +3 -0
  7. data/app/assets/javascripts/publify_admin.js +1 -25
  8. data/app/assets/javascripts/spinnable.js +7 -2
  9. data/app/assets/stylesheets/administration_structure.css.scss +1 -1
  10. data/app/assets/stylesheets/publify.css.scss +43 -0
  11. data/app/assets/stylesheets/publify_admin.css.scss +0 -1
  12. data/app/controllers/admin/articles_controller.rb +4 -4
  13. data/app/controllers/admin/dashboard_controller.rb +0 -4
  14. data/app/controllers/admin/post_types_controller.rb +1 -1
  15. data/app/controllers/admin/themes_controller.rb +1 -9
  16. data/app/controllers/articles_controller.rb +5 -3
  17. data/app/controllers/comments_controller.rb +1 -1
  18. data/app/controllers/setup_controller.rb +20 -11
  19. data/app/helpers/admin/feedback_helper.rb +1 -1
  20. data/app/helpers/base_helper.rb +21 -13
  21. data/app/models/archives_sidebar.rb +1 -1
  22. data/app/models/article.rb +1 -2
  23. data/app/models/content.rb +8 -3
  24. data/app/models/note.rb +1 -1
  25. data/app/models/redirect.rb +2 -2
  26. data/app/models/tag_sidebar.rb +25 -3
  27. data/app/models/text_filter.rb +1 -1
  28. data/app/uploaders/resource_uploader.rb +4 -10
  29. data/app/views/admin/articles/_form.html.erb +2 -2
  30. data/app/views/admin/articles/index.html.erb +4 -5
  31. data/app/views/admin/dashboard/_comment.html.erb +1 -1
  32. data/app/views/admin/dashboard/_drafts.html.erb +1 -1
  33. data/app/views/admin/feedback/_ham.html.erb +1 -1
  34. data/app/views/admin/feedback/article.html.erb +1 -1
  35. data/app/views/admin/feedback/edit.html.erb +1 -1
  36. data/app/views/admin/feedback/index.html.erb +2 -2
  37. data/app/views/admin/migrations/show.html.erb +1 -1
  38. data/app/views/admin/notes/_form.html.erb +2 -3
  39. data/app/views/admin/notes/_note.html.erb +2 -2
  40. data/app/views/admin/notes/edit.html.erb +0 -1
  41. data/app/views/admin/pages/_pages.html.erb +1 -1
  42. data/app/views/admin/post_types/_index_and_form.html.erb +2 -2
  43. data/app/views/admin/redirects/_index_and_form.html.erb +2 -2
  44. data/app/views/admin/seo/show.html.erb +1 -1
  45. data/app/views/admin/settings/display.html.erb +1 -1
  46. data/app/views/admin/settings/feedback.html.erb +1 -1
  47. data/app/views/admin/settings/index.html.erb +1 -1
  48. data/app/views/admin/settings/write.html.erb +1 -1
  49. data/app/views/admin/tags/_index_and_form.html.erb +1 -1
  50. data/app/views/admin/users/_form.html.erb +1 -1
  51. data/app/views/articles/_comment_form.html.erb +9 -7
  52. data/app/views/articles/_comment_preview.html.erb +1 -1
  53. data/app/views/articles/_trackback.html.erb +3 -3
  54. data/app/views/articles/comment_failed.js.erb +1 -1
  55. data/app/views/articles/read.html.erb +4 -2
  56. data/app/views/comments/_comment.html.erb +1 -1
  57. data/app/views/comments/preview.js.erb +1 -1
  58. data/app/views/devise/passwords/edit.html.erb +3 -3
  59. data/app/views/devise/passwords/new.html.erb +1 -1
  60. data/app/views/devise/registrations/new.html.erb +2 -2
  61. data/app/views/devise/sessions/new.html.erb +2 -2
  62. data/app/views/devise/shared/_links.html.erb +3 -3
  63. data/app/views/layouts/accounts.html.erb +3 -3
  64. data/app/views/layouts/administration.html.erb +4 -6
  65. data/app/views/layouts/default.html.erb +1 -1
  66. data/app/views/layouts/editor.html.erb +3 -3
  67. data/app/views/notes/index.html.erb +1 -1
  68. data/app/views/notes/show_in_reply.html.erb +1 -1
  69. data/app/views/notification_mailer/comment.html.erb +1 -1
  70. data/app/views/search_sidebar/_content.html.erb +2 -3
  71. data/app/views/settings/install.html.erb +2 -2
  72. data/app/views/setup/index.html.erb +42 -11
  73. data/app/views/shared/_page_header.html.erb +5 -5
  74. data/app/views/tag_sidebar/_content.html.erb +2 -2
  75. data/config/locales/ar.yml +0 -1
  76. data/config/locales/da.yml +0 -1
  77. data/config/locales/de.yml +0 -1
  78. data/config/locales/en.yml +0 -1
  79. data/config/locales/es-MX.yml +0 -1
  80. data/config/locales/fr.yml +0 -1
  81. data/config/locales/he.yml +0 -1
  82. data/config/locales/it.yml +0 -1
  83. data/config/locales/ja.yml +0 -1
  84. data/config/locales/lt.yml +0 -1
  85. data/config/locales/nb.yml +0 -1
  86. data/config/locales/nl.yml +0 -1
  87. data/config/locales/pl.yml +0 -1
  88. data/config/locales/pt-BR.yml +0 -1
  89. data/config/locales/ro.yml +0 -1
  90. data/config/locales/ru.yml +0 -1
  91. data/config/locales/zh-CN.yml +0 -1
  92. data/config/locales/zh-TW.yml +0 -1
  93. data/db/seeds.rb +5 -5
  94. data/lib/publify_core/string_ext.rb +52 -0
  95. data/lib/publify_core/testing_support/feed_assertions.rb +1 -4
  96. data/lib/publify_core/text_filter/markdown.rb +53 -0
  97. data/lib/{publify_textfilter_markdown_smartquotes.rb → publify_core/text_filter/markdown_smartquotes.rb} +3 -3
  98. data/lib/publify_core/text_filter/none.rb +14 -0
  99. data/lib/publify_core/text_filter/smartypants.rb +14 -0
  100. data/lib/publify_core/text_filter/twitterfilter.rb +55 -0
  101. data/lib/publify_core/version.rb +1 -1
  102. data/lib/publify_core.rb +6 -6
  103. data/lib/text_filter_plugin.rb +23 -11
  104. data/lib/theme.rb +18 -7
  105. metadata +64 -29
  106. data/app/assets/javascripts/datetimepicker.js +0 -1470
  107. data/app/assets/stylesheets/datetimepicker.css +0 -306
  108. data/lib/publify_textfilter_markdown.rb +0 -56
  109. data/lib/publify_textfilter_none.rb +0 -16
  110. data/lib/publify_textfilter_smartypants.rb +0 -16
  111. data/lib/publify_textfilter_twitterfilter.rb +0 -57
  112. data/lib/transforms.rb +0 -47
@@ -1,306 +0,0 @@
1
- .xdsoft_datetimepicker{
2
- box-shadow: 0px 5px 15px -5px rgba(0, 0, 0, 0.506);
3
- background: #FFFFFF;
4
- border-bottom: 1px solid #BBBBBB;
5
- border-left: 1px solid #CCCCCC;
6
- border-right: 1px solid #CCCCCC;
7
- border-top: 1px solid #CCCCCC;
8
- color: #333333;
9
- font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
10
- padding: 8px;
11
- padding-left: 0px;
12
- padding-top: 2px;
13
- position: absolute;
14
- z-index: 9999;
15
- -moz-box-sizing: border-box;
16
- box-sizing: border-box;
17
- display:none;
18
- }
19
-
20
- .xdsoft_datetimepicker iframe {
21
- position: absolute;
22
- left: 0;
23
- top: 0;
24
- width: 75px;
25
- height: 210px;
26
- background: transparent;
27
- border:none;
28
- }
29
- /*For IE8 or lower*/
30
- .xdsoft_datetimepicker button {
31
- border:none !important;
32
- }
33
-
34
- .xdsoft_noselect{
35
- -webkit-touch-callout: none;
36
- -webkit-user-select: none;
37
- -khtml-user-select: none;
38
- -moz-user-select: none;
39
- -ms-user-select: none;
40
- -o-user-select: none;
41
- user-select: none;
42
- }
43
- .xdsoft_noselect::selection { background: transparent; }
44
- .xdsoft_noselect::-moz-selection { background: transparent; }
45
- .xdsoft_datetimepicker.xdsoft_inline{
46
- display: inline-block;
47
- position: static;
48
- box-shadow: none;
49
- }
50
- .xdsoft_datetimepicker *{
51
- -moz-box-sizing: border-box;
52
- box-sizing: border-box;
53
- padding:0px;
54
- margin:0px;
55
- }
56
- .xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{
57
- display:none;
58
- }
59
- .xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active{
60
- display:block;
61
- }
62
- .xdsoft_datetimepicker .xdsoft_datepicker{
63
- width: 224px;
64
- float:left;
65
- margin-left:8px;
66
- }
67
- .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker{
68
- width: 256px;
69
- }
70
- .xdsoft_datetimepicker .xdsoft_timepicker{
71
- width: 58px;
72
- float:left;
73
- text-align:center;
74
- margin-left:8px;
75
- margin-top:0px;
76
- }
77
- .xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
78
- margin-top:8px;
79
- margin-bottom:3px
80
- }
81
- .xdsoft_datetimepicker .xdsoft_mounthpicker{
82
- position: relative;
83
- text-align: center;
84
- }
85
-
86
- .xdsoft_datetimepicker .xdsoft_prev, .xdsoft_datetimepicker .xdsoft_next,.xdsoft_datetimepicker .xdsoft_today_button{
87
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAeCAYAAACsYQl4AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozQjRCQjRGREU4MkNFMzExQjRDQkIyRDJDOTdBRUI1MCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCQjg0OUYyNTZDODAxMUUzQjMwM0IwMERBNUU0ODQ5NSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCQjg0OUYyNDZDODAxMUUzQjMwM0IwMERBNUU0ODQ5NSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkI5NzE3MjFBN0E2Q0UzMTFBQjJEQjgzMDk5RTNBNTdBIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjNCNEJCNEZERTgyQ0UzMTFCNENCQjJEMkM5N0FFQjUwIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+aQvATgAAAfVJREFUeNrsmr1OwzAQxzGtkPjYEAuvVGAvfQIGRKADE49gdLwDDwBiZ2RhQUKwICQkWLsgFiRQuIBTucFJ/XFp4+hO+quqnZ4uvzj2nV2RpukCW/22yAgYNINmc7du7DcghCjrkqgOKjF1znpt6rZ0AGWQj7TvCU8d9UM+QAGDrhdyc2Bnc1WVVPBev9V8lBnY+rDwncWZThG4xk4lmxtJy2AHgoY/FySgbSBPwPZ8mEXbQx3aDERb0EbYAYFC7pcAtAvkMWwC0D3NX58S9D/YnoGC7nPWr3Dg9JTbtuHhDShBT8D2CBSK/iIEvVXxpuxSgh7DdgwUTL4iA92zmJb6lKB/YTsECmV+IgK947AGDIqgQ/LojsO135Hn51l2cWlov0JdGNrPUceueXRwilSVgkUyom9Rd6gbLfYTDeO+1v6orn0InTogYDGUkYLO3/wc9BdqqTCKP1Tfi+oTIaCBIL2TES+GTyruT9S61p6BHam+99DFEAgLFklYsIBHwSI9QY80H5ta+1rB/6ovaKihBJeEJbgLbBlQgl+j3lDPqA2tfQV1j3pVn8s+oKHGTSVJ+FqDLeR5bCqJ2E/BCycsoLZETXaKGs7rhKVt+9HZScrZNMi88V8P7LlDbvOZYaJVpMMmBCT4n0o8dTBoNgbdWPsRYACs3r7XyNfbnAAAAABJRU5ErkJggg==');
88
- }
89
- .xdsoft_datetimepicker .xdsoft_prev{
90
- float: left;
91
- background-position:-20px 0px;
92
- }
93
- .xdsoft_datetimepicker .xdsoft_today_button{
94
- float: left;
95
- background-position:-70px 0px;
96
- margin-left:5px;
97
- }
98
-
99
- .xdsoft_datetimepicker .xdsoft_next{
100
- float: right;
101
- background-position:0px 0px;
102
- }
103
- .xdsoft_datetimepicker .xdsoft_next:active,.xdsoft_datetimepicker .xdsoft_prev:active{
104
- }
105
- .xdsoft_datetimepicker .xdsoft_next,.xdsoft_datetimepicker .xdsoft_prev ,.xdsoft_datetimepicker .xdsoft_today_button{
106
- background-color: transparent;
107
- background-repeat: no-repeat;
108
- border: 0px none currentColor;
109
- cursor: pointer;
110
- display: block;
111
- height: 30px;
112
- opacity: 0.5;
113
- outline: medium none currentColor;
114
- overflow: hidden;
115
- padding: 0px;
116
- position: relative;
117
- text-indent: 100%;
118
- white-space: nowrap;
119
- width: 20px;
120
- }
121
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
122
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next{
123
- float:none;
124
- background-position:-40px -15px;
125
- height: 15px;
126
- width: 30px;
127
- display: block;
128
- margin-left:14px;
129
- margin-top:7px;
130
- }
131
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{
132
- background-position:-40px 0px;
133
- margin-bottom:7px;
134
- margin-top:0px;
135
- }
136
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{
137
- height:151px;
138
- overflow:hidden;
139
- border-bottom:1px solid #DDDDDD;
140
- }
141
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div{
142
- background: #F5F5F5;
143
- border-top:1px solid #DDDDDD;
144
- color: #666666;
145
- font-size: 12px;
146
- text-align: center;
147
- border-collapse:collapse;
148
- cursor:pointer;
149
- border-bottom-width:0px;
150
- height:25px;
151
- line-height:25px;
152
- }
153
-
154
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
155
- border-top-width:0px;
156
- }
157
- .xdsoft_datetimepicker .xdsoft_today_button:hover,
158
- .xdsoft_datetimepicker .xdsoft_next:hover,
159
- .xdsoft_datetimepicker .xdsoft_prev:hover {
160
- opacity: 1;
161
- }
162
- .xdsoft_datetimepicker .xdsoft_label{
163
- display: inline;
164
- position: relative;
165
- z-index: 9999;
166
- margin: 0;
167
- padding: 5px 3px;
168
- font-size: 14px;
169
- line-height: 20px;
170
- font-weight: bold;
171
- background-color: #fff;
172
- float:left;
173
- width:182px;
174
- text-align:center;
175
- cursor:pointer;
176
- }
177
- .xdsoft_datetimepicker .xdsoft_label:hover{
178
- text-decoration:underline;
179
- }
180
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{
181
- border:1px solid #ccc;
182
- position:absolute;
183
- right:0px;
184
- top:30px;
185
- z-index:101;
186
- display:none;
187
- background:#fff;
188
- max-height:160px;
189
- overflow-y:hidden;
190
- }
191
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{right:-7px;}
192
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{right:2px;}
193
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
194
- color: #fff;
195
- background: #ff8000;
196
- }
197
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option{
198
- padding:2px 10px 2px 5px;
199
- }
200
- .xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
201
- background: #33AAFF;
202
- box-shadow: #178FE5 0px 1px 3px 0px inset;
203
- color:#fff;
204
- font-weight: 700;
205
- }
206
- .xdsoft_datetimepicker .xdsoft_month{
207
- width:90px;
208
- text-align:right;
209
- }
210
- .xdsoft_datetimepicker .xdsoft_calendar{
211
- clear:both;
212
- }
213
- .xdsoft_datetimepicker .xdsoft_year{
214
- width:56px;
215
- }
216
- .xdsoft_datetimepicker .xdsoft_calendar table{
217
- border-collapse:collapse;
218
- width:100%;
219
-
220
- }
221
- .xdsoft_datetimepicker .xdsoft_calendar td > div{
222
- padding-right:5px;
223
- }
224
- .xdsoft_datetimepicker .xdsoft_calendar th{
225
- height: 25px;
226
- }
227
- .xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th{
228
- width:14.2857142%;
229
- background: #F5F5F5;
230
- border:1px solid #DDDDDD;
231
- color: #666666;
232
- font-size: 12px;
233
- text-align: right;
234
- padding:0px;
235
- border-collapse:collapse;
236
- cursor:pointer;
237
- height: 25px;
238
- }
239
- .xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th{
240
- width:12.5%;
241
- }
242
- .xdsoft_datetimepicker .xdsoft_calendar th{
243
- background: #F1F1F1;
244
- }
245
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{
246
- color:#33AAFF;
247
- }
248
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
249
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
250
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
251
- background: #33AAFF;
252
- box-shadow: #178FE5 0px 1px 3px 0px inset;
253
- color:#fff;
254
- font-weight: 700;
255
- }
256
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
257
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
258
- .xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled{
259
- opacity:0.5;
260
- }
261
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled{
262
- opacity:0.2;
263
- }
264
- .xdsoft_datetimepicker .xdsoft_calendar td:hover,
265
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
266
- color: #fff !important;
267
- background: #ff8000 !important;
268
- box-shadow: none !important;
269
- }
270
- .xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
271
- .xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover{
272
- color: inherit !important;
273
- background: inherit !important;
274
- box-shadow: inherit !important;
275
- }
276
- .xdsoft_datetimepicker .xdsoft_calendar th{
277
- font-weight: 700;
278
- text-align: center;
279
- color: #999;
280
- cursor:default;
281
- }
282
- .xdsoft_datetimepicker .xdsoft_copyright{ color:#ccc !important; font-size:10px;clear:both;float:none;margin-left:8px;}
283
- .xdsoft_datetimepicker .xdsoft_copyright a{ color:#eee !important;}
284
- .xdsoft_datetimepicker .xdsoft_copyright a:hover{ color:#aaa !important;}
285
-
286
-
287
- .xdsoft_time_box{
288
- position:relative;
289
- border:1px solid #ccc;
290
- }
291
- .xdsoft_scrollbar >.xdsoft_scroller{
292
- background:#ccc !important;
293
- height:20px;
294
- border-radius:3px;
295
- }
296
- .xdsoft_scrollbar{
297
- position:absolute;
298
- width:7px;
299
- right:0px;
300
- top:0px;
301
- bottom:0px;
302
- cursor:pointer;
303
- }
304
- .xdsoft_scroller_box{
305
- position:relative;
306
- }
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "text_filter_plugin"
4
- require "commonmarker"
5
-
6
- # TODO: Move to a different namespace
7
- class PublifyApp
8
- class Textfilter
9
- class Markdown < TextFilterPlugin::Markup
10
- plugin_display_name "Markdown"
11
- plugin_description "Markdown markup language from" \
12
- ' <a href="http://daringfireball.com/">Daring Fireball</a>'
13
-
14
- def self.help_text
15
- <<~TXT
16
- [Markdown](http://daringfireball.net/projects/markdown/) is a simple
17
- text-to-HTML converter that turns common text idioms into HTML. The
18
- [full syntax](http://daringfireball.net/projects/markdown/syntax) is
19
- available from the author's site, but here's a short summary:
20
-
21
- * **Paragraphs**: Start a new paragraph by skipping a line.
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
- `**bold**` turns into **bold**.
26
- * **Pre-formatted text**: Enclosing a short block of text in
27
- backquotes (&#96;) displays it in a monospaced font and converts HTML
28
- metacharacters so they display correctly. Example:
29
- &#96;`<img src="foo"/>`&#96; displays as `<img src="foo"/>`. Also,
30
- any paragraph indented 4 or more spaces is treated as pre-formatted
31
- text.
32
- * **Block quotes**: Any paragraph (or line) that starts with a `>` is
33
- treated as a blockquote.
34
- * **Hyperlinks**: You can create links like this:
35
- `[amazon's web site](http://www.amazon.com)`. That produces
36
- "[amazon's web site](http://www.amazon.com)".
37
- * **Lists**: You can create numbered or bulleted lists by ending a
38
- paragraph with a colon (:), skipping a line, and then using asterisks
39
- (*, for bullets) or numbers (for numbered lists). See the
40
- [Markdown syntax page](http://daringfireball.net/projects/markdown/syntax)
41
- for examples.
42
- * **Raw HTML**: Markdown will pass raw HTML through unchanged, so you
43
- can use HTML's syntax whenever Markdown doesn't provide a reasonable
44
- alternative.
45
- TXT
46
- end
47
-
48
- def self.filtertext(text)
49
- # FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
50
- escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
51
- html = CommonMarker.render_html(escaped_macros, :UNSAFE)
52
- html.gsub(%r{(</?publify)X}, '\1:').strip
53
- end
54
- end
55
- end
56
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "text_filter_plugin"
4
-
5
- class PublifyApp
6
- class Textfilter
7
- class None < TextFilterPlugin::Markup
8
- plugin_display_name "None"
9
- plugin_description "Raw HTML only"
10
-
11
- def self.filtertext(text)
12
- text
13
- end
14
- end
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubypants"
4
-
5
- class PublifyApp
6
- class Textfilter
7
- class Smartypants < TextFilterPlugin::PostProcess
8
- plugin_display_name "Smartypants"
9
- plugin_description "Converts HTML to use typographically correct quotes and dashes"
10
-
11
- def self.filtertext(text)
12
- RubyPants.new(text).to_html
13
- end
14
- end
15
- end
16
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "text_filter_plugin"
4
- require "html/pipeline"
5
- require "html/pipeline/hashtag/hashtag_filter"
6
-
7
- class PublifyApp
8
- class Textfilter
9
- class Twitterfilter < TextFilterPlugin::PostProcess
10
- plugin_display_name "HTML Filter"
11
- plugin_description "Strip HTML tags"
12
-
13
- class TwitterHashtagFilter < HTML::Pipeline::HashtagFilter
14
- def initialize(text)
15
- super(text,
16
- tag_url: "https://twitter.com/search?q=%%23%<tag>s&src=tren&mode=realtime",
17
- tag_link_attr: "")
18
- end
19
- end
20
-
21
- class TwitterMentionFilter < HTML::Pipeline::MentionFilter
22
- def initialize(text)
23
- super(text, base_url: "https://twitter.com")
24
- end
25
-
26
- # Override base mentions finder, treating @mention just like any other @foo.
27
- def self.mentioned_logins_in(text, username_pattern = UsernamePattern)
28
- text.gsub MentionPatterns[username_pattern] do |match|
29
- login = Regexp.last_match(1)
30
- yield match, login, false
31
- end
32
- end
33
-
34
- # Override base link creator, removing the class
35
- def link_to_mentioned_user(login)
36
- result[:mentioned_usernames] |= [login]
37
-
38
- url = base_url.dup
39
- url << "/" unless %r{[/~]\z}.match?(url)
40
-
41
- "<a href='#{url << login}'>" \
42
- "@#{login}" \
43
- "</a>"
44
- end
45
- end
46
-
47
- def self.filtertext(text)
48
- # First, autolink
49
- helper = PublifyCore::ContentTextHelpers.new
50
- text = helper.auto_link(text)
51
-
52
- text = TwitterHashtagFilter.new(text).call
53
- TwitterMentionFilter.new(text).call.to_s
54
- end
55
- end
56
- end
57
- end
data/lib/transforms.rb DELETED
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # FIXME: Replace with helpers and/or methods provided by Rails
4
- class String
5
- ACCENTS = { %w(á à â ä ã Ã Ä Â À) => "a",
6
- %w(é è ê ë Ë É È Ê) => "e",
7
- %w(í ì î ï I Î Ì) => "i",
8
- %w(ó ò ô ö õ Õ Ö Ô Ò) => "o",
9
- ["œ"] => "oe",
10
- ["ß"] => "ss",
11
- %w(ú ù û ü U Û Ù) => "u",
12
- %w(ç Ç) => "c" }.freeze
13
-
14
- def to_permalink
15
- string = self
16
- ACCENTS.each do |key, value|
17
- string = string.tr(key.join, value)
18
- end
19
- string = string.tr("'", "-")
20
- string.gsub(/<[^>]*>/, "").to_url
21
- end
22
-
23
- # Returns a-string-with-dashes when passed 'a string with dashes'.
24
- # All special chars are stripped in the process
25
- def to_url
26
- return if nil?
27
-
28
- s = downcase.tr("\"'", "")
29
- s = s.gsub(/\P{Word}/, " ")
30
- s.strip.tr_s(" ", "-").tr(" ", "-").sub(/^$/, "-")
31
- end
32
-
33
- def to_title(item, settings, params)
34
- TitleBuilder.new(self).build(item, settings, params)
35
- end
36
-
37
- # Strips any html markup from a string
38
- TYPO_TAG_KEY = TYPO_ATTRIBUTE_KEY = /[\w:_-]+/.freeze
39
- TYPO_ATTRIBUTE_VALUE = /(?:[A-Za-z0-9]+|(?:'[^']*?'|"[^"]*?"))/.freeze
40
- TYPO_ATTRIBUTE = /(?:#{TYPO_ATTRIBUTE_KEY}(?:\s*=\s*#{TYPO_ATTRIBUTE_VALUE})?)/.freeze
41
- TYPO_ATTRIBUTES = /(?:#{TYPO_ATTRIBUTE}(?:\s+#{TYPO_ATTRIBUTE})*)/.freeze
42
- TAG =
43
- %r{<[!/?\[]?(?:#{TYPO_TAG_KEY}|--)(?:\s+#{TYPO_ATTRIBUTES})?\s*(?:[!/?\]]+|--)?>}.freeze
44
- def strip_html
45
- gsub(TAG, "").gsub(/\s+/, " ").strip
46
- end
47
- end