From b02094230f56d2b6e853cd7dc88529edd800c63a Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Mon, 27 Mar 2017 13:00:33 -0500 Subject: [PATCH] Merge spring-projects/gh-pages (#748) * Display Pivotal Education related courseware This change adds a new "Related Courseware" section in the side container; this section lists links to courses and talks that are relevant to the current project page. Relevant content is fetched by the browser, with an AJAX request sent to the Pivotal Education LMS API. This API uses the Referrer HTTP header as input parameter to its content selection algorithm. Note that CORS HTTP headers are also used to allow/disallow AJAX cross domain requests. * Revert "Display Pivotal Education related courseware" This reverts commit bf15ee8a6da0f232254ac8d186184a5c274d63b3. * Conditionalize showing reference doc/api doc links If the reference doc URL of the API doc URL is empty, don't display a hyperlink. * Fix content warning issues over https When served with HTTP/2 and TLS, project pages show several mixed content errors: * the imported Google fonts * the AJAX call to spring.io to get the current project information * the newsletter iframe This commit changes URLs to use https or protocol-relative URLs when possible. This also deletes the now defunct newsletter integration. * Update for changes in github pages * Upgrade rbenv Ruby version to 2.2.0 * Fix markdown syntax error The kramdown backend doesn't support titles whithout empty lines before them. * Replace ZeroClipboard with clipboard.js For copy/paste support in our code samples, we are using the ZeroClipboard library which relies heavily on Flash. Because many browsers/extensions are disabling this plugin nowadays, this commit replaces ZeroClipboard with a native, lightweight solution for this feature. * Add rouge gem * Polish page.html Remove default attributes and other little improvements. * remove alt attribute in
* Upgrade github-pages gem to fix deprecation warnings Previously, when running bundle exec jekyll serve a false-positive deprecation warning was reported: Deprecation: Auto-regeneration can no longer be set from your configuration file(s). Use the --[no-]watch/-w command-line option instead. See https://github.com/jekyll/jekyll/issues/4831 for some details. Jekyll 3.0.5 fixes the problem. This commit upgrades to the latest version of github-pages, thereby also upgrading to Jekyll 3.0.5 * Jekyll must be run with "bundle exec" command * Add defensive check for empty repository key --- .ruby-version | 2 +- Gemfile | 1 + Gemfile.lock | 157 +++++++++++++++++++++++-------- README.markdown | 7 +- _config.yml | 22 +++-- _includes/badges.html | 4 +- _includes/page.html | 50 +++++----- _includes/widget_templates.html | 8 +- _sample-pages/project.html | 1 + js/ZeroClipboard.min.js | 8 -- js/ZeroClipboard.swf | Bin 1635 -> 0 bytes js/clipboard.min.js | 7 ++ js/copySnippets.js | 41 +++++--- js/projectDocumentationWidget.js | 6 +- 14 files changed, 208 insertions(+), 106 deletions(-) delete mode 100755 js/ZeroClipboard.min.js delete mode 100644 js/ZeroClipboard.swf create mode 100644 js/clipboard.min.js diff --git a/.ruby-version b/.ruby-version index 31af4996..76521af3 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-1.9.3 \ No newline at end of file +ruby-2.2.0 diff --git a/Gemfile b/Gemfile index a28dfb22..1fec7691 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ source "http://rubygems.org" gem "github-pages" +gem "rouge" diff --git a/Gemfile.lock b/Gemfile.lock index 91118af4..53819a4f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,50 +1,129 @@ GEM remote: http://rubygems.org/ specs: - RedCloth (4.2.9) - classifier (1.3.3) - fast-stemmer (>= 1.0.0) + activesupport (4.2.6) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + addressable (2.4.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) colorator (0.1) - commander (4.1.5) - highline (~> 1.6.11) - directory_watcher (1.4.1) - fast-stemmer (1.0.2) - github-pages (1) - RedCloth (= 4.2.9) - jekyll (= 1.1.2) - kramdown (= 1.0.2) - liquid (= 2.5.1) - maruku (= 0.6.1) - rdiscount (= 1.6.8) - redcarpet (= 2.2.2) - highline (1.6.19) - jekyll (1.1.2) - classifier (~> 1.3) + ethon (0.9.0) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) + ffi (1.9.13) + gemoji (2.1.0) + github-pages (86) + github-pages-health-check (= 1.1.0) + jekyll (= 3.1.6) + jekyll-coffeescript (= 1.0.1) + jekyll-feed (= 0.5.1) + jekyll-gist (= 1.4.0) + jekyll-github-metadata (= 2.0.2) + jekyll-mentions (= 1.1.3) + jekyll-paginate (= 1.1.0) + jekyll-redirect-from (= 0.10.0) + jekyll-sass-converter (= 1.3.0) + jekyll-seo-tag (= 2.0.0) + jekyll-sitemap (= 0.10.0) + jemoji (= 0.6.2) + kramdown (= 1.11.1) + liquid (= 3.0.6) + listen (= 3.0.6) + mercenary (~> 0.3) + rouge (= 1.11.1) + terminal-table (~> 1.4) + github-pages-health-check (1.1.0) + addressable (~> 2.3) + net-dns (~> 0.8) + octokit (~> 4.0) + public_suffix (~> 1.4) + typhoeus (~> 0.7) + html-pipeline (2.4.1) + activesupport (>= 2, < 5) + nokogiri (>= 1.4) + i18n (0.7.0) + jekyll (3.1.6) colorator (~> 0.1) - commander (~> 4.1.3) - directory_watcher (~> 1.4.1) - kramdown (~> 1.0.2) - liquid (~> 2.5.1) - maruku (~> 0.5) - pygments.rb (~> 0.5.0) - redcarpet (~> 2.2.2) - safe_yaml (~> 0.7.0) - kramdown (1.0.2) - liquid (2.5.1) - maruku (0.6.1) - syntax (>= 1.0.0) - posix-spawn (0.3.6) - pygments.rb (0.5.2) - posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) - rdiscount (1.6.8) - redcarpet (2.2.2) - safe_yaml (0.7.1) - syntax (1.0.0) - yajl-ruby (1.1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.3) + liquid (~> 3.0) + mercenary (~> 0.3.3) + rouge (~> 1.7) + safe_yaml (~> 1.0) + jekyll-coffeescript (1.0.1) + coffee-script (~> 2.2) + jekyll-feed (0.5.1) + jekyll-gist (1.4.0) + octokit (~> 4.2) + jekyll-github-metadata (2.0.2) + jekyll (~> 3.1) + octokit (~> 4.0) + jekyll-mentions (1.1.3) + html-pipeline (~> 2.3) + jekyll (~> 3.0) + jekyll-paginate (1.1.0) + jekyll-redirect-from (0.10.0) + jekyll (>= 2.0) + jekyll-sass-converter (1.3.0) + sass (~> 3.2) + jekyll-seo-tag (2.0.0) + jekyll (~> 3.1) + jekyll-sitemap (0.10.0) + jekyll-watch (1.4.0) + listen (~> 3.0, < 3.1) + jemoji (0.6.2) + gemoji (~> 2.0) + html-pipeline (~> 2.2) + jekyll (>= 3.0) + json (1.8.3) + kramdown (1.11.1) + liquid (3.0.6) + listen (3.0.6) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9.7) + mercenary (0.3.6) + mini_portile2 (2.1.0) + minitest (5.9.0) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) + octokit (4.3.0) + sawyer (~> 0.7.0, >= 0.5.3) + pkg-config (1.1.7) + public_suffix (1.5.3) + rb-fsevent (0.9.7) + rb-inotify (0.9.7) + ffi (>= 0.5.0) + rouge (1.11.1) + safe_yaml (1.0.4) + sass (3.4.22) + sawyer (0.7.0) + addressable (>= 2.3.5, < 2.5) + faraday (~> 0.8, < 0.10) + terminal-table (1.6.0) + thread_safe (0.3.5) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) PLATFORMS ruby DEPENDENCIES github-pages + rouge + +BUNDLED WITH + 1.12.5 diff --git a/README.markdown b/README.markdown index b41e3d44..96afe56b 100644 --- a/README.markdown +++ b/README.markdown @@ -4,6 +4,9 @@ Spring's project pages are based on [Jekyll](http://jekyllrb.com) and [GitHub Pa This approach may sound a little funky (and it is), but it's way better than the misery of Git submodules. In fact, it's actually pretty easy. If you're just getting started, then follow the directions immediately below. If you're needing a refresher on how to keep things up to date, then head to the section at the bottom on "keeping up to date". +> ***Note:*** Github changed their rendering (a lot) in April 2016. If you are seeing pages build failures since that time, then you probably need to merge some changes from this upstream. Follow the instructions below, and for testing locally use rubiy 2.x and don't forget to `bundle exec ...` everything. + + # How to start a new `gh-pages` project page @@ -95,7 +98,7 @@ Assuming you're already within your project's clone directory, and you've alread ### Install jekyll if you have not already -> **Note:** Jekyll 1.1.2 is a known good version, and it is specifically referred to in `Gemfile.lock` so you have to use `bundle` (not `gem install ...`) to install it: +> **Note:** Jekyll 3.0.4 is a known good version, and it is specifically referred to in `Gemfile.lock` so you have to use `bundle` (not `gem install ...`) to install it: gem install bundler bundle @@ -104,7 +107,7 @@ Assuming you're already within your project's clone directory, and you've alread Use the `--watch` flag to pick up changes to files as you make them, allowing you a nice edit-and-refresh workflow. - jekyll serve --watch + bundle exec jekyll serve --watch > **Important:** Because the `baseurl` is set explicitly within your project's `_config.yml` file, you'll need to fully-qualify the URL to view your project. For example, if your project is named "spring-xyz", your URL when running Jekyll locally will be . Don't forget the trailing slash! You'll get a 404 without it. diff --git a/_config.yml b/_config.yml index 9c4eb1f0..657aca22 100644 --- a/_config.yml +++ b/_config.yml @@ -1,11 +1,17 @@ ### Global gh-pages pre-amble safe: true lsi: false -pygments: true -markdown: redcarpet -redcarpet: - extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "with_toc_data"] - +highlighter: rouge +markdown: kramdown +encoding: UTF-8 +github: [metadata] +kramdown: + input: GFM + hard_wrap: false + smart_quotes: ["apos", "apos", "quot", "quot"] +gems: + - jekyll-coffeescript + - jekyll-paginate ### The following properties will change on a project-by-project basis @@ -32,6 +38,6 @@ custom_gradle_template: false ### The following properties are constant for most projects -main_site_url: http://spring.io -projects_site_url: http://projects.spring.io -questions_url: http://spring.io/questions +main_site_url: https://spring.io +projects_site_url: https://projects.spring.io +questions_url: https://spring.io/questions diff --git a/_includes/badges.html b/_includes/badges.html index ae873f45..e9d8571b 100644 --- a/_includes/badges.html +++ b/_includes/badges.html @@ -1,7 +1,7 @@ {% if page.badges.twitter %}
diff --git a/_includes/widget_templates.html b/_includes/widget_templates.html index 4e609c6f..b06f96e9 100644 --- a/_includes/widget_templates.html +++ b/_includes/widget_templates.html @@ -18,8 +18,12 @@
- Reference - API + {@ if (release.refDocUrl !== '') { @} + Reference + {@ }; @} + {@ if (release.apiDocUrl !== '') { @} + API + {@ }; @}
{@ }); @} diff --git a/_sample-pages/project.html b/_sample-pages/project.html index b0435da4..0fdee0b0 100644 --- a/_sample-pages/project.html +++ b/_sample-pages/project.html @@ -75,6 +75,7 @@ corpus callosum! * ... + ## Quick Start {% include download_widget.md %} diff --git a/js/ZeroClipboard.min.js b/js/ZeroClipboard.min.js deleted file mode 100755 index 32535fdd..00000000 --- a/js/ZeroClipboard.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * zeroclipboard - * The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface. - * Copyright 2012 Jon Rohan, James M. Greene, . - * Released under the MIT license - * http://jonrohan.github.com/ZeroClipboard/ - * v1.1.7 - */(function(){"use strict";var a=function(a,b){var c=a.style[b];a.currentStyle?c=a.currentStyle[b]:window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b));if(c=="auto"&&b=="cursor"){var d=["a"];for(var e=0;e=0?"&":"?")+"nocache="+(new Date).getTime()},i=function(a){var b=[];return a.trustedDomains&&(typeof a.trustedDomains=="string"?b.push("trustedDomain="+a.trustedDomains):b.push("trustedDomain="+a.trustedDomains.join(","))),b.join("&")},j=function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c ';b=document.createElement("div"),b.id="global-zeroclipboard-html-bridge",b.setAttribute("class","global-zeroclipboard-container"),b.setAttribute("data-clipboard-ready",!1),b.style.position="absolute",b.style.left="-9999px",b.style.top="-9999px",b.style.width="15px",b.style.height="15px",b.style.zIndex="9999",b.innerHTML=c,document.body.appendChild(b)}a.htmlBridge=b,a.flashBridge=document["global-zeroclipboard-flash-bridge"]||b.children[0].lastElementChild};l.prototype.resetBridge=function(){this.htmlBridge.style.left="-9999px",this.htmlBridge.style.top="-9999px",this.htmlBridge.removeAttribute("title"),this.htmlBridge.removeAttribute("data-clipboard-text"),f(m,this.options.activeClass),m=null,this.options.text=null},l.prototype.ready=function(){var a=this.htmlBridge.getAttribute("data-clipboard-ready");return a==="true"||a===!0},l.prototype.reposition=function(){if(!m)return!1;var a=g(m);this.htmlBridge.style.top=a.top+"px",this.htmlBridge.style.left=a.left+"px",this.htmlBridge.style.width=a.width+"px",this.htmlBridge.style.height=a.height+"px",this.htmlBridge.style.zIndex=a.zIndex+1,this.setSize(a.width,a.height)},l.dispatch=function(a,b){l.prototype._singleton.receiveEvent(a,b)},l.prototype.on=function(a,b){var c=a.toString().split(/\s/g);for(var d=0;d<|i+I>}9Z`;@rK0}c_ByHJ}?I?+JQ#Rf>o5+@IXOp$p(Z-Ri zjT772`m$RD392LV(Bg(7Rg&_hFAWOxAN0NGOaDNhi~fKD1)ZSidmk2k>@TQ0hg5vo zE=owlnQtyU^UY8?B=SEA8Tlh2SAf*>R|z4%9{(#4vK(0U(pJ4uJnXt&xP;b|=}r{& zmdfRWgM-h(sVY9a1 zkDg3V52{+`Y0+LkaFddjS>`V9axV(YbF*_;$TF8~Kj^Zk%6dK5F_|b=KAZ_VzWMfm z?eiJiWnpKzd=@BjA}4Zrb;a`Ayx4I0Vew&c#`g_=pL=%e=il+vC;M&BS+V zCud|4ufAYjaqe-cIA57tNRJ`VEz_(m65>-tN4}GKfEHz z_4|MSZfzMS{x{{yPu=Wy+dRl#cw9CuVL4&XWk>3E zFK{BRw);`!dzy(+JNz&*x}r4Zm~Zt&ZSM0xOSOKKLUrVoCfaUK>+*=zS;T0_BT*oW z_vg&BYW*Pe1A%Tkzv4<5A;;3ry24y%&!e8dZ8DeZp^zKC#f^2JSv*+tY+nw1KQi1? z+vqXDPQ-&S8wLF^;#S@7GRM0;SfjHQTG?JG&sQps%I&`6Mvga>w%m^#H=MZ8{!-fh z)J3qK-cwF%KE7&>$AeoJgVsDe3Ns^TpQnM>{!fwX=jXPRj7<1hWa7dOh8iAWPhD-B zn|(af5xiEgfD=itU(4V7*aUN3{~&GINXI1@%Od}0L~DBi>vbG6)Z2W|@fwcn8VTp$ zIabseO4R4v+3Q4_6|jRXJQ|Lo*I^p7tXju$Ev2@;R(qL4GdbnDgNMTAjg98+_UbR1 z->z=y19f+20M?t|ZEC5y`_0Ip(?ev(V{U$Rpd@tJ%;ZDjN!Ux9nQsdhHZ!44P$G+| z%eWJ+x}A_RjQevMrs0TtE-r!`iABTLl5O!{_PN-Il*(^$NAT4guCX3#JIJBKL%N@W zDs!Wk{D_)S;No2iJB}>?9=&g< zDkD@GrAm$}d8&+2Wt_qUg-a9)6fRS^O5qyKT&Hk@!c7Xd^divQXZi!sXMn;ig))T- zg*giI6c#8vr0_X~M-(1Y_=3VBg(V7KQdp+&gyz4Z@RUN0=IRtysrGYH#4?@bEdQ0Zqhvqdx8G_y1O@y825`e`9$qzuudG)5LeK@e2+V|?A`Jt{WP!*dK$KA+Y7Pj^1JTBS=;I&)F^tMUhOwfiXX47&2q}_o z`~Yz!UL&oE(iL_IV-xg6V9?5mB-U{Aiw{QcOzHa12`>pCi>`;8k=Dm89G^A^N! zv=^4gKlNo5}D1^E12w0geG*f|H4sc!7VmEvzrxwO`LWIx`8cbR`2 zi(z~?w!dJDD3{omD3{rjDPk(`e`Bh-aYFRA+E#92+K0CMzAf8TR-IRs{0}E5nyM)u zp5yLF_)v&NUi0)~{)jnM({70UPQDZ)b%ZqJ>#!bvMrX{}UR&nm52 hrB$!AH2nOW+(@nt#n7>F@%Mf4Z~ZAE{{=lE$MA>_KQRCR diff --git a/js/clipboard.min.js b/js/clipboard.min.js new file mode 100644 index 00000000..e4f73100 --- /dev/null +++ b/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.10 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(c,a){if(!n[c]){if(!e[c]){var s="function"==typeof require&&require;if(!a&&s)return s(c,!0);if(r)return r(c,!0);var l=new Error("Cannot find module '"+c+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[c]={exports:{}};e[c][0].call(u.exports,function(t){var n=e[c][1][t];return i(n?n:t)},u,u.exports,t,e,n,o)}return n[c].exports}for(var r="function"==typeof require&&require,c=0;co;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,c=o.length;c>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var c={exports:{}};r(c,i.select),i.clipboardAction=c.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=function(){function t(t,e){for(var n=0;n pre").each(function(index) { - Spring.buildCopyButton($(this), index); - } - ); - } + + $("pre.highlight").each(function(index) { + Spring.buildCopyButton($(this), index); + } + ); + var errorMessage = function() { + if (/Mac/i.test(navigator.userAgent)) { + return 'Press Cmd-C to Copy'; + } + else { + return 'Press Ctrl-C to Copy'; + } + }; + var snippets = new Clipboard('.copy-button'); + snippets.on('success', function(e) { + e.clearSelection(); + Spring.showTooltip(e.trigger, "Copied!"); + }); + snippets.on('error', function(e) { + Spring.showTooltip(e.trigger, errorMessage()); + }); +} + +Spring.showTooltip = function(elem, message) { + $(elem).tooltip({placement:'right', title:message}); + $(elem).tooltip('show'); + setTimeout(function(){$(elem).tooltip('destroy');},1000); } Spring.buildCopyButton = function (preEl, id) { - var codeBlockId = "code-block-"+ id; + var codeBlockId = "code-block-"+ id; var copyButtonId = "copy-button-" + id; preEl.attr('id', codeBlockId); - var button = $(''); + var button = $(''); preEl.before(button); - var zero = new ZeroClipboard(button); - $(zero.htmlBridge).tooltip({title: "copy to clipboard", placement: 'bottom'}); } diff --git a/js/projectDocumentationWidget.js b/js/projectDocumentationWidget.js index 900dab21..a52d9ba6 100644 --- a/js/projectDocumentationWidget.js +++ b/js/projectDocumentationWidget.js @@ -95,7 +95,7 @@ Spring.SnippetView = Backbone.View.extend({ this.combinedTemplate = _.template( "
" +
         downloadTemplate.find("code:first").html() +
-        "{@ if (repository) { @}" +
+        "{@ if (typeof(repository) != \"undefined\") { @}" +
         repositoryTemplate.find("code:first").html() +
         "{@ } @}" +
         "
" @@ -107,9 +107,7 @@ Spring.SnippetView = Backbone.View.extend({ var html = $(this.combinedTemplate(this.model)); this.$el.html(html); - if (ZeroClipboard.detectFlashSupport()) { - Spring.buildCopyButton(html.find(":first"), "snippet"); - } + Spring.buildCopyButton(html.find(":first"), "snippet"); return this; },