Skip to content

Commit

Permalink
Merge pull request diaspora#1 from Gosha/greentext
Browse files Browse the repository at this point in the history
Use greentext format when formatting blockquotes
  • Loading branch information
Podricing committed Mar 31, 2014
2 parents 025422e + e1a995a commit a39e9d6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/assets/javascripts/app/helpers/text_formatter.js
Expand Up @@ -19,6 +19,15 @@ $(function() {
textFormatter.markdownify = function markdownify(text){
var converter = Markdown.getSanitizingConverter();

converter.hooks.chain("preConversion", function(text) {
return text
// Move lines immediatly following a quote another line down
.replace(/(>[^\r\n]*\r?\n)([^>])/g, "$1\r\n$2")
// Replace ">..." with ">\\>...<br>" and let markdown do the rest
.replace(/^>([^\r\n]*)(\r?\n|$)/gm, ">\\>$1<br>\r\n")
;
});

// punycode non-ascii chars in urls
converter.hooks.chain("preConversion", function(text) {

Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/application.css.sass
Expand Up @@ -229,6 +229,12 @@ ul.as-selections
:bottom 10px

.stream_element

blockquote
:color #789922
:font-style normal
:margin-left 0

a.author
:font-weight bold
:unicode-bidi bidi-override
Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/mobile.css.scss
Expand Up @@ -79,6 +79,14 @@ h3 {
font: {
weight: normal; }; }
padding: 0 !important;

blockquote {
color: #789922;
font-style: normal;
margin-left: 0;
border-left: none;
padding-left: 0;
}
}
.shield{
padding: 10px;
Expand Down
7 changes: 7 additions & 0 deletions lib/diaspora/markdownify/html.rb
Expand Up @@ -8,6 +8,13 @@ def autolink(link, type)
auto_link(link, :link => :urls, :html => { :target => "_blank" })
end

def block_quote(text)
Rails.logger.info(text.dump)

ret = text.gsub(/(<p>|\n)(?=[^$])/, "&gt;")
"<blockquote>" + ret + "</blockquote>"
end

end
end
end

0 comments on commit a39e9d6

Please sign in to comment.