Module: SnippetsConverter::Editors::Gedit

Defined in:
lib/snippets_converter/editors/gedit.rb

Instance Method Summary collapse

Instance Method Details

#editor_bottomObject



23
24
25
# File 'lib/snippets_converter/editors/gedit.rb', line 23

def editor_bottom
  "</snippets>"
end

#editor_conversion(trigger, description, code) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/snippets_converter/editors/gedit.rb', line 5

def editor_conversion(trigger, description, code)
  # Need to remove dot in 'trigger' because Gedit doesn't seem to like it on the tag
  return <<-CODE
  <snippet id="#{trigger.gsub(/\./,'')}">
    <tag>#{trigger.gsub(/\./,'')}</tag>
    <description>#{description}</description>
    <text><![CDATA[#{code}]]></text>
  </snippet>
  CODE
end

#editor_header(language = 'ruby') ⇒ Object



16
17
18
19
20
21
# File 'lib/snippets_converter/editors/gedit.rb', line 16

def editor_header(language = 'ruby')
  return <<-CODE
<?xml version='1.0' encoding='utf-8'?>
<snippets language=\"#{language}\">
  CODE
end

#editor_target_file(language = 'gedit_snippets') ⇒ Object



27
28
29
# File 'lib/snippets_converter/editors/gedit.rb', line 27

def editor_target_file(language = 'gedit_snippets')
  "#{language.gsub(/.+\.(.+)/,'\1')}.xml"
end