FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
emptyzone.github.com.code/_plugins/debug.rb at master · emptyzone/emptyzone.github.com.code · GitHub
emptyzone
emptyzone.github.com.code
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
emptyzone.github.com.code
/
_plugins
/
debug.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
39 lines (33 loc) · 905 Bytes
Breadcrumbs
emptyzone.github.com.code
/
_plugins
/
debug.rb
Copy path
File metadata and controls
39 lines (33 loc) · 905 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#coding:utf-8
# A simple way to inspect liquid template variables.
# Usage:
# Can be used anywhere liquid syntax is parsed (templates, includes, posts/pages)
# {{ site | debug }}
# {{ site.posts | debug }}
#
require
'pp'
module
Jekyll
# Need to overwrite the inspect method here because the original
# uses < > to encapsulate the psuedo post/page objects in which case
# the output is taken for HTML tags and hidden from view.
#
class
Post
def
inspect
"#Jekyll:Post @id=
#{
self
.
id
.
inspect
}
"
end
end
class
Page
def
inspect
"#Jekyll:Page @name=
#{
self
.
name
.
inspect
}
"
end
end
end
# Jekyll
module
Jekyll
module
DebugFilter
def
debug
(
obj
,
stdout
=
false
)
puts
obj
.
pretty_inspect
if
stdout
"<pre>
#{
obj
.
class
}
\n
#{
obj
.
pretty_inspect
}
</pre>"
end
end
# DebugFilter
end
# Jekyll
Liquid
::
Template
.
register_filter
(
Jekyll
::
DebugFilter
)
Back
|
FazBrowse Home
|
New Git URL