twrpme: add gitactivity changelog tag to device markdowns

Change-Id: I437a42c1b2ccd79b3f85ad0962c362680c28d171
diff --git a/_config.yml b/_config.yml
index 615dfea..50217ba 100644
--- a/_config.yml
+++ b/_config.yml
@@ -7,9 +7,9 @@
 baseurl: "" # the subpath of your site, e.g. /blog/
 url: "http://twrp.me" # the base hostname & protocol for your site
 github_username: TeamWin
-
+gems: ['git', 'redcarpet']
 # Build settings
-markdown: kramdown
+markdown: redcarpet
 keep_files: [project, twrp_view_all_devices, officialota, datamedia, twrpfaq, whattobackup, whattowipe, securetwrp, removetwrp, noos, contactus/submit.php]
 exclude: [project, twrp_view_all_devices, officialota, datamedia, twrpfaq, whattobackup, whattowipe, securetwrp, removetwrp, noos, contactus/submit.php]
 
diff --git a/_devices/asusTF300T.markdown b/_devices/asusTF300T.markdown
index 8935c8e..0d4d841 100644
--- a/_devices/asusTF300T.markdown
+++ b/_devices/asusTF300T.markdown
@@ -53,5 +53,3 @@
 <p class="text">adb reboot bootloader</p>
 <p class="text">You should now be in fastboot mode. Download the correct blob file and copy the file into the same folder as your adb and fastboot binaries. Rename the image to twrp.blob and type:</p>
 <p class="text">fastboot -i 0x0b05 flash staging twrp.img<p></p>fastboot reboot</p>
-
-
diff --git a/_devices/asustransformerprimeTF201.markdown b/_devices/asustransformerprimeTF201.markdown
index d3e2b02..6bfe7d5 100644
--- a/_devices/asustransformerprimeTF201.markdown
+++ b/_devices/asustransformerprimeTF201.markdown
@@ -32,5 +32,3 @@
 <p class="text">adb reboot bootloader</p>
 <p class="text">You should now be in fastboot mode. Download the correct blob file and copy the file into the same folder as your adb and fastboot binaries. Rename the image to twrp.blob and type:</p>
 <p class="text">fastboot -i 0x0b05 flash staging twrp.img<p></p>fastboot reboot</p>
-
-
diff --git a/_devices/htcevo4glte.markdown b/_devices/htcevo4glte.markdown
index 5ec0ddd..eeda53a 100644
--- a/_devices/htcevo4glte.markdown
+++ b/_devices/htcevo4glte.markdown
@@ -7,7 +7,7 @@
 supportstatus: Current
 maintainer: Dees_Troy, CaptainThrowback
 oem: HTC
-devicetree: https://github.com/TeamWin/android_device_htc_jewel/tree/android-5.0
+devicetree: https://github.com/TeamWin/android_device_htc_jewel.git
 xdathread: "http://forum.xda-developers.com/evo-4g-lte-sprint/orig-development/recovery-twrp-touch-recovery-t3068193"
 ddof: "/dev/block/mmcblk0p22"
 ---
diff --git a/_devices/lggpad101.markdown b/_devices/lggpad101.markdown
index 1de6646..f854970 100644
--- a/_devices/lggpad101.markdown
+++ b/_devices/lggpad101.markdown
@@ -6,7 +6,7 @@
 supportstatus: Current
 maintainer: Dark_Nightmare
 oem: LG
-devicetree: https://github.com/TeamWin/android_device_lge_e9wifi
+devicetree: https://github.com/TeamWin/android_device_lge_e9wifi.git
 ddof: "/dev/block/platform/msm_sdcc.1/by-name/recovery"
 ---
 
diff --git a/_devices/samsunggalaxygrandprimeve.markdown b/_devices/samsunggalaxygrandprimeve.markdown
index f61f463..f9a0368 100644
--- a/_devices/samsunggalaxygrandprimeve.markdown
+++ b/_devices/samsunggalaxygrandprimeve.markdown
@@ -7,7 +7,7 @@
 maintainer: None
 oem: Samsung
 ddof: "/dev/block/platform/soc.2/by-name/RECOVERY"
-devicetree: "https://github.com/TeamWin/android_device_samsung_grandprimevelte"
+devicetree: https://github.com/TeamWin/android_device_samsung_grandprimevelte.git
 ---
 
 {% include disclaimer.html %}
diff --git a/_devices/samsunggalaxynote3qualcomm.markdown b/_devices/samsunggalaxynote3qualcomm.markdown
index 40392f4..1d78781 100644
--- a/_devices/samsunggalaxynote3qualcomm.markdown
+++ b/_devices/samsunggalaxynote3qualcomm.markdown
@@ -8,7 +8,7 @@
 maintainer: jcadduono
 oem: Samsung
 ddof: "/dev/block/platform/msm_sdcc.1/by-name/recovery"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_hlte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_hlte"
 xdathread: "http://forum.xda-developers.com/showthread.php?t=2494245"
 ---
 
diff --git a/_devices/samsunggalaxynote5.markdown b/_devices/samsunggalaxynote5.markdown
index 6a533a9..eca11f8 100644
--- a/_devices/samsunggalaxynote5.markdown
+++ b/_devices/samsunggalaxynote5.markdown
@@ -7,7 +7,7 @@
 maintainer: "jcadduono, bigbiff"
 oem: Samsung
 ddof: "/dev/block/platform/15570000.ufs/by-name/RECOVERY"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_noblelte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_noblelte"
 xdathread: "http://forum.xda-developers.com/note5/orig-development/twrp-2-8-7-0-official-t3195262"
 ---
 
diff --git a/_devices/samsunggalaxys5qualcomm.markdown b/_devices/samsunggalaxys5qualcomm.markdown
index 9f2de97..8c97860 100644
--- a/_devices/samsunggalaxys5qualcomm.markdown
+++ b/_devices/samsunggalaxys5qualcomm.markdown
@@ -8,7 +8,7 @@
 maintainer: jcadduono
 oem: Samsung
 ddof: "/dev/block/platform/msm_sdcc.1/by-name/recovery"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_klte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_klte"
 xdathread: "http://forum.xda-developers.com/showthread.php?t=2727406"
 ---
 
diff --git a/_devices/samsunggalaxys6.markdown b/_devices/samsunggalaxys6.markdown
index 90026c6..80dc959 100644
--- a/_devices/samsunggalaxys6.markdown
+++ b/_devices/samsunggalaxys6.markdown
@@ -7,7 +7,7 @@
 maintainer: "jcadduono, bigbiff"
 oem: Samsung
 ddof: "/dev/block/platform/15570000.ufs/by-name/RECOVERY"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_zeroflte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_zeroflte"
 xdathread: "http://forum.xda-developers.com/galaxy-s6/orig-development/twrp-t3080940"
 ---
 
diff --git a/_devices/samsunggalaxys6edge.markdown b/_devices/samsunggalaxys6edge.markdown
index 53c7c66..aeb3eaa 100644
--- a/_devices/samsunggalaxys6edge.markdown
+++ b/_devices/samsunggalaxys6edge.markdown
@@ -7,7 +7,7 @@
 maintainer: "jcadduono, bigbiff"
 oem: Samsung
 ddof: "/dev/block/platform/15570000.ufs/by-name/RECOVERY"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_zerolte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_zerolte"
 xdathread: "http://forum.xda-developers.com/galaxy-s6-edge/orig-development/recovery-official-twrp-galaxy-s6-edge-t3354508"
 ---
 
diff --git a/_devices/samsunggalaxys6edgeplus.markdown b/_devices/samsunggalaxys6edgeplus.markdown
index e2dd954..df1277d 100644
--- a/_devices/samsunggalaxys6edgeplus.markdown
+++ b/_devices/samsunggalaxys6edgeplus.markdown
@@ -7,7 +7,7 @@
 maintainer: "jcadduono"
 oem: Samsung
 ddof: "/dev/block/platform/15570000.ufs/by-name/RECOVERY"
-devicetree: "https://github.com/TeamWin?utf8=%E2%9C%93&query=android_device_samsung_zenlte"
+devicetree: "https://github.com/TeamWin/android_device_samsung_zenlte"
 xdathread: "http://forum.xda-developers.com/s6-edge-plus/orig-development/recovery-official-twrp-galaxy-s6-edge-t3354492"
 ---
 
diff --git a/_devices/samsunggalaxytab77.markdown b/_devices/samsunggalaxytab77.markdown
index 9629aa0..ce39bb8 100644
--- a/_devices/samsunggalaxytab77.markdown
+++ b/_devices/samsunggalaxytab77.markdown
@@ -5,6 +5,7 @@
 downloadfolder: degas
 oldurl: http://teamw.in/project/twrp2/108
 supportstatus: Current
+devicetree: https://github.com/TeamWin/android_device_samsung_degas.git
 maintainer: None
 oem: Samsung
 ---
diff --git a/_devices/sonyxperiaz.markdown b/_devices/sonyxperiaz.markdown
index 2d5444f..d5dcd96 100644
--- a/_devices/sonyxperiaz.markdown
+++ b/_devices/sonyxperiaz.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/187
 supportstatus: Current
 maintainer: Dees_Troy
+devicetree: https://github.com/TeamWin/android_device_sony_yuga.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiaz1.markdown b/_devices/sonyxperiaz1.markdown
index 935ca6d..ea4b5e6 100644
--- a/_devices/sonyxperiaz1.markdown
+++ b/_devices/sonyxperiaz1.markdown
@@ -5,6 +5,7 @@
 downloadfolder: honami
 supportstatus: Current
 maintainer: sdtbarbarossa
+devicetree: https://github.com/TeamWin/android_device_sony_honami.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiaz2.markdown b/_devices/sonyxperiaz2.markdown
index da21fd0..3f7904e 100644
--- a/_devices/sonyxperiaz2.markdown
+++ b/_devices/sonyxperiaz2.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/232
 supportstatus: Current
 maintainer: None
+devicetree: https://github.com/TeamWin/android_device_sony_sirius.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiaz3compact.markdown b/_devices/sonyxperiaz3compact.markdown
index b0e452c..e2ed772 100644
--- a/_devices/sonyxperiaz3compact.markdown
+++ b/_devices/sonyxperiaz3compact.markdown
@@ -5,6 +5,7 @@
 downloadfolder: z3c
 supportstatus: Current
 maintainer: someone755
+devicetree: https://github.com/TeamWin/android_device_sony_z3c.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiaz3tabetcompact.markdown b/_devices/sonyxperiaz3tabetcompact.markdown
index 903a75a..ed09d8f 100644
--- a/_devices/sonyxperiaz3tabetcompact.markdown
+++ b/_devices/sonyxperiaz3tabetcompact.markdown
@@ -5,6 +5,7 @@
 downloadfolder: scorpion_windy
 supportstatus: Current
 maintainer: Dees_Troy
+devicetree: https://github.com/TeamWin/android_device_sony_scorpion_windy.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiazl.markdown b/_devices/sonyxperiazl.markdown
index 3d50fe9..d99cac3 100644
--- a/_devices/sonyxperiazl.markdown
+++ b/_devices/sonyxperiazl.markdown
@@ -5,6 +5,7 @@
 downloadfolder: odin
 supportstatus: Current
 maintainer: humberos
+devicetree: https://github.com/TeamWin/android_device_sony_odin.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiazr.markdown b/_devices/sonyxperiazr.markdown
index 3e2554c..bc932cc 100644
--- a/_devices/sonyxperiazr.markdown
+++ b/_devices/sonyxperiazr.markdown
@@ -5,6 +5,7 @@
 downloadfolder: dogo
 supportstatus: Current
 maintainer: Chippa-a
+devicetree: https://github.com/TeamWin/android_device_sony_dogo.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/sonyxperiaztablet.markdown b/_devices/sonyxperiaztablet.markdown
index 837aba5..1588af8 100644
--- a/_devices/sonyxperiaztablet.markdown
+++ b/_devices/sonyxperiaztablet.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/185
 supportstatus: Current
 maintainer: Dees_Troy
+devicetree: https://github.com/TeamWin/android_device_sony_pollux_windy.git
 oem: Sony
 xdathread: "http://forum.xda-developers.com/showthread.php?t=2413289"
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
diff --git a/_devices/sonyxperiazultra.markdown b/_devices/sonyxperiazultra.markdown
index 683956c..bebfab2 100644
--- a/_devices/sonyxperiazultra.markdown
+++ b/_devices/sonyxperiazultra.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/219
 supportstatus: Current
 maintainer: None
+devicetree: https://github.com/TeamWin/android_device_sony_togari.git
 oem: Sony
 ddof: /dev/block/platform/msm_sdcc.1/by-name/FOTAKernel
 ---
diff --git a/_devices/xiaomimax.markdown b/_devices/xiaomimax.markdown
index e3352fb..3ae86d9 100644
--- a/_devices/xiaomimax.markdown
+++ b/_devices/xiaomimax.markdown
@@ -5,6 +5,7 @@
 downloadfolder: hydrogen
 supportstatus: Current
 maintainer: Abdess
+devicetree: https://github.com/TeamWin/android_device_xiaomi_hydrogen.git
 oem: Xiaomi
 devicetree: https://github.com/TeamWin/android_device_xiaomi_hydrogen
 ---
@@ -19,5 +20,4 @@
 
 {% include twrpinstall.html %}
 
-
 {% include fastbootinstall.html %}
diff --git a/_devices/xiaomimi3.markdown b/_devices/xiaomimi3.markdown
index b2b99f3..ed5ae61 100644
--- a/_devices/xiaomimi3.markdown
+++ b/_devices/xiaomimi3.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/288
 supportstatus: Current
 maintainer: None
+devicetree: https://github.com/TeamWin/android_device_xiaomi_cancro.git
 oem: Xiaomi
 ---
 
diff --git a/_devices/xiaomiredmi1s.markdown b/_devices/xiaomiredmi1s.markdown
index e1296f7..967d476 100644
--- a/_devices/xiaomiredmi1s.markdown
+++ b/_devices/xiaomiredmi1s.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/241
 supportstatus: Current
 maintainer: fefifofum
+devicetree: https://github.com/TeamWin/android_device_xiaomi_kenzo.git
 oem: Xiaomi
 ---
 
diff --git a/_devices/xiaomiredmi3.markdown b/_devices/xiaomiredmi3.markdown
index d979d06..cc55760 100644
--- a/_devices/xiaomiredmi3.markdown
+++ b/_devices/xiaomiredmi3.markdown
@@ -22,4 +22,3 @@
 {% include twrpinstall.html %}
 
 {% include fastbootinstall.html %}
-
diff --git a/_devices/xiaomiredminote3.markdown b/_devices/xiaomiredminote3.markdown
index 386f3c3..46f74bf 100644
--- a/_devices/xiaomiredminote3.markdown
+++ b/_devices/xiaomiredminote3.markdown
@@ -5,6 +5,7 @@
 downloadfolder: kenzo
 supportstatus: Current
 maintainer: Vibhor Chaudhary (vibhu0009)
+devicetree: https://github.com/TeamWin/android_device_xiaomi_kenzo.git
 oem: Xiaomi
 ddof: "/dev/block/platform/msm_sdcc.1/by-name/recovery"
 ---
diff --git a/_devices/xiaomiredminote4gsinglesim.markdown b/_devices/xiaomiredminote4gsinglesim.markdown
index b081aa1..2ae4e76 100644
--- a/_devices/xiaomiredminote4gsinglesim.markdown
+++ b/_devices/xiaomiredminote4gsinglesim.markdown
@@ -5,6 +5,7 @@
 downloadfolder: dior
 supportstatus: Current
 maintainer: myhellonearth
+devicetree: https://github.com/TeamWin/android_device_xiaomi_dior.git
 oem: Xiaomi
 ---
 
diff --git a/_devices/yuyureka.markdown b/_devices/yuyureka.markdown
index 5307f65..964849d 100644
--- a/_devices/yuyureka.markdown
+++ b/_devices/yuyureka.markdown
@@ -6,6 +6,7 @@
 oldurl: http://teamw.in/project/twrp2/284
 supportstatus: Current
 maintainer: Abhishek Aggarwal
+devicetree: https://github.com/TeamWin/android_device_yu_tomato
 oem: Yu
 ---
 
diff --git a/_layouts/device.html b/_layouts/device.html
index ca40b86..3dd234a 100644
--- a/_layouts/device.html
+++ b/_layouts/device.html
@@ -10,6 +10,7 @@
 
   <article class="post-content">
     {{ content }}
+    {% if page.devicetree %} {{ page.devicetree | gitactivity }} {% endif %}
   </article>
 
 </div>
diff --git a/_plugins/gitactivity.rb b/_plugins/gitactivity.rb
new file mode 100644
index 0000000..a7e6dbd
--- /dev/null
+++ b/_plugins/gitactivity.rb
@@ -0,0 +1,36 @@
+require 'rugged'
+require 'fileutils'
+require 'cgi'
+
+module Jekyll
+    module GitActivity
+
+      def gitactivity(github)
+	changelogCount = 5
+	begin
+		repo = Rugged::Repository.clone_at(github, '/tmp/gittemp', {bare: true})
+	rescue
+		return
+	end
+	walker = Rugged::Walker.new(repo)
+	walker.sorting(Rugged::SORT_DATE | Rugged::SORT_TOPO)
+	walker.push(repo.head.target);
+	puts github
+	messages = ""
+	count = 0
+	messages += "<div class='page-heading'>Changelog:</div><div>"
+	messages += "<hr/>"
+	messages += "<ul>"
+	walker.each do |commit|
+		break if count >= changelogCount
+		messages += "<li>" + commit.author[:name] + "<br/>" + commit.author[:time].to_s() + "<br/>" + commit.message + "</li><br/>"
+		count = count + 1
+	end
+	messages += "</ul></div>"
+	FileUtils.rm_rf('/tmp/gittemp')
+	"#{messages}"
+      end
+   end
+end
+
+Liquid::Template.register_filter(Jekyll::GitActivity)