Class: Jekyll::Academicons::Svg::AcademiconsSvgGenerator

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/academicons/svg/academicons-generator.rb

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



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
40
41
42
43
44
45
46
47
48
49
# File 'lib/jekyll/academicons/svg/academicons-generator.rb', line 8

def render(context)
  output = nil
  unless context.environments.first['page']['academicons_svg'].nil?
    output = '<svg display="none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <metadata>
            <json>
              <![CDATA[
              {
              "fontFamily": "Academicons",
              "majorVersion": 1,
              "minorVersion": 8,
              "fontURL": "https://jpswalsh.github.io/academicons/",
              "description": "Font generated by IcoMoon.",
              "designer": "James Walsh and Katja Bercic",
              "designerURL": "http://jpswalsh.com",
              "license": "SIL OFL 1.1",
              "licenseURL": "http://scripts.sil.org/OFL",
              "version": "Version 1.8",
              "fontId": "Academicons",
              "psName": "Academicons",
              "subFamily": "Regular",
              "fullName": "Academicons"
              }
              ]]>
            </json>
          </metadata>        
          <defs>
      '

    context.environments.first['page']['academicons_svg'].uniq.each do |icon|
      icon = AcademiconsIcon.new(icon)
      output += icon.to_svg_html
    end

    output += '</defs>
      </svg>'
  end

  unless output.nil?
    output
  end
end