Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
icons
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
icons
Commits
3cef6cb7
Commit
3cef6cb7
authored
Jan 11, 2016
by
Dave Gandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Icon pages should generate. Silly me.
parent
898111fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
45 deletions
+45
-45
icon_page_generator.rb
src/_plugins/icon_page_generator.rb
+45
-45
No files found.
src/_plugins/icon_page_generator.rb
View file @
3cef6cb7
#
#
#
#
#
Create individual pages for each icon in the FontAwesome set
#
#
require 'yaml'
#
#
module Jekyll
#
#
class IconPage < Page
#
#
##
#
# Take a single icon and render a page for it.
#
#
def initialize(site, base, dir, icon)
#
@site = site
#
@base = base
#
@dir = dir
#
@name = "#{icon.id}.html"
#
@icon = icon
#
#
self.process(@name)
#
#
self.read_yaml(File.join(base, site.config['layouts']), site.config['icon_layout'])
#
#
self.data['icon'] = icon
#
self.data['title'] = "fa-#{icon.id}: " + self.data['title_suffix']
#
end
#
#
end
#
#
class IconGenerator < Generator
#
#
##
#
# Iterate over every described icon in a YAML file and create a page for it
#
#
safe true
#
#
def generate(site)
#
site.icons.each do |icon|
#
site.pages << IconPage.new(site, site.source, site.config['icon_destination'], icon)
#
end
#
end
#
#
end
#
#
end
##
# Create individual pages for each icon in the FontAwesome set
require
'yaml'
module
Jekyll
class
IconPage
<
Page
##
# Take a single icon and render a page for it.
def
initialize
(
site
,
base
,
dir
,
icon
)
@site
=
site
@base
=
base
@dir
=
dir
@name
=
"
#{
icon
.
id
}
.html"
@icon
=
icon
self
.
process
(
@name
)
self
.
read_yaml
(
File
.
join
(
base
,
site
.
config
[
'layouts'
]),
site
.
config
[
'icon_layout'
])
self
.
data
[
'icon'
]
=
icon
self
.
data
[
'title'
]
=
"fa-
#{
icon
.
id
}
: "
+
self
.
data
[
'title_suffix'
]
end
end
class
IconGenerator
<
Generator
##
# Iterate over every described icon in a YAML file and create a page for it
safe
true
def
generate
(
site
)
site
.
icons
.
each
do
|
icon
|
site
.
pages
<<
IconPage
.
new
(
site
,
site
.
source
,
site
.
config
[
'icon_destination'
],
icon
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment