Skip to content

Instantly share code, notes, and snippets.

@sonsongithub
Last active December 19, 2015 19:19
Show Gist options
  • Select an option

  • Save sonsongithub/6005034 to your computer and use it in GitHub Desktop.

Select an option

Save sonsongithub/6005034 to your computer and use it in GitHub Desktop.
parser for extract UTI idenfier from Xcode documents for exmample path file:///Users/sonson/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiOS6.1.iOSLibrary.docset/Contents/Resources/Documents/index.html#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
#!/usr/bin/ruby
# parser for extract UTI idenfier from Xcode documents
# for exmample path
# file:///Users/sonson/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.AppleiOS6.1.iOSLibrary.docset/Contents/Resources/Documents/index.html#documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
if __FILE__ == $0
str = $stdin.read
str.scan(/<tr><td scope=\"row\"><p>(.+?)<\/p><\/td>/).each{|e|
e1 = e[0].gsub(/\(.+\)/, "")
identifier = e1.gsub(/[^(\w|\-|\.)]+/, "")
if identifier =~ /text/
puts identifier
end
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment