File tree 2 files changed +48
-7
lines changed
2 files changed +48
-7
lines changed Original file line number Diff line number Diff line change 8
8
9
9
{{i18n.ci_intro}}
10
10
11
- {% capture travis %}{% include_relative _ci/travis.md %}{% endcapture %}
12
- {% capture semaphore %}{% include_relative _ci/semaphore.md %}{% endcapture %}
13
- {% capture appveyor %}{% include_relative _ci/appveyor.md %}{% endcapture %}
14
- {% capture circle %}{% include_relative _ci/circle.md %}{% endcapture %}
15
- {% capture codeship %}{% include_relative _ci/codeship.md %}{% endcapture %}
16
- {% capture solano %}{% include_relative _ci/solano.md %}{% endcapture %}
17
- {% capture gitlab %}{% include_relative _ci/gitlab.md %}{% endcapture %}
11
+ {% capture travis %}
12
+ {% include_relative _ci/travis.md %}
13
+ {% endcapture %}
14
+ {% capture semaphore %}
15
+ {% include_relative _ci/semaphore.md %}
16
+ {% endcapture %}
17
+ {% capture appveyor %}
18
+ {% include_relative _ci/appveyor.md %}
19
+ {% endcapture %}
20
+ {% capture circle %}
21
+ {% include_relative _ci/circle.md %}
22
+ {% endcapture %}
23
+ {% capture codeship %}
24
+ {% include_relative _ci/codeship.md %}
25
+ {% endcapture %}
26
+ {% capture solano %}
27
+ {% include_relative _ci/solano.md %}
28
+ {% endcapture %}
29
+ {% capture gitlab %}
30
+ {% capture exists %}{% file_exists _ci/gitlab.md %}{% endcapture %}
31
+ {% if exists == "true" %}
32
+ {% include_relative _ci/gitlab.md %}
33
+ {% endif %}
34
+ {% endcapture %}
18
35
19
36
20
37
< div class ="tabs ">
Original file line number Diff line number Diff line change
1
+ # source: https://github.com/michaelx/jekyll_file_exists/blob/dd363223754836a640de81ddab68fd95cebe7791/file_exists.rb
2
+ module Jekyll
3
+ class FileExistsTag < Liquid ::Tag
4
+
5
+ def initialize ( tag_name , path , tokens )
6
+ super
7
+ @path = path
8
+ end
9
+
10
+ def render ( context )
11
+ # Pipe parameter through Liquid to make additional replacements possible
12
+ url = Liquid ::Template . parse ( @path ) . render context
13
+
14
+ # Adds the site source, so that it also works with a custom one
15
+ site_source = context . registers [ :site ] . config [ 'source' ]
16
+ file_path = site_source + '/' + url
17
+
18
+ # Check if file exists (returns true or false)
19
+ "#{ File . exist? ( file_path . strip! ) } "
20
+ end
21
+ end
22
+ end
23
+
24
+ Liquid ::Template . register_tag ( 'file_exists' , Jekyll ::FileExistsTag )
You can’t perform that action at this time.
0 commit comments