diff --git a/.editorconfig b/.editorconfig index 7d715a8a0..e33929dbf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,7 @@ indent_style = tab [*.json] indent_style = space indent_size = 2 + +[*.rb] +indent_style = space +indent_size = 2 diff --git a/scripts/nf-preview.rb b/scripts/nf-preview.rb new file mode 100755 index 000000000..b4e0bd385 --- /dev/null +++ b/scripts/nf-preview.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +require "yaml" + +LANGUAGES_FILE = File.expand_path("../../languages.yaml", __FILE__) + +languages = YAML.safe_load_file(ARGV[0] || LANGUAGES_FILE, symbolize_names: true) + +languages.each do |language, attributes| + icon = attributes[:icon] + next if icon.nil? + match = /\A\\u\{([A-F0-9]{4,})\}\z/i.match(icon) + raise "Icon for #{language} is not in the correct format: `#{icon}`" unless match + glyph = match.captures[0].hex.chr("UTF-8") + puts "#{language}: #{glyph}" +end