Skip to content

Commit 44e1351

Browse files
committed
1. Added condition to full_url filter to allow it to be used as a root_url appending filter for remapping root "/" urls when octopress is deployed to a subdirectory. Updated _includes/article and _layouts/page to use the filter
2. Added documentation for the include_code plugin
1 parent 05e4b79 commit 44e1351

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

.themes/classic/source/_includes/article.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ <h1 class="entry-title">{{ page.title | titlecase }}</h1>
1111
</header>
1212
{% endunless %}
1313
{% if index %}
14-
<div class="entry-content">{{ content | exerpt | smart_quotes }}</div>
14+
<div class="entry-content">{{ content | full_urls: site.root | exerpt | smart_quotes }}</div>
1515
<footer>
1616
<a rel="full-article" href="{{ site.root }}{{ post.url }}">Read on &rarr;</a>
1717
</footer>
1818
{% else %}
19-
<div class="entry-content">{{ content | smart_quotes }}</div>
19+
<div class="entry-content">{{ content | full_urls: site.root | smart_quotes }}</div>
2020
{% endif %}

.themes/classic/source/_layouts/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
99
{% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %}
1010
</header>
11-
{{ content | smart_quotes }}
11+
{{ content | full_urls: site.root | smart_quotes }}
1212
{% unless page.footer == false %}
1313
<footer>
1414
{% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %}

plugins/custom_filters.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def summary(input)
2121

2222
# Replaces relative urls with full urls
2323
def full_urls(input, url='')
24+
url ||= ''
2425
input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]+)/ do
2526
$1+url+$3
2627
end

plugins/include_code.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
#
66
# Syntax {% include_code path/to/file %}
77
#
8-
# Example:
8+
# Example 1:
99
# {% include_code javascripts/test.js %}
1010
#
1111
# This will import test.js from source/downloads/code/javascripts/test.js
1212
# and output the contents in a syntax highlighted code block inside a figure,
1313
# with a figcaption listing the file name and download link
1414
#
15+
# Example 2:
16+
# You can also include an optional title for the <figcaption>
17+
#
18+
# {% include_code Example 2 javascripts/test.js %}
19+
#
20+
# will output a figcaption with the title: Example 2 (test.js)
21+
#
1522

1623
require 'pathname'
1724

0 commit comments

Comments
 (0)