Commit cf8b291899

cf8b29189934091d7dd0144ced479cc21c4ec764

parent: b28cc71ca3

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-20 20:47 UTC

Export and publish ASCII natively in every build

Layout: unified · split

Sources/OrgApp/AppStoreCommands.swift +1 −1
@@ -4,7 +4,7 @@ import Foundation
4/// Emacs, and attaching by link, which the sandbox doesn't allow. 4/// Emacs, and attaching by link, which the sandbox doesn't allow.
5public enum AppStoreCommands { 5public enum AppStoreCommands {
6 public static let hidden: Set<String> = [ 6 public static let hidden: Set<String> = [
7 "app.export.pdf", "app.export.text", 7 "app.export.pdf",
8 "app.attach.link", "app.attach.symlink", 8 "app.attach.link", "app.attach.symlink",
9 ] 9 ]
10 10
Sources/OrgApp/CommandTitles.swift +1 −1
@@ -94,7 +94,7 @@ enum CommandTitles {
94 String(localized: "Export to PDF", comment: "Command title"), 94 String(localized: "Export to PDF", comment: "Command title"),
95 String(localized: "Export to PDF with Emacs", comment: "Command title"), 95 String(localized: "Export to PDF with Emacs", comment: "Command title"),
96 String(localized: "Export to Plain Text", comment: "Command title"), 96 String(localized: "Export to Plain Text", comment: "Command title"),
97 String(localized: "Export to Plain Text with Emacs", comment: "Command title"), 97 String(localized: "Export to Plain Text (ASCII)", comment: "Command title"),
98 String(localized: "Export to RTF", comment: "Command title"), 98 String(localized: "Export to RTF", comment: "Command title"),
99 String(localized: "Export to Word", comment: "Command title"), 99 String(localized: "Export to Word", comment: "Command title"),
100 String(localized: "Export to iCalendar", comment: "Command title"), 100 String(localized: "Export to iCalendar", comment: "Command title"),
Sources/OrgApp/Publish.swift +3 −3
@@ -40,7 +40,7 @@ public struct PublishProject: Sendable, Equatable {
40 40
41 public init(name: String) { self.name = name } 41 public init(name: String) { self.name = name }
42 42
43 public static let functions = ["org-html-publish-to-html", "org-md-publish-to-md", "org-latex-publish-to-latex", "org-odt-publish-to-odt", "org-publish-attachment"] 43 public static let functions = ["org-html-publish-to-html", "org-md-publish-to-md", "org-latex-publish-to-latex", "org-odt-publish-to-odt", "org-ascii-publish-to-ascii", "org-publish-attachment"]
44} 44}
45 45
46public enum Publish { 46public enum Publish {
@@ -252,7 +252,7 @@ public enum Publish {
252 252
253 /// `org-publish-projects`: each project's sitemap, when it has one, then its files, through 253 /// `org-publish-projects`: each project's sitemap, when it has one, then its files, through
254 /// its publishing functions. A file whose output is newer than it is skipped unless `force`. 254 /// its publishing functions. A file whose output is newer than it is skipped unless `force`.
255 /// `export` turns an Org file's text into the HTML, Markdown or LaTeX to write. 255 /// `export` turns an Org file's text into the HTML, Markdown, LaTeX or plain text to write.
256 public static func publish( 256 public static func publish(
257 _ chosen: [PublishProject], all: [PublishProject], force: Bool = false, only: String? = nil, 257 _ chosen: [PublishProject], all: [PublishProject], force: Bool = false, only: String? = nil,
258 read: (String) -> String?, export: (_ function: String, _ text: String, _ path: String, _ bodyOnly: Bool) throws -> String 258 read: (String) -> String?, export: (_ function: String, _ text: String, _ path: String, _ bodyOnly: Bool) throws -> String
@@ -290,7 +290,7 @@ public enum Publish {
290 if directory((file as NSString).deletingLastPathComponent) == outputDirectory { return nil } 290 if directory((file as NSString).deletingLastPathComponent) == outputDirectory { return nil }
291 return outputDirectory + (file as NSString).lastPathComponent 291 return outputDirectory + (file as NSString).lastPathComponent
292 } 292 }
293 let ext = ["org-md-publish-to-md": "md", "org-latex-publish-to-latex": "tex", "org-odt-publish-to-odt": "odt"][function] ?? "html" 293 let ext = ["org-md-publish-to-md": "md", "org-latex-publish-to-latex": "tex", "org-odt-publish-to-odt": "odt", "org-ascii-publish-to-ascii": "txt"][function] ?? "html"
294 guard let text = read(file) else { throw Failure(description: "Can't read \(file)") } 294 guard let text = read(file) else { throw Failure(description: "Can't read \(file)") }
295 return ExportScope.output(for: URL(fileURLWithPath: outputDirectory + (file as NSString).lastPathComponent), 295 return ExportScope.output(for: URL(fileURLWithPath: outputDirectory + (file as NSString).lastPathComponent),
296 name: ExportScope.fileName(text), extension: ext).path 296 name: ExportScope.fileName(text), extension: ext).path
Sources/OrgCore/Export/ASCIIExport.swift +5 −3
@@ -15,10 +15,11 @@ public enum ASCIIExport {
15 } 15 }
16 16
17 /// A `.txt` document, or with `bodyOnly` the text without the title block and contents. 17 /// A `.txt` document, or with `bodyOnly` the text without the title block and contents.
18 /// `author` stands for `user-full-name`, `language` for `org-export-default-language`. 18 /// `author` stands for `user-full-name`, `language` for `org-export-default-language`. `file`
19 /// adds the final newline `org-export-to-file` writes.
19 public static func document( 20 public static func document(
20 _ text: String, settings: OrgSettings = .default, path: String? = nil, now: Date = Date(), charset: Charset = .ascii, 21 _ text: String, settings: OrgSettings = .default, path: String? = nil, now: Date = Date(), charset: Charset = .ascii,
21 bodyOnly: Bool = false, author: String = "", language: String = "en" 22 bodyOnly: Bool = false, author: String = "", language: String = "en", file: Bool = false
22 ) throws -> String { 23 ) throws -> String {
23 let text = try LaTeXExport.expanded(text, settings: settings, path: path, now: now) 24 let text = try LaTeXExport.expanded(text, settings: settings, path: path, now: now)
24 let tree = OrgParser.parse(text, defaults: settings) 25 let tree = OrgParser.parse(text, defaults: settings)
@@ -27,7 +28,8 @@ public enum ASCIIExport {
27 let renderer = try ASCIIRenderer(tree: tree, text: text, settings: settings, keywords: keywords, language: language, charset: charset) 28 let renderer = try ASCIIRenderer(tree: tree, text: text, settings: settings, keywords: keywords, language: language, charset: charset)
28 var output = try renderer.body() 29 var output = try renderer.body()
29 if !bodyOnly { output = try renderer.template(output, author: author) } 30 if !bodyOnly { output = try renderer.template(output, author: author) }
30 return output.replacingOccurrences(of: ASCIIRenderer.hardNewline, with: "\n") 31 output = output.replacingOccurrences(of: ASCIIRenderer.hardNewline, with: "\n")
32 return file && !output.isEmpty && !output.hasSuffix("\n") ? output + "\n" : output
31 } 33 }
32} 34}
33 35
Sources/OrgEditorAppKit/EditorCommands.swift +1 −1
@@ -176,7 +176,7 @@ public enum EditorCommands {
176 EditorCommand(id: "app.export.pdf", title: "Export to PDF with Emacs", action: .app), 176 EditorCommand(id: "app.export.pdf", title: "Export to PDF with Emacs", action: .app),
177 EditorCommand(id: "app.export.odt", title: "Export to ODT", action: .app), 177 EditorCommand(id: "app.export.odt", title: "Export to ODT", action: .app),
178 EditorCommand(id: "app.export.latex", title: "Export to LaTeX", action: .app), 178 EditorCommand(id: "app.export.latex", title: "Export to LaTeX", action: .app),
179 EditorCommand(id: "app.export.text", title: "Export to Plain Text with Emacs", action: .app), 179 EditorCommand(id: "app.export.text", title: "Export to Plain Text (ASCII)", action: .app),
180 EditorCommand(id: "app.export.icalendar", title: "Export to iCalendar", action: .app), 180 EditorCommand(id: "app.export.icalendar", title: "Export to iCalendar", action: .app),
181 EditorCommand(id: "app.export.icalendar-agenda", title: "Export Agenda Files to iCalendar", action: .app), 181 EditorCommand(id: "app.export.icalendar-agenda", title: "Export Agenda Files to iCalendar", action: .app),
182 EditorCommand(id: "app.export.icalendar-combined", title: "Combine Agenda Files into iCalendar", action: .app), 182 EditorCommand(id: "app.export.icalendar-combined", title: "Combine Agenda Files into iCalendar", action: .app),
Sources/Orgstar/ContentView.swift +23 −7
@@ -628,7 +628,13 @@ struct ContentView: View {
628 } catch { 628 } catch {
629 commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)") 629 commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)")
630 } 630 }
631 case "latex" where exportLaTeX(text, whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, bodyOnly: bodyOnly, settings: defaults): 631 case "latex" where exportNative("LaTeX", extension: "tex", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, settings: defaults, export: {
632 try LaTeXExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true)
633 }):
634 break
635 case "text" where exportNative("plain text", extension: "txt", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, settings: defaults, export: {
636 try ASCIIExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true)
637 }):
632 break 638 break
633 case "odt": 639 case "odt":
634 let name = ExportScope.fileName(whole, subtreeAt: subtree ? caret : nil, settings: defaults) 640 let name = ExportScope.fileName(whole, subtreeAt: subtree ? caret : nil, settings: defaults)
@@ -705,21 +711,24 @@ struct ContentView: View {
705 } 711 }
706 } 712 }
707 713
708 /// Writes `text` as LaTeX, as ox-latex does. False when the native export can't match Emacs 714 /// Writes what `export` makes, as ox does for `format`. False when the native export can't
709 /// and Emacs is installed to export instead; otherwise the reason is shown. 715 /// match Emacs and Emacs is installed to export instead; otherwise the reason is shown.
710 private func exportLaTeX(_ text: String, whole: String, url: URL, to destination: URL?, open: Bool, subtree: Int?, bodyOnly: Bool, settings: OrgSettings) -> Bool { 716 private func exportNative(
717 _ format: String, extension ext: String, whole: String, url: URL, to destination: URL?, open: Bool, subtree: Int?, settings: OrgSettings,
718 export: () throws -> String
719 ) -> Bool {
711 let content: String 720 let content: String
712 do { 721 do {
713 content = try LaTeXExport.document(text, settings: settings, path: url.path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true) 722 content = try export()
714 } catch { 723 } catch {
715 #if !APPSTORE 724 #if !APPSTORE
716 if EmacsRunner.executable() != nil { return false } 725 if EmacsRunner.executable() != nil { return false }
717 #endif 726 #endif
718 commands.show("Can't export to LaTeX: \(error.localizedDescription)") 727 commands.show("Can't export to \(format): \(error.localizedDescription)")
719 return true 728 return true
720 } 729 }
721 let name = ExportScope.fileName(whole, subtreeAt: subtree, settings: settings) 730 let name = ExportScope.fileName(whole, subtreeAt: subtree, settings: settings)
722 guard let target = destination ?? writable(ExportScope.output(for: url, name: name, extension: "tex")) else { return true } 731 guard let target = destination ?? writable(ExportScope.output(for: url, name: name, extension: ext)) else { return true }
723 do { 732 do {
724 try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) 733 try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true)
725 try content.write(to: target, atomically: true, encoding: .utf8) 734 try content.write(to: target, atomically: true, encoding: .utf8)
@@ -1002,6 +1011,13 @@ struct ContentView: View {
1002 throw LaTeXExport.Unsupported(reason: "Can't export \((path as NSString).lastPathComponent) to LaTeX: \(error.reason)") 1011 throw LaTeXExport.Unsupported(reason: "Can't export \((path as NSString).lastPathComponent) to LaTeX: \(error.reason)")
1003 } 1012 }
1004 } 1013 }
1014 if function == "org-ascii-publish-to-ascii" {
1015 do {
1016 return try ASCIIExport.document(text, settings: settings, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true)
1017 } catch let error as ASCIIExport.Unsupported {
1018 throw ASCIIExport.Unsupported(reason: "Can't export \((path as NSString).lastPathComponent) to plain text: \(error.reason)")
1019 }
1020 }
1005 let base = ((path as NSString).lastPathComponent as NSString).deletingPathExtension 1021 let base = ((path as NSString).lastPathComponent as NSString).deletingPathExtension
1006 return HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, bodyOnly: bodyOnly, codeStyle: codeStyle, language: OrgPreferences.exportLanguage()) 1022 return HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, bodyOnly: bodyOnly, codeStyle: codeStyle, language: OrgPreferences.exportLanguage())
1007 } 1023 }
Sources/Orgstar/ExportSheet.swift +2 −2
@@ -25,13 +25,13 @@ struct ExportSheet: View {
25 static let formats: [(id: String, title: String, ext: String)] = [ 25 static let formats: [(id: String, title: String, ext: String)] = [
26 ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"), 26 ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"),
27 ("rtf", "Rich Text (RTF)", "rtf"), ("plain-text", "Plain text", "txt"), ("odt", "ODT", "odt"), 27 ("rtf", "Rich Text (RTF)", "rtf"), ("plain-text", "Plain text", "txt"), ("odt", "ODT", "odt"),
28 ("icalendar", "iCalendar", "ics"), ("latex", "LaTeX", "tex"), 28 ("icalendar", "iCalendar", "ics"), ("latex", "LaTeX", "tex"), ("text", "Plain text, ASCII", "txt"),
29 ] 29 ]
30 #else 30 #else
31 static let formats: [(id: String, title: String, ext: String)] = [ 31 static let formats: [(id: String, title: String, ext: String)] = [
32 ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"), 32 ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"),
33 ("rtf", "Rich Text (RTF)", "rtf"), ("plain-text", "Plain text", "txt"), ("pdf", "PDF via LaTeX (Emacs)", "pdf"), 33 ("rtf", "Rich Text (RTF)", "rtf"), ("plain-text", "Plain text", "txt"), ("pdf", "PDF via LaTeX (Emacs)", "pdf"),
34 ("odt", "ODT", "odt"), ("latex", "LaTeX", "tex"), ("text", "Plain text, ASCII (Emacs)", "txt"), 34 ("odt", "ODT", "odt"), ("latex", "LaTeX", "tex"), ("text", "Plain text, ASCII", "txt"),
35 ("icalendar", "iCalendar", "ics"), 35 ("icalendar", "iCalendar", "ics"),
36 ] 36 ]
37 #endif 37 #endif
Sources/OrgstarMobile/ExportMenu.swift +20 −6
@@ -6,12 +6,12 @@ import OrgPresentation
6import SwiftUI 6import SwiftUI
7import UniformTypeIdentifiers 7import UniformTypeIdentifiers
8 8
9/// A file exported as HTML, Markdown, PDF, Word, RTF, plain text, ODT, iCalendar or LaTeX, written 9/// A file exported as HTML, Markdown, PDF, Word, RTF, plain text, ODT, iCalendar, LaTeX or ASCII,
10/// when the share sheet takes it. 10/// written when the share sheet takes it.
11struct OrgExport: Transferable { 11struct OrgExport: Transferable {
12 enum Format: CaseIterable { 12 enum Format: CaseIterable {
13 case html, markdown, pdf, docx, rtf, plainText, odt, icalendar 13 case html, markdown, pdf, docx, rtf, plainText, odt, icalendar
14 case latex 14 case latex, ascii
15 15
16 /// Whether it needs Pro now: every format but HTML and Markdown, until Pro is unlocked. 16 /// Whether it needs Pro now: every format but HTML and Markdown, until Pro is unlocked.
17 @MainActor var locked: Bool { self != .html && self != .markdown && !ProAccess.shared.isUnlocked } 17 @MainActor var locked: Bool { self != .html && self != .markdown && !ProAccess.shared.isUnlocked }
@@ -27,6 +27,7 @@ struct OrgExport: Transferable {
27 case .odt: "ODT" 27 case .odt: "ODT"
28 case .icalendar: "iCalendar" 28 case .icalendar: "iCalendar"
29 case .latex: "LaTeX" 29 case .latex: "LaTeX"
30 case .ascii: "Plain Text (ASCII)"
30 } 31 }
31 } 32 }
32 33
@@ -41,6 +42,7 @@ struct OrgExport: Transferable {
41 case .odt: "odt" 42 case .odt: "odt"
42 case .icalendar: "ics" 43 case .icalendar: "ics"
43 case .latex: "tex" 44 case .latex: "tex"
45 case .ascii: "txt"
44 } 46 }
45 } 47 }
46 } 48 }
@@ -62,8 +64,8 @@ struct OrgExport: Transferable {
62 .lastPathComponent 64 .lastPathComponent
63 } 65 }
64 66
65 /// Posted with the message, for the screen's message line, when the LaTeX export refuses 67 /// Posted with the message, for the screen's message line, when the LaTeX or ASCII export
66 /// the file: the share sheet shows no reason. 68 /// refuses the file: the share sheet shows no reason.
67 static let refused = Notification.Name("OrgExportRefused") 69 static let refused = Notification.Name("OrgExportRefused")
68 70
69 static var transferRepresentation: some TransferRepresentation { 71 static var transferRepresentation: some TransferRepresentation {
@@ -85,6 +87,8 @@ struct OrgExport: Transferable {
85 .exportingCondition { $0.format == .icalendar } 87 .exportingCondition { $0.format == .icalendar }
86 FileRepresentation(exportedContentType: UTType(filenameExtension: "tex") ?? .plainText) { try await $0.write() } 88 FileRepresentation(exportedContentType: UTType(filenameExtension: "tex") ?? .plainText) { try await $0.write() }
87 .exportingCondition { $0.format == .latex } 89 .exportingCondition { $0.format == .latex }
90 FileRepresentation(exportedContentType: .plainText) { try await $0.write() }
91 .exportingCondition { $0.format == .ascii }
88 } 92 }
89 93
90 private func write() async throws -> SentTransferredFile { 94 private func write() async throws -> SentTransferredFile {
@@ -110,6 +114,16 @@ struct OrgExport: Transferable {
110 throw error 114 throw error
111 } 115 }
112 try content.write(to: url, atomically: true, encoding: .utf8) 116 try content.write(to: url, atomically: true, encoding: .utf8)
117 case .ascii:
118 let content: String
119 do {
120 content = try ASCIIExport.document(text, settings: settings, path: path, language: OrgPreferences.exportLanguage(), file: true)
121 } catch let error as ASCIIExport.Unsupported {
122 let message = "Can't export to plain text: \(error.reason)"
123 await MainActor.run { NotificationCenter.default.post(name: Self.refused, object: message) }
124 throw error
125 }
126 try content.write(to: url, atomically: true, encoding: .utf8)
113 case .odt: 127 case .odt:
114 try ODTExport.document(text, settings: settings, path: path, language: OrgPreferences.exportLanguage()) 128 try ODTExport.document(text, settings: settings, path: path, language: OrgPreferences.exportLanguage())
115 .write(to: url, options: .atomic) 129 .write(to: url, options: .atomic)
@@ -133,7 +147,7 @@ struct OrgExport: Transferable {
133 } 147 }
134} 148}
135 149
136/// Sharing the file as HTML, Markdown, PDF, Word, RTF, plain text, ODT, iCalendar or LaTeX: to another app, or saved with 150/// Sharing the file as HTML, Markdown, PDF, Word, RTF, plain text, ODT, iCalendar, LaTeX or ASCII: to another app, or saved with
137/// Save to Files; or copying it as rich text. 151/// Save to Files; or copying it as rich text.
138struct ExportMenu: View { 152struct ExportMenu: View {
139 let path: String 153 let path: String
Tests/OrgAppTests/PublishTests.swift +50
@@ -195,6 +195,56 @@ struct PublishTests {
195 } 195 }
196 } 196 }
197 197
198 /// `org-ascii-publish-to-ascii`: the same `.txt` files as Emacs writes.
199 @Test(.enabled(if: ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil))
200 func publishesASCIILikeOrg() throws {
201 let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-publish-txt-\(UUID().uuidString)").resolvingSymlinksInPath()
202 defer { try? FileManager.default.removeItem(at: folder) }
203 let sources = ["a.org": "#+TITLE: A\n* One\nText with a [[https://orgmode.org][link]].\n| x | y |\n", "sub/b.org": "#+OPTIONS: toc:nil\n- item\n- [X] done\n"]
204 for (path, text) in sources {
205 let url = folder.appendingPathComponent("src/" + path)
206 try FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
207 try text.write(to: url, atomically: true, encoding: .utf8)
208 }
209 let form = """
210 (progn
211 (require 'ox-publish) (require 'ox-ascii)
212 (setq user-full-name "A. Writer"
213 org-publish-timestamp-directory "\(folder.path)/ts/"
214 org-publish-project-alist '(("txt" :base-directory "\(folder.path)/src" :publishing-directory "\(folder.path)/emacs"
215 :recursive t :publishing-function org-ascii-publish-to-ascii)))
216 (org-publish "txt" t))
217 """
218 let process = Process()
219 process.executableURL = URL(fileURLWithPath: "/usr/bin/env")
220 process.arguments = [ProcessInfo.processInfo.environment["ORGSTAR_EMACS"] ?? "emacs", "-Q", "--batch", "--eval", form]
221 process.standardOutput = FileHandle.nullDevice
222 process.standardError = FileHandle.nullDevice
223 try process.run()
224 process.waitUntilExit()
225
226 let toml = """
227 [[publish]]
228 name = "txt"
229 base-directory = "\(folder.path)/src"
230 publishing-directory = "\(folder.path)/ours"
231 recursive = true
232 publishing-function = "org-ascii-publish-to-ascii"
233 """
234 let loaded = Publish.projects(fromConfig: toml, root: nil)
235 #expect(loaded.problems.isEmpty, "\(loaded.problems)")
236 let read = { (path: String) in try? String(contentsOfFile: path, encoding: .utf8) }
237 let report = try Publish.publish(loaded.projects, all: loaded.projects, force: true, read: read) { _, text, path, bodyOnly in
238 try ASCIIExport.document(text, path: path, bodyOnly: bodyOnly, author: "A. Writer", file: true)
239 }
240 #expect(report.published.count == 2)
241 for path in ["a.txt", "sub/b.txt"] {
242 let theirs = try String(contentsOf: folder.appendingPathComponent("emacs/" + path), encoding: .utf8)
243 let ours = try String(contentsOf: folder.appendingPathComponent("ours/" + path), encoding: .utf8)
244 #expect(ours == theirs, "\(path)\nours:\n\(ours)\nemacs:\n\(theirs)")
245 }
246 }
247
198 /// `org-odt-publish-to-odt` writes `.odt` files, which the export closure doesn't see. 248 /// `org-odt-publish-to-odt` writes `.odt` files, which the export closure doesn't see.
199 @Test func publishesODT() throws { 249 @Test func publishesODT() throws {
200 let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-publish-\(UUID().uuidString)") 250 let folder = FileManager.default.temporaryDirectory.appendingPathComponent("orgstar-publish-\(UUID().uuidString)")
Tests/OrgEditorAppKitTests/AppStoreCommandsTests.swift +6
@@ -15,6 +15,12 @@ struct AppStoreCommandsTests {
15 #expect(EditorCommands.all.first { $0.id == "app.export.latex" }?.title == "Export to LaTeX") 15 #expect(EditorCommands.all.first { $0.id == "app.export.latex" }?.title == "Export to LaTeX")
16 } 16 }
17 17
18 /// ASCII export is native, so the sandboxed build has it.
19 @Test func asciiExportIsShown() {
20 #expect(!AppStoreCommands.hidden.contains("app.export.text"))
21 #expect(EditorCommands.all.first { $0.id == "app.export.text" }?.title == "Export to Plain Text (ASCII)")
22 }
23
18 @Test func pdfKeysExportThroughWebKit() throws { 24 @Test func pdfKeysExportThroughWebKit() throws {
19 let replacement = try #require(AppStoreCommands.replacement(for: "app.export.pdf")) 25 let replacement = try #require(AppStoreCommands.replacement(for: "app.export.pdf"))
20 #expect(replacement == "app.export.print-pdf") 26 #expect(replacement == "app.export.print-pdf")
l10n/Localizable.xcstrings +6 −6
@@ -11854,37 +11854,37 @@
11854 } 11854 }
11855 } 11855 }
11856 }, 11856 },
11857 "Export to Plain Text with Emacs": { 11857 "Export to Plain Text (ASCII)": {
11858 "comment": "Command title", 11858 "comment": "Command title",
11859 "localizations": { 11859 "localizations": {
11860 "de": { 11860 "de": {
11861 "stringUnit": { 11861 "stringUnit": {
11862 "state": "translated", 11862 "state": "translated",
11863 "value": "Mit Emacs als reinen Text exportieren" 11863 "value": "Als reinen Text (ASCII) exportieren"
11864 } 11864 }
11865 }, 11865 },
11866 "es": { 11866 "es": {
11867 "stringUnit": { 11867 "stringUnit": {
11868 "state": "translated", 11868 "state": "translated",
11869 "value": "Exportar a texto sin formato con Emacs" 11869 "value": "Exportar a texto sin formato (ASCII)"
11870 } 11870 }
11871 }, 11871 },
11872 "fr": { 11872 "fr": {
11873 "stringUnit": { 11873 "stringUnit": {
11874 "state": "translated", 11874 "state": "translated",
11875 "value": "Exporter en texte brut avec Emacs" 11875 "value": "Exporter en texte brut (ASCII)"
11876 } 11876 }
11877 }, 11877 },
11878 "ja": { 11878 "ja": {
11879 "stringUnit": { 11879 "stringUnit": {
11880 "state": "translated", 11880 "state": "translated",
11881 "value": "Emacsでプレーンテキストに書き出す" 11881 "value": "プレーンテキスト(ASCII)に書き出す"
11882 } 11882 }
11883 }, 11883 },
11884 "pt-BR": { 11884 "pt-BR": {
11885 "stringUnit": { 11885 "stringUnit": {
11886 "state": "translated", 11886 "state": "translated",
11887 "value": "Exportar para Texto Simples com o Emacs" 11887 "value": "Exportar para Texto Simples (ASCII)"
11888 } 11888 }
11889 } 11889 }
11890 } 11890 }