Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 foo = "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.
Expand Down
2 changes: 1 addition & 1 deletion jekyll-remote-include.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll-remote-include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -78,7 +78,7 @@ def render(context)
end

def split_params(params)
params.split("|").map(&:strip)
params.split("||").map(&:strip)
end
end
end
Expand Down