From 2ee16734eab4125c7398d93a1fe414e498073c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= Date: Mon, 6 Oct 2014 15:41:00 +0300 Subject: [PATCH 1/2] Add whitespace to the left of hyphen --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index cba1fe8e67..d8c2bb59bd 100644 --- a/_config.yml +++ b/_config.yml @@ -1,7 +1,7 @@ markdown: kramdown title: "Scala Documentation" -description: "Documentation for the Scala programming language- Tutorials, Overviews, Cheatsheets, and more." +description: "Documentation for the Scala programming language - Tutorials, Overviews, Cheatsheets, and more." keywords: - Scala - Documentation From db86953a138f080609330f7bb5188e61124fb50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionu=C8=9B=20G=2E=20Stan?= Date: Mon, 6 Oct 2014 15:41:45 +0300 Subject: [PATCH 2/2] Fix title capitalization The language backing Liquid templates is quite dubios and the `capitalize` filter wasn't actually doing what was intended. As such, a `partof` property with a value of "foo-bar" was rendered as ['foo', 'bar'] in the title. Using a plugin seems to be the easiest way to solve this problem. Solution from here: http://stackoverflow.com/a/23453152/58808 --- _includes/header.txt | 2 +- _plugins/capitalize_all.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 _plugins/capitalize_all.rb diff --git a/_includes/header.txt b/_includes/header.txt index ed3a8c15aa..38739eb338 100644 --- a/_includes/header.txt +++ b/_includes/header.txt @@ -2,7 +2,7 @@ - {% if page.partof %}{{ page.partof | replace: '-',' ' | split:" " | capitalize | join:" " }} - {% endif %}{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }} + {% if page.partof %}{{ page.partof | replace: '-',' ' | capitalize_all }} - {% endif %}{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }} {% if page.description %} {% endif %} diff --git a/_plugins/capitalize_all.rb b/_plugins/capitalize_all.rb new file mode 100644 index 0000000000..87850aa996 --- /dev/null +++ b/_plugins/capitalize_all.rb @@ -0,0 +1,11 @@ +require 'liquid' +require 'uri' + +# Capitalize all words of the input +module CapitalizeAll + def capitalize_all(words) + return words.split(' ').map(&:capitalize).join(' ') + end +end + +Liquid::Template.register_filter(CapitalizeAll)