Module: SnippetsConverter::Editors::Netbeans
- Defined in:
- lib/snippets_converter/editors/netbeans.rb
Instance Method Summary collapse
- #editor_bottom ⇒ Object
- #editor_conversion(trigger, description, code) ⇒ Object
- #editor_header(language = nil) ⇒ Object
- #editor_target_file(language = nil) ⇒ Object
Instance Method Details
#editor_bottom ⇒ Object
26 27 28 |
# File 'lib/snippets_converter/editors/netbeans.rb', line 26 def editor_bottom "</codetemplates>" end |
#editor_conversion(trigger, description, code) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/snippets_converter/editors/netbeans.rb', line 5 def editor_conversion(trigger, description, code) code.gsub!(/\$0/, '${cursor}') code.gsub!(/\$\{([0-9]{1,5}):((?>[^{}]+)|(\1))+\}/m, '${\1 default="\2"}') code.gsub!(/(\$\{([0-9]{1,5}) default\=\".+\"\}.+)\$(\2)/m, '\1${\3}') code.gsub!(/\$([0-9]{1,5})/, '${tabStop\1 default=""}') return <<-CODE <codetemplate abbreviation='#{trigger}' xml:space='preserve'> <description><![CDATA[#{description}]]></description> <code><![CDATA[#{code}]]></code> </codetemplate> CODE end |
#editor_header(language = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/snippets_converter/editors/netbeans.rb', line 18 def editor_header(language = nil) return <<-CODE <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE codetemplates PUBLIC "-//NetBeans//DTD Editor Code Templates settings 1.0//EN" "http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd"> <codetemplates> CODE end |
#editor_target_file(language = nil) ⇒ Object
30 31 32 |
# File 'lib/snippets_converter/editors/netbeans.rb', line 30 def editor_target_file(language = nil) "org-netbeans-modules-editor-settings-CustomCodeTemplates.xml" end |