diff --git a/README.md b/README.md index 20da73c..c0797b9 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,17 @@ To include the entire file: {% remote_include https://raw.githubusercontent.com/jekyll/jekyll/master/README.markdown %} ``` -To include only a portion of the file, specify the begin and end tokens separated by the pipe (|) character: +To include only a portion of the file, specify the begin and end tokens separated by two pipe characters (||): ```liquid -{% remote_include https://raw.githubusercontent.com/jekyll/jekyll/master/README.markdown|begin_token|end_token %} +{% remote_include https://raw.githubusercontent.com/jekyll/jekyll/master/README.markdown||begin_token||end_token %} +``` + +URLs can also support using liquid: + +```liquid +{% assign x = "https://raw.githubusercontent.com/jekyll/jekyll/master/README.markdown" %} +{% remote_include {{ x }} %} ``` The `on_token_error` configuration option handles scenarios where the linked file doesn't contain the begin or end tokens. The build log will include information about which file contains the token error and whether the begin or end token is missing. diff --git a/jekyll-remote-include.gemspec b/jekyll-remote-include.gemspec index 7165b05..277c560 100644 --- a/jekyll-remote-include.gemspec +++ b/jekyll-remote-include.gemspec @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |spec| spec.name = "jekyll-remote-include" - spec.version = "1.1.5" + spec.version = "1.1.6" spec.authors = ["Jason Maggiacomo", "Kris Northfield", "Ian Evans"] spec.summary = "A Liquid tag plugin for Jekyll that allows remote includes from external assets." spec.homepage = "https://github.com/ianjevans/jekyll-remote-include" diff --git a/lib/jekyll-remote-include.rb b/lib/jekyll-remote-include.rb index 5e88584..c7771f2 100644 --- a/lib/jekyll-remote-include.rb +++ b/lib/jekyll-remote-include.rb @@ -38,7 +38,7 @@ def render(context) @logger = Logger.new(STDOUT) # get the remote URL and see if the string has begin/end tokens input_split = split_params(@remote_include) - url = input_split[0] + url = Liquid::Template.parse(input_split[0]).render(@context) if input_split.length() > 1 # first parameter is the begin token string begin_token = input_split[1] @@ -78,7 +78,7 @@ def render(context) end def split_params(params) - params.split("|").map(&:strip) + params.split("||").map(&:strip) end end end