diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index c27d0ae74c0a6c6e15028fc975080187ad2bcaf4..c141708a03cb2375995409621da9ad6d14fd159e 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -61,12 +61,13 @@ module Admin::ApplicationHelper end def prepare_for_github(html) - text = sanitize html.to_s, + text = html.to_s + text = sanitize text, tags: %w(table a figure img figcaption i em b strong h2 h3 h4 h5 h6 blockquote), attributes: %w(href alt title target rel src srcset width height) - text = CGI.escapeHTML text - text = text.strip - text + text.gsub! "\r", '' + text.gsub! "\n", ' ' + sanitize text end private diff --git a/app/views/admin/communication/website/pages/jekyll.html.erb b/app/views/admin/communication/website/pages/jekyll.html.erb index a3207c1db23d0f7dfd5bc2219454ae96e261bdde..0af5dda1a9e67ffe46ca444b045c3a34a5a98e5e 100644 --- a/app/views/admin/communication/website/pages/jekyll.html.erb +++ b/app/views/admin/communication/website/pages/jekyll.html.erb @@ -2,7 +2,9 @@ title: "<%= @page.title %>" permalink: "<%= @page.path %>" parent: "<%= @page.parent_id %>" -description: "<%= prepare_for_github @page.description %>" -text: "<%= prepare_for_github @page.text %>" +description: > + <%= prepare_for_github @page.description %> +text: > + <%= prepare_for_github @page.text %> --- <%= @page.content_without_frontmatter.html_safe %> diff --git a/app/views/admin/communication/website/posts/jekyll.html.erb b/app/views/admin/communication/website/posts/jekyll.html.erb index 6739f18c7a37273bd516d71242875d5188f091ce..960aa421eb97af05f1650bdc1c170a5f9bcfa0bc 100644 --- a/app/views/admin/communication/website/posts/jekyll.html.erb +++ b/app/views/admin/communication/website/posts/jekyll.html.erb @@ -2,7 +2,9 @@ title: "<%= @post.title %>" date: <%= @post.published_at %> UTC slug: "<%= @post.slug %>" -description: "<%= prepare_for_github @post.description %>" -text: "<%= prepare_for_github @post.text %>" +description: > + <%= prepare_for_github @post.description %> +text: > + <%= prepare_for_github @post.text %> --- <%= @post.content_without_frontmatter.html_safe %> diff --git a/db/schema.rb b/db/schema.rb index f632ae2c05a47280fa04d5f847ea48702ed15764..cbe2bcb20af8a173ac556f6640a78e9fc689d530 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -264,7 +264,7 @@ ActiveRecord::Schema.define(version: 2021_10_21_152728) do t.uuid "research_journal_id", null: false t.uuid "research_journal_volume_id" t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.date "updated_at", null: false t.uuid "updated_by_id" t.text "abstract" t.text "references"