Last active
December 19, 2015 19:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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