vim-jp/vim-jp.github.io

Patchesの表示が冗長

k-takata opened this issue · 7 comments

ページの右側に表示されるPatchesの表示が冗長に思います。

vim-jp-patches

この例だと、patch 8.0.0454: compiler warnings for "always true" comparison の部分は不要だと思います。また、"" として表示されるべきでしょう。

--- a/assets/javascripts/patch-list.js
+++ b/assets/javascripts/patch-list.js
@@ -5,7 +5,7 @@ $(function() {
     $.each(items, function() {
       $('<li/>').append(
         $('<a/>').attr({'href': this.link, 'target': '_blank'}).text("Patch " + this.title)
-      ).append($('<br/>')).append($('<span/>').text(this.description)).appendTo('#patches-list');
+      ).append($('<br/>')).append($('<span/>').text(this.description.replace(/^[^\n]*\n\n/, '').replace(/&quot;/g, '"'))).appendTo('#patches-list');
     });
   });
 });

とりあえず、こんなパッチを当てれば表示は改善されますが、これでいいのかは分かりません。
また、&quot; だけではなく、&lt;, &gt;, &amp; なども対応が必要かもしれません。

&#39; もデコードが必要でした。
あと、Solution:の前に改行を入れた方が見やすそう。

--- a/assets/javascripts/patch-list.js
+++ b/assets/javascripts/patch-list.js
@@ -3,9 +3,10 @@ $(function() {
 
   $.getJSON("//vim-jp.herokuapp.com/patches/json?callback=?", function(items) {
     $.each(items, function() {
+      var desc = $('<div/>').html(this.description).text().replace(/^[^\n]*\n\n/, '').replace(/\n(?=Solution:)/, '<br/>')
       $('<li/>').append(
         $('<a/>').attr({'href': this.link, 'target': '_blank'}).text("Patch " + this.title)
-      ).append($('<br/>')).append($('<span/>').text(this.description)).appendTo('#patches-list');
+      ).append($('<br/>')).append($('<span/>').html(desc)).appendTo('#patches-list');
     });
   });
 });

vim-jp-patches2

修正をコミットしました。
http://vim-jp.herokuapp.com/patches/json の仕様がどうなっているのかは知りませんが、意図通り動いているように見えます。

twitterのvim_jpアカウントのツイートも改善されるとうれしいな
https://twitter.com/vim_jp/status/842492142790606848
8.0.0470: patch 8.0.0470:

@mattn さんの担当?

mattn commented

あー、Bram が書き方を変えたのか。

mattn commented

やっときまーす。

mattn commented

heroku のリソースがきつくなって続行が難しくなってしまった。Google App Engine 等に移行を考え中。