Skip to content

Commit

Permalink
Add .awk extension to file types treaded as CotEditor script
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Sep 29, 2024
1 parent 6b40e31 commit e83b15b
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Improvements

- Add .awk extension to file types treaded as CotEditor script.
- Adjust the layout of the file preview view.
- Update the Swift syntax to add `@Test` and `@Suite` attributes.

Expand Down
24 changes: 24 additions & 0 deletions CotEditor/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,30 @@
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.script</string>
</array>
<key>UTTypeDescription</key>
<string>AWK script</string>
<key>UTTypeIcons</key>
<dict>
<key>UTTypeIconBackgroundName</key>
<string>CurlyBrackets-fill</string>
<key>UTTypeIconText</key>
<string>config</string>
</dict>
<key>UTTypeIdentifier</key>
<string>com.coteditor.awk</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>awk</string>
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>Script CotEditor with UNIX script</h1>
<p>This page explains how to pass your document’s text to UNIX scripts that are executable from the Script menu, or how to receive the outputs from them.</p>

<ul>
<li>The file extensions of the scripts you can add to the Script menu are: .sh, .pl, .php, .rb, .py, .js, and .swift (regardless of the language)</li>
<li>The file extensions of the scripts you can add to the Script menu are: .sh, .pl, .php, .rb, .py, .js, .awk, and .swift (regardless of the language)</li>
<li>To run a script, you need to set execute permission for the script file.</li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>CotEditorをUNIXスクリプトで操作する</h1>
<p>このページではスクリプトメニューから実行するUNIXスクリプトにCotEditorで編集中の書類の情報やテキストを渡したり、スクリプトの実行結果を書類に反映する方法を説明します。</p>

<ul>
<li>スクリプトメニューに登録できるスクリプトの拡張子は.sh、.pl、.php、.rb、.py、.js、.swiftです(言語は関係ありません)。</li>
<li>スクリプトメニューに登録できるスクリプトの拡張子は.sh、.pl、.php、.rb、.py、.js、.awk、.swiftです(言語は関係ありません)。</li>
<li>スクリプトには実行権限がなければなりません。</li>
</ul>

Expand Down
88 changes: 88 additions & 0 deletions CotEditor/Resources/Localizables/InfoPlist.xcstrings
Original file line number Diff line number Diff line change
@@ -1,6 +1,94 @@
{
"sourceLanguage" : "en",
"strings" : {
"AWK script" : {
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK skript"
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK-Skript"
}
},
"en-GB" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK script"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Script AWK"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Script AWK"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Script AWK"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWKスクリプト"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK 스크립트"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK-script"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "skrypt AWK"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Script AWK"
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK betiği"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK脚本"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "AWK腳本"
}
}
}
},
"BibTeX bibliography" : {
"localizations" : {
"cs" : {
Expand Down
8 changes: 7 additions & 1 deletion CotEditor/Sources/Models/Scripts/ScriptDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ import Foundation
import UniformTypeIdentifiers
import Shortcut

private extension UTType {

static let awkScript = UTType(exportedAs: "com.coteditor.awk")
}


enum ScriptingFileType: CaseIterable {

case appleScript
Expand All @@ -37,7 +43,7 @@ enum ScriptingFileType: CaseIterable {

switch self {
case .appleScript: [.appleScript, .osaScript, .osaScriptBundle] // .applescript, .scpt, .scptd
case .unixScript: [.shellScript, .perlScript, .phpScript, .rubyScript, .pythonScript, .javaScript, .swiftSource]
case .unixScript: [.shellScript, .perlScript, .phpScript, .rubyScript, .pythonScript, .javaScript, .awkScript, .swiftSource]
}
}
}
Expand Down

0 comments on commit e83b15b

Please sign in to comment.