Commit 2986af1074
Verified · cmc
Layout: unified · split
Sources/OrgApp/CommandTitles.swift +2
| @@ -314,6 +314,8 @@ enum CommandTitles { | |||
| 314 | String(localized: "Transpose Table", comment: "Command title"), | 314 | String(localized: "Transpose Table", comment: "Command title"), |
| 315 | String(localized: "Truncate or Wrap Long Lines", comment: "Command title"), | 315 | String(localized: "Truncate or Wrap Long Lines", comment: "Command title"), |
| 316 | String(localized: "Turn Auto Fill On or Off", comment: "Command title"), | 316 | String(localized: "Turn Auto Fill On or Off", comment: "Command title"), |
| 317 | String(localized: "Turn Body-Only Export On or Off", comment: "Command title"), | ||
| 318 | String(localized: "Turn Subtree Export On or Off", comment: "Command title"), | ||
| 317 | String(localized: "Underline", comment: "Command title"), | 319 | String(localized: "Underline", comment: "Command title"), |
| 318 | String(localized: "Undo", comment: "Command title"), | 320 | String(localized: "Undo", comment: "Command title"), |
| 319 | String(localized: "Unset Attachment Folder", comment: "Command title"), | 321 | String(localized: "Unset Attachment Folder", comment: "Command title"), |
Sources/OrgApp/ExportSettings.swift added +68
| @@ -0,0 +1,68 @@ | |||
| 1 | import Foundation | ||
| 2 | |||
| 3 | /// A file's export choices: what the export dialog shows for it, and the scope and body-only | ||
| 4 | /// choice its single-format export commands follow, as `C-s` and `C-b` in Org's dispatcher. | ||
| 5 | /// Kept in the defaults by the file's path. | ||
| 6 | public struct ExportSettings: Codable, Equatable, Sendable { | ||
| 7 | public var format = "html" | ||
| 8 | /// The subtree at the caret, not the whole file. | ||
| 9 | public var subtree = false | ||
| 10 | public var bodyOnly = false | ||
| 11 | public var openAfter = false | ||
| 12 | |||
| 13 | public static let key = "exportSettings" | ||
| 14 | /// Shown when body only is on and the format is a whole document. | ||
| 15 | public static let noBodyOnly = "This format has no body-only export. Turn body-only export off for this file first." | ||
| 16 | |||
| 17 | public init() {} | ||
| 18 | |||
| 19 | /// PDF, Word, RTF, plain text, ODT and iCalendar are whole documents. | ||
| 20 | public static func allowsBodyOnly(_ format: String) -> Bool { | ||
| 21 | !["pdf", "print-pdf", "odt", "docx", "rtf", "plain-text", "icalendar"].contains(format) | ||
| 22 | } | ||
| 23 | |||
| 24 | /// The settings kept for the file at `path`. Without any: the format and open-after choice | ||
| 25 | /// last exported with, the whole file, and the whole document. | ||
| 26 | public static func saved(for path: String, defaults: UserDefaults = .standard) -> ExportSettings { | ||
| 27 | if let kept = all(defaults)[path] { return kept } | ||
| 28 | var settings = ExportSettings() | ||
| 29 | settings.format = defaults.string(forKey: "exportFormat") ?? settings.format | ||
| 30 | settings.openAfter = defaults.bool(forKey: "exportOpenAfter") | ||
| 31 | return settings | ||
| 32 | } | ||
| 33 | |||
| 34 | /// Keeps the settings for the file at `path`; with `lastUsed`, the format and open-after | ||
| 35 | /// choice also become what a file without settings starts with. | ||
| 36 | public func save(for path: String, lastUsed: Bool = false, defaults: UserDefaults = .standard) { | ||
| 37 | var all = Self.all(defaults) | ||
| 38 | all[path] = self | ||
| 39 | if let data = try? JSONEncoder().encode(all) { defaults.set(data, forKey: Self.key) } | ||
| 40 | guard lastUsed else { return } | ||
| 41 | defaults.set(format, forKey: "exportFormat") | ||
| 42 | defaults.set(openAfter, forKey: "exportOpenAfter") | ||
| 43 | } | ||
| 44 | |||
| 45 | /// The scope and body-only choice a single-format export command follows for `format`. Nil | ||
| 46 | /// when body only is on and the format has none. The agenda files' calendars are not the | ||
| 47 | /// file's export, so they follow neither. | ||
| 48 | public func commandOptions(_ format: String) -> (subtree: Bool, bodyOnly: Bool)? { | ||
| 49 | if format.hasPrefix("icalendar-") { return (false, false) } | ||
| 50 | guard !bodyOnly || Self.allowsBodyOnly(format == "html-open" ? "html" : format) else { return nil } | ||
| 51 | return (subtree, bodyOnly) | ||
| 52 | } | ||
| 53 | |||
| 54 | /// The message after an export to the file named `name`, saying what was exported when it | ||
| 55 | /// was not the whole file as a whole document. | ||
| 56 | public static func exported(_ name: String, subtree: Bool, bodyOnly: Bool) -> String { | ||
| 57 | switch (subtree, bodyOnly) { | ||
| 58 | case (true, true): "Exported the subtree's body to \(name)" | ||
| 59 | case (true, false): "Exported the subtree to \(name)" | ||
| 60 | case (false, true): "Exported the body to \(name)" | ||
| 61 | case (false, false): "Exported to \(name)" | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | private static func all(_ defaults: UserDefaults) -> [String: ExportSettings] { | ||
| 66 | defaults.data(forKey: key).flatMap { try? JSONDecoder().decode([String: ExportSettings].self, from: $0) } ?? [:] | ||
| 67 | } | ||
| 68 | } | ||
Sources/OrgCore/Keymap/PresetEmacs.swift +6
| @@ -470,6 +470,12 @@ extension KeymapPreset { | |||
| 470 | keys = "C-c C-x C-z" | 470 | keys = "C-c C-x C-z" |
| 471 | command = "app.clock.resolve" | 471 | command = "app.clock.resolve" |
| 472 | [[bind]] | 472 | [[bind]] |
| 473 | keys = "C-c C-e C-s" | ||
| 474 | command = "app.export-subtree" | ||
| 475 | [[bind]] | ||
| 476 | keys = "C-c C-e C-b" | ||
| 477 | command = "app.export-body-only" | ||
| 478 | [[bind]] | ||
| 473 | keys = "C-c C-e h h" | 479 | keys = "C-c C-e h h" |
| 474 | command = "app.export.html" | 480 | command = "app.export.html" |
| 475 | [[bind]] | 481 | [[bind]] |
Sources/OrgEditorAppKit/EditorCommands.swift +2
| @@ -164,6 +164,8 @@ public enum EditorCommands { | |||
| 164 | EditorCommand(id: "app.crypt.encrypt-entries", title: "Encrypt Tagged Entries…", action: .app), | 164 | EditorCommand(id: "app.crypt.encrypt-entries", title: "Encrypt Tagged Entries…", action: .app), |
| 165 | EditorCommand(id: "app.crypt.forget-passphrase", title: "Forget Encryption Passphrase", action: .app), | 165 | EditorCommand(id: "app.crypt.forget-passphrase", title: "Forget Encryption Passphrase", action: .app), |
| 166 | EditorCommand(id: "app.export-dialog", title: "Export…", action: .app), | 166 | EditorCommand(id: "app.export-dialog", title: "Export…", action: .app), |
| 167 | EditorCommand(id: "app.export-subtree", title: "Turn Subtree Export On or Off", action: .app), | ||
| 168 | EditorCommand(id: "app.export-body-only", title: "Turn Body-Only Export On or Off", action: .app), | ||
| 167 | EditorCommand(id: "app.sync-conflicts", title: "Resolve Sync Conflicts…", action: .app), | 169 | EditorCommand(id: "app.sync-conflicts", title: "Resolve Sync Conflicts…", action: .app), |
| 168 | EditorCommand(id: "app.revert", title: "Revert to File on Disk", action: .app), | 170 | EditorCommand(id: "app.revert", title: "Revert to File on Disk", action: .app), |
| 169 | EditorCommand(id: "app.recovery", title: "Recovery Versions…", action: .app), | 171 | EditorCommand(id: "app.recovery", title: "Recovery Versions…", action: .app), |
Sources/Orgstar/ContentView.swift +26 −11
| @@ -620,7 +620,7 @@ struct ContentView: View { | |||
| 620 | do { | 620 | do { |
| 621 | let target = try ICalendarFiles.export(whole, path: path, settings: defaults, options: OrgPreferences.icalendarOptions(), | 621 | let target = try ICalendarFiles.export(whole, path: path, settings: defaults, options: OrgPreferences.icalendarOptions(), |
| 622 | subtree: subtree ? caret : nil, destination: destination) | 622 | subtree: subtree ? caret : nil, destination: destination) |
| 623 | commands.show("Exported to \(target.lastPathComponent)") | 623 | commands.show(ExportSettings.exported(target.lastPathComponent, subtree: subtree, bodyOnly: bodyOnly)) |
| 624 | if open { NSWorkspace.shared.open(target) } | 624 | if open { NSWorkspace.shared.open(target) } |
| 625 | } catch { | 625 | } catch { |
| 626 | commands.show("Can't export: \(error.localizedDescription)") | 626 | commands.show("Can't export: \(error.localizedDescription)") |
| @@ -637,16 +637,16 @@ struct ContentView: View { | |||
| 637 | do { | 637 | do { |
| 638 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) | 638 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) |
| 639 | try content.write(to: target, atomically: true, encoding: .utf8) | 639 | try content.write(to: target, atomically: true, encoding: .utf8) |
| 640 | commands.show("Exported to \(target.lastPathComponent)") | 640 | commands.show(ExportSettings.exported(target.lastPathComponent, subtree: subtree, bodyOnly: bodyOnly)) |
| 641 | if open { NSWorkspace.shared.open(target) } | 641 | if open { NSWorkspace.shared.open(target) } |
| 642 | } catch { | 642 | } catch { |
| 643 | commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)") | 643 | commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)") |
| 644 | } | 644 | } |
| 645 | case "latex" where exportNative("LaTeX", extension: "tex", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, settings: defaults, export: { | 645 | case "latex" where exportNative("LaTeX", extension: "tex", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, bodyOnly: bodyOnly, settings: defaults, export: { |
| 646 | try LaTeXExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true) | 646 | try LaTeXExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true) |
| 647 | }): | 647 | }): |
| 648 | break | 648 | break |
| 649 | case "text" where exportNative("plain text", extension: "txt", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, settings: defaults, export: { | 649 | case "text" where exportNative("plain text", extension: "txt", whole: whole, url: url, to: destination, open: open, subtree: subtree ? caret : nil, bodyOnly: bodyOnly, settings: defaults, export: { |
| 650 | try ASCIIExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true) | 650 | try ASCIIExport.document(text, settings: defaults, path: path, bodyOnly: bodyOnly, author: NSFullUserName(), language: OrgPreferences.exportLanguage(), file: true) |
| 651 | }): | 651 | }): |
| 652 | break | 652 | break |
| @@ -659,7 +659,7 @@ struct ContentView: View { | |||
| 659 | let data = try ODTExport.document(text, settings: defaults, path: path, author: NSFullUserName(), language: OrgPreferences.exportLanguage()) | 659 | let data = try ODTExport.document(text, settings: defaults, path: path, author: NSFullUserName(), language: OrgPreferences.exportLanguage()) |
| 660 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) | 660 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) |
| 661 | try data.write(to: target, options: .atomic) | 661 | try data.write(to: target, options: .atomic) |
| 662 | commands.show("Exported to \(target.lastPathComponent)") | 662 | commands.show(ExportSettings.exported(target.lastPathComponent, subtree: subtree, bodyOnly: bodyOnly)) |
| 663 | if open { NSWorkspace.shared.open(target) } | 663 | if open { NSWorkspace.shared.open(target) } |
| 664 | } catch { | 664 | } catch { |
| 665 | commands.show("Can't export \(target.lastPathComponent): \(error.localizedDescription)") | 665 | commands.show("Can't export \(target.lastPathComponent): \(error.localizedDescription)") |
| @@ -687,7 +687,7 @@ struct ContentView: View { | |||
| 687 | } | 687 | } |
| 688 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) | 688 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) |
| 689 | try data.write(to: target, options: .atomic) | 689 | try data.write(to: target, options: .atomic) |
| 690 | commands.show("Exported to \(target.lastPathComponent)") | 690 | commands.show(ExportSettings.exported(target.lastPathComponent, subtree: subtree, bodyOnly: bodyOnly)) |
| 691 | if open { NSWorkspace.shared.open(target) } | 691 | if open { NSWorkspace.shared.open(target) } |
| 692 | } catch { | 692 | } catch { |
| 693 | commands.show("Can't export \(target.lastPathComponent): \(error)") | 693 | commands.show("Can't export \(target.lastPathComponent): \(error)") |
| @@ -710,7 +710,7 @@ struct ContentView: View { | |||
| 710 | try FileManager.default.moveItem(at: written, to: destination) | 710 | try FileManager.default.moveItem(at: written, to: destination) |
| 711 | written = destination | 711 | written = destination |
| 712 | } | 712 | } |
| 713 | commands.show("Exported to \(written.lastPathComponent)") | 713 | commands.show(ExportSettings.exported(written.lastPathComponent, subtree: subtree, bodyOnly: bodyOnly)) |
| 714 | if open { NSWorkspace.shared.open(written) } | 714 | if open { NSWorkspace.shared.open(written) } |
| 715 | } catch is CancellationError { | 715 | } catch is CancellationError { |
| 716 | commands.show("Export canceled") | 716 | commands.show("Export canceled") |
| @@ -728,7 +728,7 @@ struct ContentView: View { | |||
| 728 | /// Writes what `export` makes, as ox does for `format`. False when the native export can't | 728 | /// Writes what `export` makes, as ox does for `format`. False when the native export can't |
| 729 | /// match Emacs and Emacs is installed to export instead; otherwise the reason is shown. | 729 | /// match Emacs and Emacs is installed to export instead; otherwise the reason is shown. |
| 730 | private func exportNative( | 730 | private func exportNative( |
| 731 | _ format: String, extension ext: String, whole: String, url: URL, to destination: URL?, open: Bool, subtree: Int?, settings: OrgSettings, | 731 | _ format: String, extension ext: String, whole: String, url: URL, to destination: URL?, open: Bool, subtree: Int?, bodyOnly: Bool, settings: OrgSettings, |
| 732 | export: () throws -> String | 732 | export: () throws -> String |
| 733 | ) -> Bool { | 733 | ) -> Bool { |
| 734 | let content: String | 734 | let content: String |
| @@ -746,7 +746,7 @@ struct ContentView: View { | |||
| 746 | do { | 746 | do { |
| 747 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) | 747 | try FileManager.default.createDirectory(at: target.deletingLastPathComponent(), withIntermediateDirectories: true) |
| 748 | try content.write(to: target, atomically: true, encoding: .utf8) | 748 | try content.write(to: target, atomically: true, encoding: .utf8) |
| 749 | commands.show("Exported to \(target.lastPathComponent)") | 749 | commands.show(ExportSettings.exported(target.lastPathComponent, subtree: subtree != nil, bodyOnly: bodyOnly)) |
| 750 | if open { NSWorkspace.shared.open(target) } | 750 | if open { NSWorkspace.shared.open(target) } |
| 751 | } catch { | 751 | } catch { |
| 752 | commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)") | 752 | commands.show("Can't write \(target.lastPathComponent): \(error.localizedDescription)") |
| @@ -1243,7 +1243,7 @@ struct ContentView: View { | |||
| 1243 | return commands.show(Self.unavailable(EditorCommands.all.first { $0.id == id }?.title ?? id)) | 1243 | return commands.show(Self.unavailable(EditorCommands.all.first { $0.id == id }?.title ?? id)) |
| 1244 | } | 1244 | } |
| 1245 | if let feature = ProFeature.required(byCommand: id), !ProAccess.shared.allows(feature) { return } | 1245 | if let feature = ProFeature.required(byCommand: id), !ProAccess.shared.allows(feature) { return } |
| 1246 | let orgOnly = ["app.refile", "app.refile.copy", "app.archive", "app.clock.in", "app.clock.default", "app.copy-rich-text"].contains(id) || (id.hasPrefix("app.export.") && !id.hasPrefix("app.export.icalendar-")) || id.hasPrefix("org.") | 1246 | let orgOnly = ["app.refile", "app.refile.copy", "app.archive", "app.clock.in", "app.clock.default", "app.copy-rich-text", "app.export-subtree", "app.export-body-only"].contains(id) || (id.hasPrefix("app.export.") && !id.hasPrefix("app.export.icalendar-")) || id.hasPrefix("org.") |
| 1247 | if orgOnly, !session.isOrg { | 1247 | if orgOnly, !session.isOrg { |
| 1248 | commands.show("Not an org file") | 1248 | commands.show("Not an org file") |
| 1249 | return | 1249 | return |
| @@ -1438,8 +1438,23 @@ struct ContentView: View { | |||
| 1438 | case "app.export-dialog": | 1438 | case "app.export-dialog": |
| 1439 | guard let path = session.path else { return commands.show("No file is open") } | 1439 | guard let path = session.path else { return commands.show("No file is open") } |
| 1440 | panel = .export(UUID(), URL(fileURLWithPath: path)) | 1440 | panel = .export(UUID(), URL(fileURLWithPath: path)) |
| 1441 | case "app.export-subtree", "app.export-body-only": | ||
| 1442 | guard let path = session.path else { return commands.show("No file is open") } | ||
| 1443 | var settings = ExportSettings.saved(for: path) | ||
| 1444 | if id == "app.export-subtree" { | ||
| 1445 | settings.subtree.toggle() | ||
| 1446 | commands.show(settings.subtree ? "Export commands: subtree at the caret" : "Export commands: whole file") | ||
| 1447 | } else { | ||
| 1448 | settings.bodyOnly.toggle() | ||
| 1449 | commands.show(settings.bodyOnly ? "Export commands: body only" : "Export commands: whole document") | ||
| 1450 | } | ||
| 1451 | settings.save(for: path) | ||
| 1441 | case let id where id.hasPrefix("app.export."): | 1452 | case let id where id.hasPrefix("app.export."): |
| 1442 | export(String(id.dropFirst("app.export.".count))) | 1453 | let format = String(id.dropFirst("app.export.".count)) |
| 1454 | guard let options = (session.path.map { ExportSettings.saved(for: $0) } ?? ExportSettings()).commandOptions(format) else { | ||
| 1455 | return commands.show(ExportSettings.noBodyOnly) | ||
| 1456 | } | ||
| 1457 | export(format, subtree: options.subtree, bodyOnly: options.bodyOnly) | ||
| 1443 | case let id where id.hasPrefix("app.publish"): | 1458 | case let id where id.hasPrefix("app.publish"): |
| 1444 | publish(id) | 1459 | publish(id) |
| 1445 | case "app.plot": | 1460 | case "app.plot": |
Sources/Orgstar/ExportSheet.swift +27 −7
| @@ -1,4 +1,5 @@ | |||
| 1 | import AppKit | 1 | import AppKit |
| 2 | import OrgApp | ||
| 2 | import SwiftUI | 3 | import SwiftUI |
| 3 | 4 | ||
| 4 | /// Export… (`app.export-dialog`): the format, where the file goes, and whether to open it after. | 5 | /// Export… (`app.export-dialog`): the format, where the file goes, and whether to open it after. |
| @@ -11,16 +12,32 @@ struct ExportSheet: View { | |||
| 11 | /// Without a chosen destination, the App Store build passes nil, and the export asks where | 12 | /// Without a chosen destination, the App Store build passes nil, and the export asks where |
| 12 | /// to write when the default is outside the sandbox's reach. | 13 | /// to write when the default is outside the sandbox's reach. |
| 13 | let export: (_ format: String, _ destination: URL?, _ open: Bool, _ subtree: Bool, _ bodyOnly: Bool) -> Void | 14 | let export: (_ format: String, _ destination: URL?, _ open: Bool, _ subtree: Bool, _ bodyOnly: Bool) -> Void |
| 14 | @AppStorage("exportFormat") private var format = "html" | 15 | /// The file's settings, kept when it is exported. |
| 15 | @AppStorage("exportOpenAfter") private var openAfter = false | 16 | @State private var format: String |
| 16 | @AppStorage("exportBodyOnly") private var bodyOnly = false | 17 | @State private var openAfter: Bool |
| 18 | @State private var bodyOnly: Bool | ||
| 19 | @State private var subtree: Bool | ||
| 17 | @AppStorage("pdfMargin") private var pdfMargin = 50 | 20 | @AppStorage("pdfMargin") private var pdfMargin = 50 |
| 18 | @AppStorage("pdfFont") private var pdfFont = "" | 21 | @AppStorage("pdfFont") private var pdfFont = "" |
| 19 | @AppStorage("pdfPageNumbers") private var pdfPageNumbers = true | 22 | @AppStorage("pdfPageNumbers") private var pdfPageNumbers = true |
| 20 | @State private var subtree = false | ||
| 21 | @State private var destination: URL? | 23 | @State private var destination: URL? |
| 22 | @Environment(\.dismiss) private var dismiss | 24 | @Environment(\.dismiss) private var dismiss |
| 23 | 25 | ||
| 26 | init( | ||
| 27 | source: URL, inSubtree: Bool, target: @escaping (_ ext: String, _ subtree: Bool) -> URL, | ||
| 28 | export: @escaping (_ format: String, _ destination: URL?, _ open: Bool, _ subtree: Bool, _ bodyOnly: Bool) -> Void | ||
| 29 | ) { | ||
| 30 | self.source = source | ||
| 31 | self.inSubtree = inSubtree | ||
| 32 | self.target = target | ||
| 33 | self.export = export | ||
| 34 | let saved = ExportSettings.saved(for: source.path) | ||
| 35 | _format = State(initialValue: saved.format) | ||
| 36 | _openAfter = State(initialValue: saved.openAfter) | ||
| 37 | _bodyOnly = State(initialValue: saved.bodyOnly) | ||
| 38 | _subtree = State(initialValue: saved.subtree) | ||
| 39 | } | ||
| 40 | |||
| 24 | #if APPSTORE | 41 | #if APPSTORE |
| 25 | static let formats: [(id: String, title: String, ext: String)] = [ | 42 | static let formats: [(id: String, title: String, ext: String)] = [ |
| 26 | ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"), | 43 | ("html", "HTML", "html"), ("markdown", "Markdown", "md"), ("print-pdf", "PDF", "pdf"), ("docx", "Word", "docx"), |
| @@ -37,9 +54,9 @@ struct ExportSheet: View { | |||
| 37 | #endif | 54 | #endif |
| 38 | 55 | ||
| 39 | private var ext: String { Self.formats.first { $0.id == format }?.ext ?? "html" } | 56 | private var ext: String { Self.formats.first { $0.id == format }?.ext ?? "html" } |
| 40 | private var chosen: URL { destination ?? target(ext, subtree) } | 57 | private var chosen: URL { destination ?? target(ext, subtree && inSubtree) } |
| 41 | /// PDF and ODT are whole documents. | 58 | /// PDF and ODT are whole documents. |
| 42 | private var allowsBodyOnly: Bool { !["pdf", "print-pdf", "odt", "docx", "rtf", "plain-text", "icalendar"].contains(format) } | 59 | private var allowsBodyOnly: Bool { ExportSettings.allowsBodyOnly(format) } |
| 43 | 60 | ||
| 44 | var body: some View { | 61 | var body: some View { |
| 45 | Form { | 62 | Form { |
| @@ -47,7 +64,7 @@ struct ExportSheet: View { | |||
| 47 | ForEach(Self.formats, id: \.id) { Text($0.title).tag($0.id) } | 64 | ForEach(Self.formats, id: \.id) { Text($0.title).tag($0.id) } |
| 48 | } | 65 | } |
| 49 | .onChange(of: format) { destination = destination.map { $0.deletingPathExtension().appendingPathExtension(ext) } } | 66 | .onChange(of: format) { destination = destination.map { $0.deletingPathExtension().appendingPathExtension(ext) } } |
| 50 | Picker("Scope", selection: $subtree) { | 67 | Picker("Scope", selection: Binding(get: { subtree && inSubtree }, set: { subtree = $0 })) { |
| 51 | Text("Whole file").tag(false) | 68 | Text("Whole file").tag(false) |
| 52 | Text("Subtree at the caret").tag(true) | 69 | Text("Subtree at the caret").tag(true) |
| 53 | } | 70 | } |
| @@ -78,6 +95,9 @@ struct ExportSheet: View { | |||
| 78 | Spacer() | 95 | Spacer() |
| 79 | Button("Cancel") { dismiss() }.keyboardShortcut(.cancelAction) | 96 | Button("Cancel") { dismiss() }.keyboardShortcut(.cancelAction) |
| 80 | Button("Export") { | 97 | Button("Export") { |
| 98 | var settings = ExportSettings() | ||
| 99 | (settings.format, settings.subtree, settings.bodyOnly, settings.openAfter) = (format, subtree, bodyOnly, openAfter) | ||
| 100 | settings.save(for: source.path, lastUsed: true) | ||
| 81 | #if APPSTORE | 101 | #if APPSTORE |
| 82 | export(format, destination, openAfter, subtree && inSubtree, bodyOnly && allowsBodyOnly) | 102 | export(format, destination, openAfter, subtree && inSubtree, bodyOnly && allowsBodyOnly) |
| 83 | #else | 103 | #else |
Sources/OrgstarMobile/EditorScreen.swift +6 −1
| @@ -486,6 +486,10 @@ struct EditorScreen: View { | |||
| 486 | if let text = session.document(of: path)?.text { message = ExportMenu.copy(path: path, text: text, theme: model.theme) } | 486 | if let text = session.document(of: path)?.text { message = ExportMenu.copy(path: path, text: text, theme: model.theme) } |
| 487 | } else if id == "app.export.html-open" { | 487 | } else if id == "app.export.html-open" { |
| 488 | exportHTMLAndOpen() | 488 | exportHTMLAndOpen() |
| 489 | } else if id == "app.export-body-only" { | ||
| 490 | let on = !ExportSettings.saved(for: path).bodyOnly | ||
| 491 | ExportMenu.setBodyOnly(on, path: path) | ||
| 492 | message = on ? "Export: body only" : "Export: whole document" | ||
| 489 | } else if id == "app.export.icalendar-agenda" || id == "app.export.icalendar-combined" { | 493 | } else if id == "app.export.icalendar-agenda" || id == "app.export.icalendar-combined" { |
| 490 | agendaCalendars(combined: id == "app.export.icalendar-combined") | 494 | agendaCalendars(combined: id == "app.export.icalendar-combined") |
| 491 | } else if id.hasPrefix("app.publish") { | 495 | } else if id.hasPrefix("app.publish") { |
| @@ -632,7 +636,7 @@ extension EditorScreen { | |||
| 632 | /// `org-html-export-to-html` and open: the page in Quick Look, from a temporary file. | 636 | /// `org-html-export-to-html` and open: the page in Quick Look, from a temporary file. |
| 633 | private func exportHTMLAndOpen() { | 637 | private func exportHTMLAndOpen() { |
| 634 | guard let text = session.document(of: path)?.text else { return } | 638 | guard let text = session.document(of: path)?.text else { return } |
| 635 | let html = OrgExport.html(text, path: path, theme: model.theme) | 639 | let html = OrgExport.html(text, path: path, theme: model.theme, bodyOnly: ExportSettings.saved(for: path).bodyOnly) |
| 636 | let name = ExportScope.output(for: URL(fileURLWithPath: path), name: ExportScope.fileName(text, settings: OrgPreferences.orgSettings()), extension: "html") | 640 | let name = ExportScope.output(for: URL(fileURLWithPath: path), name: ExportScope.fileName(text, settings: OrgPreferences.orgSettings()), extension: "html") |
| 637 | .lastPathComponent | 641 | .lastPathComponent |
| 638 | do { | 642 | do { |
| @@ -1090,6 +1094,7 @@ struct CommandPalette: View { | |||
| 1090 | ("app.clock.default", "Mark as Default Clock Task"), ("app.clock.resolve", "Resolve Open Clocks…"), | 1094 | ("app.clock.default", "Mark as Default Clock Task"), ("app.clock.resolve", "Resolve Open Clocks…"), |
| 1091 | ("app.refile", "Refile…"), ("app.refile.copy", "Copy to Refile Target…"), ("app.refile.goto", "Go to Refile Target…"), | 1095 | ("app.refile", "Refile…"), ("app.refile.copy", "Copy to Refile Target…"), ("app.refile.goto", "Go to Refile Target…"), |
| 1092 | ("app.archive", "Archive Subtree"), ("app.copy-rich-text", "Copy as Rich Text"), ("app.export.html-open", "Export to HTML and Open"), | 1096 | ("app.archive", "Archive Subtree"), ("app.copy-rich-text", "Copy as Rich Text"), ("app.export.html-open", "Export to HTML and Open"), |
| 1097 | ("app.export-body-only", "Turn Body-Only Export On or Off"), | ||
| 1093 | ("app.export.icalendar-agenda", "Export Agenda Files to iCalendar"), ("app.export.icalendar-combined", "Combine Agenda Files into iCalendar"), | 1098 | ("app.export.icalendar-agenda", "Export Agenda Files to iCalendar"), ("app.export.icalendar-combined", "Combine Agenda Files into iCalendar"), |
| 1094 | ("app.publish", "Publish Project…"), ("app.publish.all", "Publish All Projects"), ("app.publish.current-file", "Publish Current File"), | 1099 | ("app.publish", "Publish Project…"), ("app.publish.all", "Publish All Projects"), ("app.publish.current-file", "Publish Current File"), |
| 1095 | ("app.publish.current-project", "Publish Current Project"), | 1100 | ("app.publish.current-project", "Publish Current Project"), |
Sources/OrgstarMobile/ExportMenu.swift +33 −10
| @@ -31,6 +31,9 @@ struct OrgExport: Transferable { | |||
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /// Whether it can leave out the title and the page around the text. | ||
| 35 | var allowsBodyOnly: Bool { [.html, .markdown, .latex, .ascii].contains(self) } | ||
| 36 | |||
| 34 | var fileExtension: String { | 37 | var fileExtension: String { |
| 35 | switch self { | 38 | switch self { |
| 36 | case .html: "html" | 39 | case .html: "html" |
| @@ -55,6 +58,8 @@ struct OrgExport: Transferable { | |||
| 55 | let codeStyle: HTMLCodeStyle | 58 | let codeStyle: HTMLCodeStyle |
| 56 | /// The subtree at this offset exported alone. | 59 | /// The subtree at this offset exported alone. |
| 57 | var subtree: Int? | 60 | var subtree: Int? |
| 61 | /// Without the title and the page around the text, in the formats that allow it. | ||
| 62 | var bodyOnly = false | ||
| 58 | 63 | ||
| 59 | /// The subtree's `EXPORT_FILE_NAME`, `#+EXPORT_FILE_NAME`'s name, or the file's, with the | 64 | /// The subtree's `EXPORT_FILE_NAME`, `#+EXPORT_FILE_NAME`'s name, or the file's, with the |
| 60 | /// format's extension. | 65 | /// format's extension. |
| @@ -93,10 +98,10 @@ struct OrgExport: Transferable { | |||
| 93 | 98 | ||
| 94 | /// The page HTML export makes of `text`, the file at `path`, with its setup files. | 99 | /// The page HTML export makes of `text`, the file at `path`, with its setup files. |
| 95 | @MainActor | 100 | @MainActor |
| 96 | static func html(_ text: String, path: String, theme: ThemeSpec) -> String { | 101 | static func html(_ text: String, path: String, theme: ThemeSpec, bodyOnly: Bool = false) -> String { |
| 97 | let base = ((path as NSString).lastPathComponent as NSString).deletingPathExtension | 102 | let base = ((path as NSString).lastPathComponent as NSString).deletingPathExtension |
| 98 | let settings = OrgPreferences.orgSettings().resolvingSetupFiles(in: text, path: path, read: OrgSettings.readFile) | 103 | let settings = OrgPreferences.orgSettings().resolvingSetupFiles(in: text, path: path, read: OrgSettings.readFile) |
| 99 | return HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, | 104 | return HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, bodyOnly: bodyOnly, |
| 100 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: theme), language: OrgPreferences.exportLanguage()) | 105 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: theme), language: OrgPreferences.exportLanguage()) |
| 101 | } | 106 | } |
| 102 | 107 | ||
| @@ -109,14 +114,14 @@ struct OrgExport: Transferable { | |||
| 109 | let text = subtree.flatMap { ExportScope.subtree(self.text, at: $0, settings: settings) } ?? self.text | 114 | let text = subtree.flatMap { ExportScope.subtree(self.text, at: $0, settings: settings) } ?? self.text |
| 110 | switch format { | 115 | switch format { |
| 111 | case .html: | 116 | case .html: |
| 112 | try HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, codeStyle: codeStyle, language: OrgPreferences.exportLanguage()) | 117 | try HTMLExport.page(text, fallbackTitle: base, settings: settings, path: path, bodyOnly: bodyOnly, codeStyle: codeStyle, language: OrgPreferences.exportLanguage()) |
| 113 | .write(to: url, atomically: true, encoding: .utf8) | 118 | .write(to: url, atomically: true, encoding: .utf8) |
| 114 | case .markdown: | 119 | case .markdown: |
| 115 | try MarkdownExport.document(text, settings: settings, path: path).write(to: url, atomically: true, encoding: .utf8) | 120 | try MarkdownExport.document(text, settings: settings, path: path, bodyOnly: bodyOnly).write(to: url, atomically: true, encoding: .utf8) |
| 116 | case .latex: | 121 | case .latex: |
| 117 | let content: String | 122 | let content: String |
| 118 | do { | 123 | do { |
| 119 | content = try LaTeXExport.document(text, settings: settings, path: path, language: OrgPreferences.exportLanguage(), file: true) | 124 | content = try LaTeXExport.document(text, settings: settings, path: path, bodyOnly: bodyOnly, language: OrgPreferences.exportLanguage(), file: true) |
| 120 | } catch let error as LaTeXExport.Unsupported { | 125 | } catch let error as LaTeXExport.Unsupported { |
| 121 | let message = "Can't export to LaTeX: \(error.reason)" | 126 | let message = "Can't export to LaTeX: \(error.reason)" |
| 122 | await MainActor.run { NotificationCenter.default.post(name: Self.refused, object: message) } | 127 | await MainActor.run { NotificationCenter.default.post(name: Self.refused, object: message) } |
| @@ -126,7 +131,7 @@ struct OrgExport: Transferable { | |||
| 126 | case .ascii: | 131 | case .ascii: |
| 127 | let content: String | 132 | let content: String |
| 128 | do { | 133 | do { |
| 129 | content = try ASCIIExport.document(text, settings: settings, path: path, language: OrgPreferences.exportLanguage(), file: true) | 134 | content = try ASCIIExport.document(text, settings: settings, path: path, bodyOnly: bodyOnly, language: OrgPreferences.exportLanguage(), file: true) |
| 130 | } catch let error as ASCIIExport.Unsupported { | 135 | } catch let error as ASCIIExport.Unsupported { |
| 131 | let message = "Can't export to plain text: \(error.reason)" | 136 | let message = "Can't export to plain text: \(error.reason)" |
| 132 | await MainActor.run { NotificationCenter.default.post(name: Self.refused, object: message) } | 137 | await MainActor.run { NotificationCenter.default.post(name: Self.refused, object: message) } |
| @@ -166,18 +171,24 @@ struct ExportMenu: View { | |||
| 166 | var report: (String) -> Void = { _ in } | 171 | var report: (String) -> Void = { _ in } |
| 167 | /// Offers the subtree at the caret alone, where there is a caret. | 172 | /// Offers the subtree at the caret alone, where there is a caret. |
| 168 | var exportSubtree: (() -> Void)? | 173 | var exportSubtree: (() -> Void)? |
| 174 | /// Every file's export settings as kept, so the menu follows a change to this file's. | ||
| 175 | @AppStorage(ExportSettings.key) private var kept = Data() | ||
| 169 | 176 | ||
| 170 | var body: some View { | 177 | var body: some View { |
| 178 | let bodyOnly = kept.isEmpty ? false : ExportSettings.saved(for: path).bodyOnly | ||
| 171 | Menu("Export", systemImage: "square.and.arrow.up") { | 179 | Menu("Export", systemImage: "square.and.arrow.up") { |
| 172 | ForEach(OrgExport.Format.allCases, id: \.self) { format in | 180 | ForEach(OrgExport.Format.allCases, id: \.self) { format in |
| 173 | if format.locked { | 181 | if format.locked { |
| 174 | Button("\(format.name) (orgstar+)") { ProAccess.shared.allows(.export) } | 182 | Button("\(format.name) (orgstar+)") { ProAccess.shared.allows(.export) } |
| 183 | } else if bodyOnly, !format.allowsBodyOnly { | ||
| 184 | Button(format.name) { report(ExportSettings.noBodyOnly) } | ||
| 175 | } else { | 185 | } else { |
| 176 | let export = OrgExport(text: text, path: path, format: format, settings: OrgPreferences.orgSettings(), | 186 | let export = OrgExport(text: text, path: path, format: format, settings: OrgPreferences.orgSettings(), |
| 177 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: model.theme)) | 187 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: model.theme), bodyOnly: bodyOnly) |
| 178 | ShareLink(item: export, preview: SharePreview(export.fileName)) { Text(format.name) } | 188 | ShareLink(item: export, preview: SharePreview(export.fileName)) { Text(format.name) } |
| 179 | } | 189 | } |
| 180 | } | 190 | } |
| 191 | Toggle("Body Only", isOn: Binding(get: { bodyOnly }, set: { ExportMenu.setBodyOnly($0, path: path) })) | ||
| 181 | if let exportSubtree { | 192 | if let exportSubtree { |
| 182 | Button("Export Subtree…", systemImage: "list.bullet.indent") { exportSubtree() } | 193 | Button("Export Subtree…", systemImage: "list.bullet.indent") { exportSubtree() } |
| 183 | } | 194 | } |
| @@ -197,6 +208,13 @@ struct ExportMenu: View { | |||
| 197 | } | 208 | } |
| 198 | } | 209 | } |
| 199 | 210 | ||
| 211 | /// Keeps the body-only choice for the file at `path`. | ||
| 212 | static func setBodyOnly(_ on: Bool, path: String) { | ||
| 213 | var settings = ExportSettings.saved(for: path) | ||
| 214 | settings.bodyOnly = on | ||
| 215 | settings.save(for: path) | ||
| 216 | } | ||
| 217 | |||
| 200 | /// The file on the clipboard as HTML, RTF and plain text, to paste formatted. Returns a message. | 218 | /// The file on the clipboard as HTML, RTF and plain text, to paste formatted. Returns a message. |
| 201 | @MainActor | 219 | @MainActor |
| 202 | static func copy(path: String, text: String, theme: ThemeSpec) -> String { | 220 | static func copy(path: String, text: String, theme: ThemeSpec) -> String { |
| @@ -263,10 +281,15 @@ struct SubtreeExportScreen: View { | |||
| 263 | 281 | ||
| 264 | var body: some View { | 282 | var body: some View { |
| 265 | NavigationStack { | 283 | NavigationStack { |
| 284 | let bodyOnly = ExportSettings.saved(for: path).bodyOnly | ||
| 266 | List(OrgExport.Format.allCases.filter { !$0.locked }, id: \.self) { format in | 285 | List(OrgExport.Format.allCases.filter { !$0.locked }, id: \.self) { format in |
| 267 | let export = OrgExport(text: text, path: path, format: format, settings: OrgPreferences.orgSettings(), | 286 | if bodyOnly, !format.allowsBodyOnly { |
| 268 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: model.theme), subtree: caret) | 287 | LabeledContent(format.name) { Text("No body-only export") }.foregroundStyle(.secondary) |
| 269 | ShareLink(item: export, preview: SharePreview(export.fileName)) { Text(format.name) } | 288 | } else { |
| 289 | let export = OrgExport(text: text, path: path, format: format, settings: OrgPreferences.orgSettings(), | ||
| 290 | codeStyle: HTMLCodeStyle(highlighter: MobileEditor.highlighter, theme: model.theme), subtree: caret, bodyOnly: bodyOnly) | ||
| 291 | ShareLink(item: export, preview: SharePreview(export.fileName)) { Text(format.name) } | ||
| 292 | } | ||
| 270 | } | 293 | } |
| 271 | .navigationTitle("Export Subtree") | 294 | .navigationTitle("Export Subtree") |
| 272 | .navigationBarTitleDisplayMode(.inline) | 295 | .navigationBarTitleDisplayMode(.inline) |
Sources/OrgstarMobile/MobileEditor.swift +1 −1
| @@ -426,7 +426,7 @@ final class MobileEditor: NSObject, DocumentBuffer { | |||
| 426 | case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil | 426 | case "app.crypt.open-entry", "app.crypt.decrypt-entry": return onAppCommand != nil && OrgCrypt.encryptedRange(context.text, at: context.caret) != nil |
| 427 | case "app.table-export", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil | 427 | case "app.table-export", "app.plot": return onAppCommand != nil && ImportTable.exportText(context.text, at: context.caret, path: "") != nil |
| 428 | case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil | 428 | case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil |
| 429 | case "app.copy-rich-text", "app.export.html-open", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil | 429 | case "app.copy-rich-text", "app.export.html-open", "app.export-body-only", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil |
| 430 | case _ where id.hasPrefix("app.publish"): return onAppCommand != nil | 430 | case _ where id.hasPrefix("app.publish"): return onAppCommand != nil |
| 431 | case _ where Self.linkCommands.contains(id): return onAppCommand != nil | 431 | case _ where Self.linkCommands.contains(id): return onAppCommand != nil |
| 432 | case "org.link.open": return OpenLinkAtPoint().applies(in: context) | 432 | case "org.link.open": return OpenLinkAtPoint().applies(in: context) |
Tests/OrgAppTests/ExportSettingsTests.swift added +97
| @@ -0,0 +1,97 @@ | |||
| 1 | import Foundation | ||
| 2 | import Testing | ||
| 3 | @testable import OrgApp | ||
| 4 | import OrgCore | ||
| 5 | |||
| 6 | struct ExportSettingsTests { | ||
| 7 | static func defaults() -> UserDefaults { UserDefaults(suiteName: "orgstar-export-\(UUID().uuidString)")! } | ||
| 8 | |||
| 9 | static let file = "#+TITLE: Whole\n#+OPTIONS: toc:nil\nIntro.\n* One\nFirst.\n** Sub\nSub body.\n* Two\nSecond.\n" | ||
| 10 | static var caret: Int { (file as NSString).range(of: "First.").location } | ||
| 11 | |||
| 12 | /// What the Mac's export writes for a format, scope and body-only choice. | ||
| 13 | static func export(_ format: String, subtree: Bool, bodyOnly: Bool) throws -> String { | ||
| 14 | let text = subtree ? try #require(ExportScope.subtree(file, at: caret)) : file | ||
| 15 | switch format { | ||
| 16 | case "markdown": return MarkdownExport.document(text, bodyOnly: bodyOnly) | ||
| 17 | case "latex": return try LaTeXExport.document(text, bodyOnly: bodyOnly, author: "A", file: true) | ||
| 18 | case "text": return try ASCIIExport.document(text, bodyOnly: bodyOnly, author: "A", file: true) | ||
| 19 | default: return HTMLExport.page(text, fallbackTitle: "t", bodyOnly: bodyOnly) | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | @Test func settingsAreKeptPerFile() { | ||
| 24 | let defaults = Self.defaults() | ||
| 25 | #expect(ExportSettings.saved(for: "/notes/a.org", defaults: defaults) == ExportSettings()) | ||
| 26 | var a = ExportSettings() | ||
| 27 | (a.format, a.subtree, a.bodyOnly, a.openAfter) = ("markdown", true, true, true) | ||
| 28 | a.save(for: "/notes/a.org", defaults: defaults) | ||
| 29 | var b = ExportSettings() | ||
| 30 | b.format = "latex" | ||
| 31 | b.save(for: "/notes/b.org", defaults: defaults) | ||
| 32 | #expect(ExportSettings.saved(for: "/notes/a.org", defaults: defaults) == a) | ||
| 33 | #expect(ExportSettings.saved(for: "/notes/b.org", defaults: defaults) == b) | ||
| 34 | #expect(ExportSettings.saved(for: "/notes/c.org", defaults: defaults) == ExportSettings()) | ||
| 35 | } | ||
| 36 | |||
| 37 | /// A file without settings starts with the format and open-after choice last exported | ||
| 38 | /// with, and exports the whole file as a whole document. | ||
| 39 | @Test func aFileWithoutSettingsGetsTheLastUsedFormat() { | ||
| 40 | let defaults = Self.defaults() | ||
| 41 | var a = ExportSettings() | ||
| 42 | (a.format, a.subtree, a.bodyOnly, a.openAfter) = ("markdown", true, true, true) | ||
| 43 | a.save(for: "/notes/a.org", lastUsed: true, defaults: defaults) | ||
| 44 | var fresh = ExportSettings() | ||
| 45 | (fresh.format, fresh.openAfter) = ("markdown", true) | ||
| 46 | #expect(ExportSettings.saved(for: "/notes/c.org", defaults: defaults) == fresh) | ||
| 47 | var b = ExportSettings() | ||
| 48 | b.format = "odt" | ||
| 49 | b.save(for: "/notes/b.org", defaults: defaults) | ||
| 50 | #expect(ExportSettings.saved(for: "/notes/c.org", defaults: defaults) == fresh) | ||
| 51 | } | ||
| 52 | |||
| 53 | /// A single-format command exports what the dialog does with the same scope and body-only | ||
| 54 | /// choice. | ||
| 55 | @Test(arguments: ["html", "html-open", "markdown", "latex", "text"]) | ||
| 56 | func commandsFollowTheFilesSettings(_ format: String) throws { | ||
| 57 | let defaults = Self.defaults() | ||
| 58 | let whole = try Self.export(format, subtree: false, bodyOnly: false) | ||
| 59 | let fresh = try #require(ExportSettings.saved(for: "/notes/a.org", defaults: defaults).commandOptions(format)) | ||
| 60 | #expect(try Self.export(format, subtree: fresh.subtree, bodyOnly: fresh.bodyOnly) == whole) | ||
| 61 | for (subtree, bodyOnly) in [(true, false), (false, true), (true, true)] { | ||
| 62 | var settings = ExportSettings() | ||
| 63 | (settings.subtree, settings.bodyOnly) = (subtree, bodyOnly) | ||
| 64 | settings.save(for: "/notes/a.org", defaults: defaults) | ||
| 65 | let options = try #require(ExportSettings.saved(for: "/notes/a.org", defaults: defaults).commandOptions(format)) | ||
| 66 | let dialog = try Self.export(format, subtree: subtree, bodyOnly: bodyOnly) | ||
| 67 | #expect(try Self.export(format, subtree: options.subtree, bodyOnly: options.bodyOnly) == dialog) | ||
| 68 | #expect(dialog != whole) | ||
| 69 | #expect(dialog.contains("Second.") == !subtree) | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | @Test func theMessageSaysWhatWasExported() { | ||
| 74 | #expect(ExportSettings.exported("a.html", subtree: false, bodyOnly: false) == "Exported to a.html") | ||
| 75 | #expect(ExportSettings.exported("a.html", subtree: true, bodyOnly: false) == "Exported the subtree to a.html") | ||
| 76 | #expect(ExportSettings.exported("a.html", subtree: false, bodyOnly: true) == "Exported the body to a.html") | ||
| 77 | #expect(ExportSettings.exported("a.html", subtree: true, bodyOnly: true) == "Exported the subtree's body to a.html") | ||
| 78 | } | ||
| 79 | |||
| 80 | /// Body only is refused for the formats the dialog disables it for; the agenda files' | ||
| 81 | /// calendars follow neither choice. | ||
| 82 | @Test func bodyOnlyIsRefusedForWholeDocumentFormats() throws { | ||
| 83 | var settings = ExportSettings() | ||
| 84 | (settings.subtree, settings.bodyOnly) = (true, true) | ||
| 85 | for format in ["pdf", "print-pdf", "odt", "docx", "rtf", "plain-text", "icalendar"] { | ||
| 86 | #expect(!ExportSettings.allowsBodyOnly(format)) | ||
| 87 | #expect(settings.commandOptions(format) == nil) | ||
| 88 | } | ||
| 89 | for format in ["icalendar-agenda", "icalendar-combined"] { | ||
| 90 | let options = try #require(settings.commandOptions(format)) | ||
| 91 | #expect(options == (false, false)) | ||
| 92 | } | ||
| 93 | settings.bodyOnly = false | ||
| 94 | let options = try #require(settings.commandOptions("print-pdf")) | ||
| 95 | #expect(options == (true, false)) | ||
| 96 | } | ||
| 97 | } | ||
Tests/OrgCoreTests/ExportScopeTests.swift +46
| @@ -68,6 +68,52 @@ struct ExportScopeTests { | |||
| 68 | #expect(ExportScope.output(for: source, name: nil, extension: "md").path == "/notes/t.md") | 68 | #expect(ExportScope.output(for: source, name: nil, extension: "md").path == "/notes/t.md") |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | /// The words `C-s` and `C-b` keep in ox-html and ox-md, for the whole file and a subtree. | ||
| 72 | @Test(.enabled(if: ProcessInfo.processInfo.environment["ORGSTAR_SKIP_ORACLE"] == nil)) | ||
| 73 | func subtreeAndBodyOnlyKeepWhatOrgKeeps() throws { | ||
| 74 | let text = """ | ||
| 75 | #+TITLE: wordtitle | ||
| 76 | #+AUTHOR: wordauthor | ||
| 77 | #+OPTIONS: toc:nil num:nil | ||
| 78 | wordintro | ||
| 79 | * wordone | ||
| 80 | SCHEDULED: <2026-10-10 Sat> | ||
| 81 | :PROPERTIES: | ||
| 82 | :EXPORT_AUTHOR: wordbob | ||
| 83 | :wordkey: wordvalue | ||
| 84 | :END: | ||
| 85 | wordfirst | ||
| 86 | ** wordsub | ||
| 87 | worddeep | ||
| 88 | * wordtwo | ||
| 89 | wordsecond | ||
| 90 | """ + "\n" | ||
| 91 | let offset = (text as NSString).range(of: "wordfirst").location | ||
| 92 | let point = EmacsOracle.point(offset, in: text) | ||
| 93 | let emacs = try EmacsOracle.evaluate(text, """ | ||
| 94 | (progn | ||
| 95 | (require 'ox-html) (require 'ox-md) | ||
| 96 | (goto-char \(point)) | ||
| 97 | (list (org-export-as 'html t nil nil) (org-export-as 'html nil nil t) (org-export-as 'html t nil t) | ||
| 98 | (org-export-as 'md t nil nil) (org-export-as 'md nil nil t) (org-export-as 'md t nil t))) | ||
| 99 | """) | ||
| 100 | let subtree = try #require(ExportScope.subtree(text, at: offset)) | ||
| 101 | let ours = [ | ||
| 102 | HTMLExport.page(subtree, fallbackTitle: "t"), HTMLExport.page(text, fallbackTitle: "t", bodyOnly: true), | ||
| 103 | HTMLExport.page(subtree, fallbackTitle: "t", bodyOnly: true), | ||
| 104 | MarkdownExport.document(subtree), MarkdownExport.document(text, bodyOnly: true), MarkdownExport.document(subtree, bodyOnly: true), | ||
| 105 | ] | ||
| 106 | let names = ["html subtree", "html body", "html subtree body", "md subtree", "md body", "md subtree body"] | ||
| 107 | let words = Set(text.matches(of: /\bword[a-z]+\b/).map { String($0.0) }) | ||
| 108 | for (index, name) in names.enumerated() { | ||
| 109 | // ox-md writes no title; this export makes it the top heading. | ||
| 110 | for word in words where !(name == "md subtree" && word == "wordone") { | ||
| 111 | #expect(ours[index].contains(word) == emacs[index].contains(word), "\(name) \(word)\nours:\n\(ours[index])\nemacs:\n\(emacs[index])") | ||
| 112 | } | ||
| 113 | } | ||
| 114 | #expect(emacs[0].contains("wordone") && !emacs[2].contains("wordone") && !emacs[1].contains("wordtitle") && emacs[1].contains("wordsecond")) | ||
| 115 | } | ||
| 116 | |||
| 71 | @Test func markdownBodyOnlyHasNoTitle() { | 117 | @Test func markdownBodyOnlyHasNoTitle() { |
| 72 | let text = "#+TITLE: T\n* A\nx\n" | 118 | let text = "#+TITLE: T\n* A\nx\n" |
| 73 | #expect(MarkdownExport.document(text).hasPrefix("# T")) | 119 | #expect(MarkdownExport.document(text).hasPrefix("# T")) |
docs/manual/guide/03-keys.org +2
| @@ -985,6 +985,8 @@ When a key appears in several rows, it runs the command whose condition holds at | |||
| 985 | | Command | Emacs | Mac | Doom | What it does | | 985 | | Command | Emacs | Mac | Doom | What it does | |
| 986 | |-+-+-+-+-| | 986 | |-+-+-+-+-| |
| 987 | | Export… (=app.export-dialog=) | — | =⇧⌘E= | — | Opens the export sheet. In the Emacs and Doom presets =C-c C-e= is a prefix for the export keys only; pausing after it lists them in the key hints. | | 987 | | Export… (=app.export-dialog=) | — | =⇧⌘E= | — | Opens the export sheet. In the Emacs and Doom presets =C-c C-e= is a prefix for the export keys only; pausing after it lists them in the key hints. | |
| 988 | | Turn Subtree Export On or Off (=app.export-subtree=) | =C-c C-e C-s= | — | — | The file's export commands export the subtree at the caret, or the whole file again (=C-s= in =org-export-dispatch=). | | ||
| 989 | | Turn Body-Only Export On or Off (=app.export-body-only=) | =C-c C-e C-b= | — | — | The file's export commands leave out the title and the page, or write them again (=C-b= in =org-export-dispatch=). | | ||
| 988 | | Export to HTML (=app.export.html=) | =C-c C-e h h= | — | =SPC m e h h= (N) | Exports to HTML (=org-html-export-to-html=). | | 990 | | Export to HTML (=app.export.html=) | =C-c C-e h h= | — | =SPC m e h h= (N) | Exports to HTML (=org-html-export-to-html=). | |
| 989 | | Export to HTML and Open (=app.export.html-open=) | =C-c C-e h o= | — | =SPC m e h o= (N) | Exports to HTML and opens the result. | | 991 | | Export to HTML and Open (=app.export.html-open=) | =C-c C-e h o= | — | =SPC m e h o= (N) | Exports to HTML and opens the result. | |
| 990 | | Export to Markdown (=app.export.markdown=) | =C-c C-e m m= | — | =SPC m e m m= (N) | Exports to Markdown (=org-md-export-to-markdown=). | | 992 | | Export to Markdown (=app.export.markdown=) | =C-c C-e m m= | — | =SPC m e m m= (N) | Exports to Markdown (=org-md-export-to-markdown=). | |
docs/manual/guide/12-export.org +15 −5
| @@ -27,7 +27,16 @@ Export works on the file in the current editor, using its text as it is now, sav | |||
| 27 | 27 | ||
| 28 | The keys follow Emacs's export dispatcher (=org-export-dispatch=). =C-c C-e= on its own is only a prefix: pause after it and the key hints list the formats. The =SPC m e= keys work in normal state; the =C-c C-e= keys work in every Doom state. The Mac preset has no keys for the single formats; its =⇧⌘E= opens the export dialog. | 28 | The keys follow Emacs's export dispatcher (=org-export-dispatch=). =C-c C-e= on its own is only a prefix: pause after it and the key hints list the formats. The =SPC m e= keys work in normal state; the =C-c C-e= keys work in every Doom state. The Mac preset has no keys for the single formats; its =⇧⌘E= opens the export dialog. |
| 29 | 29 | ||
| 30 | All fourteen commands are in File ▸ Export and in the command palette. They write the export beside the Org file, with the same name and the format's extension: =.html=, =.md=, =.pdf=, =.docx=, =.rtf=, =.tex=, =.odt=, =.txt= or =.ics=. The two agenda-file commands are the exceptions; see [[*iCalendar export][iCalendar export]]. =#+EXPORT_FILE_NAME:= names it instead, as in Org: relative to the Org file's folder (or absolute, or starting with =~=), with its extension replaced by the format's, so =#+EXPORT_FILE_NAME: out/report= writes =out/report.html=. A file already there is replaced. The message area shows "Exported to /name/". | 30 | All fourteen commands are in File ▸ Export and in the command palette. They write the export beside the Org file, with the same name and the format's extension: =.html=, =.md=, =.pdf=, =.docx=, =.rtf=, =.tex=, =.odt=, =.txt= or =.ics=. The two agenda-file commands are the exceptions; see [[*iCalendar export][iCalendar export]]. =#+EXPORT_FILE_NAME:= names it instead, as in Org: relative to the Org file's folder (or absolute, or starting with =~=), with its extension replaced by the format's, so =#+EXPORT_FILE_NAME: out/report= writes =out/report.html=. A file already there is replaced. The message area shows "Exported to /name/", or "Exported the subtree to /name/", "Exported the body to /name/" or "Exported the subtree's body to /name/" when the export was not the whole file as a whole document. |
| 31 | |||
| 32 | The twelve commands that export the current file export the whole file as a whole document, unless the file is set otherwise. Two commands set it, as =C-s= and =C-b= do in Org's dispatcher: | ||
| 33 | |||
| 34 | | Command | Emacs preset and Doom | Effect on the file's export commands | | ||
| 35 | |---------------------------------+-----------------------+-------------------------------------------------------------------| | ||
| 36 | | Turn Subtree Export On or Off | =C-c C-e C-s= | They export the subtree at the caret; see /Scope/ below. | | ||
| 37 | | Turn Body-Only Export On or Off | =C-c C-e C-b= | They leave out the title and the page; see /Body only/ below. | | ||
| 38 | |||
| 39 | Both are in the command palette, and the message area says what is now on. The choice is kept for the file, and it is the same one the export dialog shows as /Scope/ and /Body only/, so setting it in the dialog sets it for the commands too. With subtree export on and the caret before the first heading, a command says "Not in a subtree" and writes nothing. With body-only export on, a command for PDF, Word, RTF, plain text, ODT or iCalendar says "This format has no body-only export. Turn body-only export off for this file first." and writes nothing. The two agenda-file commands follow neither. | ||
| 31 | 40 | ||
| 32 | The [[file:../install.org][Mac App Store version]] has the thirteen commands that don't need Emacs; File ▸ Export, the export dialog and the command palette leave out Export to PDF with Emacs, and a key bound to it runs Export to PDF. When the export file, or an =#+INCLUDE:= or =#+SETUPFILE:=, is outside your folders, orgstar first asks for access to its folder; for the export file, Save Elsewhere… instead picks another place. See [[file:../install.org][Install]]. | 41 | The [[file:../install.org][Mac App Store version]] has the thirteen commands that don't need Emacs; File ▸ Export, the export dialog and the command palette leave out Export to PDF with Emacs, and a key bound to it runs Export to PDF. When the export file, or an =#+INCLUDE:= or =#+SETUPFILE:=, is outside your folders, orgstar first asks for access to its folder; for the export file, Save Elsewhere… instead picks another place. See [[file:../install.org][Install]]. |
| 33 | 42 | ||
| @@ -42,13 +51,15 @@ The [[file:../install.org][Mac App Store version]] has the thirteen commands tha | |||
| 42 | - *Margins*, *Font* and *Page numbers*, for PDF: see /PDF export/. | 51 | - *Margins*, *Font* and *Page numbers*, for PDF: see /PDF export/. |
| 43 | - *Open after export*: opens the file in its default app when the export finishes. | 52 | - *Open after export*: opens the file in its default app when the export finishes. |
| 44 | 53 | ||
| 45 | The dialog remembers the format and the *Open after export* setting. The PDF settings are =config.toml= settings, and apply to every PDF export. | 54 | The dialog keeps the format, scope, body-only and *Open after export* settings for each file, by the file's path, in orgstar's preferences; nothing is written to the Org file, and a renamed or moved file starts again. They are saved when you click Export. A file exported for the first time starts with the format and *Open after export* setting last used, the whole file, and body only off. When the kept scope is the subtree and the caret is before the first heading, the dialog exports the whole file. The destination is not kept. The PDF settings are =config.toml= settings, and apply to every PDF export. |
| 46 | 55 | ||
| 47 | ** On iOS | 56 | ** On iOS |
| 48 | 57 | ||
| 49 | The Export menu offers HTML, Markdown, PDF, Word, Rich Text (RTF), Plain Text, ODT, iCalendar, LaTeX and Plain Text (ASCII), and Copy as Rich Text. It is under More in the editor, and in the toolbar in the reader. Choosing one opens the share sheet with the exported file, named after the Org file or its =#+EXPORT_FILE_NAME:=. Send it to another app, or use Save to Files to keep it. The export is the same as on the Mac, except that LaTeX, ODT and ASCII have no author unless the file has =#+AUTHOR:=. PDF through LaTeX is not available on iOS. | 58 | The Export menu offers HTML, Markdown, PDF, Word, Rich Text (RTF), Plain Text, ODT, iCalendar, LaTeX and Plain Text (ASCII), and Copy as Rich Text. It is under More in the editor, and in the toolbar in the reader. Choosing one opens the share sheet with the exported file, named after the Org file or its =#+EXPORT_FILE_NAME:=. Send it to another app, or use Save to Files to keep it. The export is the same as on the Mac, except that LaTeX, ODT and ASCII have no author unless the file has =#+AUTHOR:=. PDF through LaTeX is not available on iOS. |
| 50 | 59 | ||
| 51 | The Export menu also has Export Agenda Files to iCalendar and Combine Agenda Files into iCalendar (see [[*iCalendar export][iCalendar export]]). Export to HTML and Open, in Commands or on =C-c C-e h o= with a hardware keyboard, shows the HTML export in Quick Look, with the file's images in the page; nothing is written beside the Org file. Copy as Rich Text is in Commands too. | 60 | Body Only in the Export menu leaves out the title and the page around the text, as in the Mac's export dialog, and is kept for each file. While it is on, PDF, Word, Rich Text (RTF), Plain Text, ODT and iCalendar say "This format has no body-only export. Turn body-only export off for this file first." Turn Body-Only Export On or Off, in Commands or on =C-c C-e C-b= with a hardware keyboard, changes the same setting. Export Subtree…, in the editor's Export menu, lists the formats for the subtree at the caret, and follows Body Only too. There is no subtree setting on iOS: the menu's formats always export the whole file. |
| 61 | |||
| 62 | The Export menu also has Export Agenda Files to iCalendar and Combine Agenda Files into iCalendar (see [[*iCalendar export][iCalendar export]]). Export to HTML and Open, in Commands or on =C-c C-e h o= with a hardware keyboard, shows the HTML export in Quick Look, with the file's images in the page; nothing is written beside the Org file; it follows Body Only. Copy as Rich Text is in Commands too. | ||
| 52 | 63 | ||
| 53 | * HTML export | 64 | * HTML export |
| 54 | 65 | ||
| @@ -466,6 +477,5 @@ The publisher part comes from the =publisher=, =journal=, =institution= or =scho | |||
| 466 | 477 | ||
| 467 | * What export does not do | 478 | * What export does not do |
| 468 | 479 | ||
| 469 | - Subtree and body-only export are in the export dialog only; the single-format commands export the whole file. There is no asynchronous export. | 480 | - There is no asynchronous export. |
| 470 | - Source blocks are not run, and noweb references are not expanded. | 481 | - Source blocks are not run, and noweb references are not expanded. |
| 471 | - Export settings in the dialog are not per file. | ||
docs/manual/guide/14-ios.org +2
| @@ -335,6 +335,8 @@ Export (in the reader's toolbar and the editor's More menu) offers HTML, Markdow | |||
| 335 | 335 | ||
| 336 | PDF export follows =pdf-margin=, =pdf-font= and =pdf-page-numbers= in =config.toml=, and Word files get heading styles and the file's images, as on the Mac. PDF through LaTeX isn't available on iOS. | 336 | PDF export follows =pdf-margin=, =pdf-font= and =pdf-page-numbers= in =config.toml=, and Word files get heading styles and the file's images, as on the Mac. PDF through LaTeX isn't available on iOS. |
| 337 | 337 | ||
| 338 | Body Only in the Export menu leaves out the title and the page around the text in HTML, Markdown, LaTeX and Plain Text (ASCII), and is kept for each file; the other formats say they have no body-only export while it is on. Export Subtree…, in the editor's Export menu, shares the subtree at the caret in any of the formats. | ||
| 339 | |||
| 338 | The Export menu also has Export Agenda Files to iCalendar, which writes an =.ics= beside each agenda file, and Combine Agenda Files into iCalendar, which shares one calendar of them all. Commands has these, Copy as Rich Text, and Export to HTML and Open, which shows the HTML export in Quick Look. | 340 | The Export menu also has Export Agenda Files to iCalendar, which writes an =.ics= beside each agenda file, and Combine Agenda Files into iCalendar, which shares one calendar of them all. Commands has these, Copy as Rich Text, and Export to HTML and Open, which shows the HTML export in Quick Look. |
| 339 | 341 | ||
| 340 | Publishing works from Commands as on the Mac, with the =[[publish]]= projects in =config.toml=. A project that publishes outside your folders asks for a folder the first time, and uses it from then on. See [[file:12-export.org][Export]]. | 342 | Publishing works from Commands as on the Mac, with the =[[publish]]= projects in =config.toml=. A project that publishes outside your folders asks for a folder the first time, and uses it from then on. See [[file:12-export.org][Export]]. |
l10n/Localizable.xcstrings +138
| @@ -4861,6 +4861,40 @@ | |||
| 4861 | } | 4861 | } |
| 4862 | } | 4862 | } |
| 4863 | }, | 4863 | }, |
| 4864 | "Body Only": { | ||
| 4865 | "localizations": { | ||
| 4866 | "de": { | ||
| 4867 | "stringUnit": { | ||
| 4868 | "state": "translated", | ||
| 4869 | "value": "Nur Inhalt" | ||
| 4870 | } | ||
| 4871 | }, | ||
| 4872 | "es": { | ||
| 4873 | "stringUnit": { | ||
| 4874 | "state": "translated", | ||
| 4875 | "value": "Solo el cuerpo" | ||
| 4876 | } | ||
| 4877 | }, | ||
| 4878 | "fr": { | ||
| 4879 | "stringUnit": { | ||
| 4880 | "state": "translated", | ||
| 4881 | "value": "Corps uniquement" | ||
| 4882 | } | ||
| 4883 | }, | ||
| 4884 | "ja": { | ||
| 4885 | "stringUnit": { | ||
| 4886 | "state": "translated", | ||
| 4887 | "value": "本文のみ" | ||
| 4888 | } | ||
| 4889 | }, | ||
| 4890 | "pt-BR": { | ||
| 4891 | "stringUnit": { | ||
| 4892 | "state": "translated", | ||
| 4893 | "value": "Só o Corpo" | ||
| 4894 | } | ||
| 4895 | } | ||
| 4896 | } | ||
| 4897 | }, | ||
| 4864 | "Body only": { | 4898 | "Body only": { |
| 4865 | "localizations": { | 4899 | "localizations": { |
| 4866 | "de": { | 4900 | "de": { |
| @@ -20864,6 +20898,40 @@ | |||
| 20864 | } | 20898 | } |
| 20865 | } | 20899 | } |
| 20866 | }, | 20900 | }, |
| 20901 | "No body-only export": { | ||
| 20902 | "localizations": { | ||
| 20903 | "de": { | ||
| 20904 | "stringUnit": { | ||
| 20905 | "state": "translated", | ||
| 20906 | "value": "Kein Export nur des Inhalts" | ||
| 20907 | } | ||
| 20908 | }, | ||
| 20909 | "es": { | ||
| 20910 | "stringUnit": { | ||
| 20911 | "state": "translated", | ||
| 20912 | "value": "Sin exportación solo del cuerpo" | ||
| 20913 | } | ||
| 20914 | }, | ||
| 20915 | "fr": { | ||
| 20916 | "stringUnit": { | ||
| 20917 | "state": "translated", | ||
| 20918 | "value": "Pas d'exportation du corps uniquement" | ||
| 20919 | } | ||
| 20920 | }, | ||
| 20921 | "ja": { | ||
| 20922 | "stringUnit": { | ||
| 20923 | "state": "translated", | ||
| 20924 | "value": "本文のみの書き出しなし" | ||
| 20925 | } | ||
| 20926 | }, | ||
| 20927 | "pt-BR": { | ||
| 20928 | "stringUnit": { | ||
| 20929 | "state": "translated", | ||
| 20930 | "value": "Sem exportação só do corpo" | ||
| 20931 | } | ||
| 20932 | } | ||
| 20933 | } | ||
| 20934 | }, | ||
| 20867 | "No buffer": { | 20935 | "No buffer": { |
| 20868 | "localizations": { | 20936 | "localizations": { |
| 20869 | "de": { | 20937 | "de": { |
| @@ -34029,6 +34097,76 @@ | |||
| 34029 | } | 34097 | } |
| 34030 | } | 34098 | } |
| 34031 | }, | 34099 | }, |
| 34100 | "Turn Body-Only Export On or Off": { | ||
| 34101 | "comment": "Command title", | ||
| 34102 | "localizations": { | ||
| 34103 | "de": { | ||
| 34104 | "stringUnit": { | ||
| 34105 | "state": "translated", | ||
| 34106 | "value": "Export nur des Inhalts ein- oder ausschalten" | ||
| 34107 | } | ||
| 34108 | }, | ||
| 34109 | "es": { | ||
| 34110 | "stringUnit": { | ||
| 34111 | "state": "translated", | ||
| 34112 | "value": "Activar o desactivar la exportación solo del cuerpo" | ||
| 34113 | } | ||
| 34114 | }, | ||
| 34115 | "fr": { | ||
| 34116 | "stringUnit": { | ||
| 34117 | "state": "translated", | ||
| 34118 | "value": "Activer ou désactiver l'exportation du corps uniquement" | ||
| 34119 | } | ||
| 34120 | }, | ||
| 34121 | "ja": { | ||
| 34122 | "stringUnit": { | ||
| 34123 | "state": "translated", | ||
| 34124 | "value": "本文のみの書き出しのオン/オフ" | ||
| 34125 | } | ||
| 34126 | }, | ||
| 34127 | "pt-BR": { | ||
| 34128 | "stringUnit": { | ||
| 34129 | "state": "translated", | ||
| 34130 | "value": "Ativar ou Desativar Exportação Só do Corpo" | ||
| 34131 | } | ||
| 34132 | } | ||
| 34133 | } | ||
| 34134 | }, | ||
| 34135 | "Turn Subtree Export On or Off": { | ||
| 34136 | "comment": "Command title", | ||
| 34137 | "localizations": { | ||
| 34138 | "de": { | ||
| 34139 | "stringUnit": { | ||
| 34140 | "state": "translated", | ||
| 34141 | "value": "Teilbaum-Export ein- oder ausschalten" | ||
| 34142 | } | ||
| 34143 | }, | ||
| 34144 | "es": { | ||
| 34145 | "stringUnit": { | ||
| 34146 | "state": "translated", | ||
| 34147 | "value": "Activar o desactivar la exportación del subárbol" | ||
| 34148 | } | ||
| 34149 | }, | ||
| 34150 | "fr": { | ||
| 34151 | "stringUnit": { | ||
| 34152 | "state": "translated", | ||
| 34153 | "value": "Activer ou désactiver l'exportation du sous-arbre" | ||
| 34154 | } | ||
| 34155 | }, | ||
| 34156 | "ja": { | ||
| 34157 | "stringUnit": { | ||
| 34158 | "state": "translated", | ||
| 34159 | "value": "サブツリー書き出しのオン/オフ" | ||
| 34160 | } | ||
| 34161 | }, | ||
| 34162 | "pt-BR": { | ||
| 34163 | "stringUnit": { | ||
| 34164 | "state": "translated", | ||
| 34165 | "value": "Ativar ou Desativar Exportação da Subárvore" | ||
| 34166 | } | ||
| 34167 | } | ||
| 34168 | } | ||
| 34169 | }, | ||
| 34032 | "Turn on Badges in orgstar's notification settings.": { | 34170 | "Turn on Badges in orgstar's notification settings.": { |
| 34033 | "localizations": { | 34171 | "localizations": { |
| 34034 | "de": { | 34172 | "de": { |