Commit 0aba84182e
Verified · cmc
Layout: unified · split
Package.swift +7 −5
| @@ -16,6 +16,7 @@ let package = Package( | ||
| 16 | 16 | .library(name: "OrgEditorAppKit", targets: ["OrgEditorAppKit"]), |
| 17 | 17 | .executable(name: "OrgstarSpike", targets: ["OrgstarSpike"]), |
| 18 | 18 | .library(name: "OrgApp", targets: ["OrgApp"]), |
| 19 | .library(name: "OrgMathJax", targets: ["OrgMathJax"]), | |
| 19 | 20 | .library(name: "OrgWatchData", targets: ["OrgWatchData"]), |
| 20 | 21 | .library(name: "OrgHighlight", targets: ["OrgHighlight"]), |
| 21 | 22 | .executable(name: "Orgstar", targets: ["Orgstar"]), |
| @@ -87,8 +88,9 @@ let package = Package( | ||
| 87 | 88 | ] |
| 88 | 89 | ), |
| 89 | 90 | .executableTarget(name: "OrgstarSpike", dependencies: ["OrgEditorAppKit"]), |
| 90 | // MathJax for PDF export, which typesets math without the network. | |
| 91 | .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation", "OrgWatchData"], resources: [.copy("Resources/MathJax")]), | |
| 91 | .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation", "OrgWatchData"]), | |
| 92 | // MathJax for PDF export, which typesets math without the network; the apps link it, extensions don't. | |
| 93 | .target(name: "OrgMathJax", resources: [.copy("MathJax")]), | |
| 92 | 94 | // What the phone and the watch send each other; Foundation only, so the watch builds it. |
| 93 | 95 | .target(name: "OrgWatchData"), |
| 94 | 96 | // The watch app and its complications, bundled by scripts/build-watch-app.sh. |
| @@ -96,9 +98,9 @@ let package = Package( | ||
| 96 | 98 | .executableTarget(name: "OrgstarWatchWidgets", dependencies: ["OrgWatchData"]), |
| 97 | 99 | // Babel, Emacs and gnuplot as processes; the Developer ID app alone links it. |
| 98 | 100 | .target(name: "OrgPrograms", dependencies: ["OrgApp"]), |
| 99 | .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgPrograms", "OrgEditorAppKit", "OrgHighlight", .product(name: "Sparkle", package: "Sparkle")]), | |
| 101 | .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgMathJax", "OrgPrograms", "OrgEditorAppKit", "OrgHighlight", .product(name: "Sparkle", package: "Sparkle")]), | |
| 100 | 102 | // The iOS app, bundled by scripts/build-ios-app.sh. |
| 101 | .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp", "OrgHighlight"]), | |
| 103 | .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp", "OrgMathJax", "OrgHighlight"]), | |
| 102 | 104 | // App extensions, bundled into orgstar.app by scripts/build-app.sh. |
| 103 | 105 | .executableTarget(name: "OrgstarQuickLook", dependencies: ["OrgCore"], linkerSettings: extensionEntry), |
| 104 | 106 | .executableTarget(name: "OrgstarSpotlight", dependencies: ["OrgCore"], linkerSettings: extensionEntry), |
| @@ -114,7 +116,7 @@ let package = Package( | ||
| 114 | 116 | .testTarget(name: "OrgWorkspaceTests", dependencies: ["OrgWorkspace"]), |
| 115 | 117 | .testTarget(name: "OrgPresentationTests", dependencies: ["OrgPresentation"]), |
| 116 | 118 | .testTarget(name: "OrgEditorAppKitTests", dependencies: ["OrgEditorAppKit", "OrgApp"]), |
| 117 | .testTarget(name: "OrgAppTests", dependencies: ["OrgApp", "OrgDocument"]), | |
| 119 | .testTarget(name: "OrgAppTests", dependencies: ["OrgApp", "OrgDocument", "OrgMathJax"]), | |
| 118 | 120 | .testTarget(name: "OrgProgramsTests", dependencies: ["OrgPrograms", "OrgApp", "OrgDocument"]), |
| 119 | 121 | .testTarget(name: "OrgHighlightTests", dependencies: ["OrgHighlight", "OrgCore", "OrgPresentation"]) |
| 120 | 122 | ] |
Sources/OrgApp/PDFExport.swift +5 −5
| @@ -125,12 +125,12 @@ public enum PDFExport { | ||
| 125 | 125 | </style> |
| 126 | 126 | """ |
| 127 | 127 | |
| 128 | /// MathJax 3.2.2's `tex-svg-full.js`: every TeX extension in one file, with SVG output that | |
| 129 | /// needs no font files, so nothing is fetched. | |
| 128 | /// MathJax's `tex-svg-full.js`, which the app sets from `OrgMathJax.script`: every TeX | |
| 129 | /// extension in one file, with SVG output that needs no font files, so nothing is fetched. | |
| 130 | nonisolated(unsafe) public static var mathJaxURL: URL? | |
| 131 | ||
| 130 | 132 | nonisolated static func bundledMathJax() throws -> String { |
| 131 | guard let url = Bundle.module.url(forResource: "tex-svg-full", withExtension: "js", subdirectory: "MathJax") else { | |
| 132 | throw Failure(description: "MathJax is missing from the app.") | |
| 133 | } | |
| 133 | guard let url = mathJaxURL else { throw Failure(description: "MathJax is missing from the app.") } | |
| 134 | 134 | return try String(contentsOf: url, encoding: .utf8) |
| 135 | 135 | } |
| 136 | 136 | |
Sources/OrgApp/Resources/MathJax/LICENSE → Sources/OrgMathJax/MathJax/LICENSE renamed
Sources/OrgApp/Resources/MathJax/tex-svg-full.js → Sources/OrgMathJax/MathJax/tex-svg-full.js renamed
Sources/OrgMathJax/OrgMathJax.swift added +7
| @@ -0,0 +1,7 @@ | ||
| 1 | import Foundation | |
| 2 | ||
| 3 | /// MathJax 3.2.2's `tex-svg-full.js`, for PDF export. Only the apps link it, so extensions don't | |
| 4 | /// carry the file. | |
| 5 | public enum OrgMathJax { | |
| 6 | public static var script: URL? { Bundle.module.url(forResource: "tex-svg-full", withExtension: "js", subdirectory: "MathJax") } | |
| 7 | } | |
Sources/Orgstar/OrgstarApp.swift +2
| @@ -2,6 +2,7 @@ import AppKit | ||
| 2 | 2 | import OrgApp |
| 3 | 3 | import OrgCore |
| 4 | 4 | import OrgEditorAppKit |
| 5 | import OrgMathJax | |
| 5 | 6 | import OrgPresentation |
| 6 | 7 | #if !APPSTORE |
| 7 | 8 | import OrgPrograms |
| @@ -374,6 +375,7 @@ struct OrgstarApp: App { | ||
| 374 | 375 | }() |
| 375 | 376 | |
| 376 | 377 | init() { |
| 378 | PDFExport.mathJaxURL = OrgMathJax.script | |
| 377 | 379 | #if APPSTORE |
| 378 | 380 | AgendaSnapshot.useGroupContainer = true |
| 379 | 381 | EmacsFallback.offered = false |
Sources/OrgstarMobile/OrgstarMobileApp.swift +2
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | import CoreSpotlight |
| 3 | 3 | import OrgApp |
| 4 | 4 | import OrgCore |
| 5 | import OrgMathJax | |
| 5 | 6 | import SwiftUI |
| 6 | 7 | import UserNotifications |
| 7 | 8 | |
| @@ -14,6 +15,7 @@ struct OrgstarMobileApp: App { | ||
| 14 | 15 | @Environment(\.scenePhase) private var scenePhase |
| 15 | 16 | |
| 16 | 17 | init() { |
| 18 | PDFExport.mathJaxURL = OrgMathJax.script | |
| 17 | 19 | // Debug builds, and runs from Xcode, whose scheme sets ORGSTAR_PERF. |
| 18 | 20 | #if DEBUG |
| 19 | 21 | Perf.watchMainThread() |
THIRD_PARTY.org +1 −1
| @@ -10,7 +10,7 @@ orgstar is proprietary (see [[file:LICENSE]]). It builds on these projects, unde | ||
| 10 | 10 | | [[https://github.com/r-lib/tree-sitter-r][tree-sitter-r]] | Highlighting | MIT | |
| 11 | 11 | | [[https://github.com/6cdh/tree-sitter-scheme][tree-sitter-scheme]] | Highlighting | MIT | |
| 12 | 12 | | [[https://github.com/nodejs/node][Node.js]] | =util.inspect= and =util.format=, ported to run in JavaScriptCore (in =Sources/OrgApp/JavaScriptBlocks.swift=) | MIT | |
| 13 | | [[https://github.com/mathjax/MathJax][MathJax]] 3.2.2 | Math in PDF export (=es5/tex-svg-full.js= from the npm package, in =Sources/OrgApp/Resources/MathJax= with its license) | Apache-2.0 | | |
| 13 | | [[https://github.com/mathjax/MathJax][MathJax]] 3.2.2 | Math in PDF export (=es5/tex-svg-full.js= from the npm package, in =Sources/OrgMathJax/MathJax= with its license) | Apache-2.0 | | |
| 14 | 14 | | [[https://github.com/Wilfred/tree-sitter-elisp][tree-sitter-elisp]] | Highlighting (vendored in =Sources/TreeSitterElisp=) | MIT | |
| 15 | 15 | | [[https://github.com/sogaiu/tree-sitter-clojure][tree-sitter-clojure]] | Highlighting (vendored in =Sources/TreeSitterClojure=) | CC0-1.0 | |
| 16 | 16 | | [[https://ethanschoonover.com/solarized/][Solarized]] | Colors of the Solarized themes | MIT | |
Tests/OrgAppTests/PDFExportTests.swift +3
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import Foundation |
| 2 | 2 | import OrgCore |
| 3 | import OrgMathJax | |
| 3 | 4 | import PDFKit |
| 4 | 5 | import Testing |
| 5 | 6 | import WebKit |
| @@ -7,6 +8,8 @@ import WebKit | ||
| 7 | 8 | |
| 8 | 9 | @MainActor |
| 9 | 10 | struct PDFExportTests { |
| 11 | init() { PDFExport.mathJaxURL = OrgMathJax.script } | |
| 12 | ||
| 10 | 13 | /// A long document comes out as several pages with its text, without Emacs. |
| 11 | 14 | @Test func paginatesTheHTMLExport() async throws { |
| 12 | 15 | let sections = (1...40).map { "* Section \($0)\n" + String(repeating: "Some words in a paragraph. ", count: 30) + "\n" }.joined() |
ios/Orgstar.xcodeproj/project.pbxproj +16
| @@ -7,6 +7,8 @@ | ||
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | EC91295D4306AF0CE88F1D07 /* OrgMathJax in Frameworks */ = {isa = PBXBuildFile; productRef = 70EC41AF804F61B000FC5A1E /* OrgMathJax */; }; | |
| 11 | 7080D3827813E58F1F3C6ABC /* OrgMathJax in Frameworks */ = {isa = PBXBuildFile; productRef = FE5434EBA139A800E8727F4B /* OrgMathJax */; }; | |
| 10 | 12 | 1B78003BBCE8A4B809333342 /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = A2BE626BBE45EA52880B6169 /* OrgApp */; }; |
| 11 | 13 | 1E5861C0EFE1D96CDC21A22F /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = BA239181876756F7732397EB /* OrgApp */; }; |
| 12 | 14 | 2BE799BF03ED43EAA6849F53 /* OrgApp in Frameworks */ = {isa = PBXBuildFile; productRef = EDEF22C5B4F393296F1D17BB /* OrgApp */; }; |
| @@ -281,6 +283,7 @@ | ||
| 281 | 283 | buildActionMask = 2147483647; |
| 282 | 284 | files = ( |
| 283 | 285 | 1B78003BBCE8A4B809333342 /* OrgApp in Frameworks */, |
| 286 | 7080D3827813E58F1F3C6ABC /* OrgMathJax in Frameworks */, | |
| 284 | 287 | 9BE045FD696469CA8D19F22C /* OrgHighlight in Frameworks */, |
| 285 | 288 | ); |
| 286 | 289 | runOnlyForDeploymentPostprocessing = 0; |
| @@ -314,6 +317,7 @@ | ||
| 314 | 317 | buildActionMask = 2147483647; |
| 315 | 318 | files = ( |
| 316 | 319 | 34F40D483630871B50619E6F /* OrgApp in Frameworks */, |
| 320 | EC91295D4306AF0CE88F1D07 /* OrgMathJax in Frameworks */, | |
| 317 | 321 | 4392873ADA2B1FC8930BE6C9 /* OrgEditorAppKit in Frameworks */, |
| 318 | 322 | CA594F2E6DAFED2D16900872 /* OrgHighlight in Frameworks */, |
| 319 | 323 | ); |
| @@ -422,6 +426,7 @@ | ||
| 422 | 426 | name = "Orgstar iOS"; |
| 423 | 427 | packageProductDependencies = ( |
| 424 | 428 | A2BE626BBE45EA52880B6169 /* OrgApp */, |
| 429 | FE5434EBA139A800E8727F4B /* OrgMathJax */, | |
| 425 | 430 | 47D54A361A74FE9E2B0722BB /* OrgHighlight */, |
| 426 | 431 | ); |
| 427 | 432 | productName = Orgstar; |
| @@ -572,6 +577,7 @@ | ||
| 572 | 577 | name = "Orgstar macOS"; |
| 573 | 578 | packageProductDependencies = ( |
| 574 | 579 | B1EC171400CB989363332D07 /* OrgApp */, |
| 580 | 70EC41AF804F61B000FC5A1E /* OrgMathJax */, | |
| 575 | 581 | 0E5F6DB1CD783274FB49FD5E /* OrgEditorAppKit */, |
| 576 | 582 | 88F9A423F8C1EBE523B6438B /* OrgHighlight */, |
| 577 | 583 | ); |
| @@ -1619,6 +1625,16 @@ | ||
| 1619 | 1625 | package = A46A1BCE0B67C45BEC8F435B /* XCLocalSwiftPackageReference ".." */; |
| 1620 | 1626 | productName = OrgCore; |
| 1621 | 1627 | }; |
| 1628 | FE5434EBA139A800E8727F4B /* OrgMathJax */ = { | |
| 1629 | isa = XCSwiftPackageProductDependency; | |
| 1630 | package = A46A1BCE0B67C45BEC8F435B /* XCLocalSwiftPackageReference ".." */; | |
| 1631 | productName = OrgMathJax; | |
| 1632 | }; | |
| 1633 | 70EC41AF804F61B000FC5A1E /* OrgMathJax */ = { | |
| 1634 | isa = XCSwiftPackageProductDependency; | |
| 1635 | package = A46A1BCE0B67C45BEC8F435B /* XCLocalSwiftPackageReference ".." */; | |
| 1636 | productName = OrgMathJax; | |
| 1637 | }; | |
| 1622 | 1638 | /* End XCSwiftPackageProductDependency section */ |
| 1623 | 1639 | }; |
| 1624 | 1640 | rootObject = 46F86FAA6BBF9AC94A7E4595 /* Project object */; |
scripts/build-app.sh +1 −1
| @@ -45,7 +45,7 @@ otool -l "$app/Contents/MacOS/Orgstar" | grep -q '@executable_path/../Frameworks | ||
| 45 | 45 | # SwiftMath's math fonts, which it finds in the app's resources. |
| 46 | 46 | cp -R "$(dirname "$binary")/SwiftMath_SwiftMath.bundle" "$app/Contents/Resources/" |
| 47 | 47 | # MathJax, for PDF export. |
| 48 | cp -R "$(dirname "$binary")/Orgstar_OrgApp.bundle" "$app/Contents/Resources/" | |
| 48 | cp -R "$(dirname "$binary")/Orgstar_OrgMathJax.bundle" "$app/Contents/Resources/" | |
| 49 | 49 | |
| 50 | 50 | # Updates: the appcast and its signing key, for signed builds only; a dev build never checks. |
| 51 | 51 | if [ "$sign" != "-" ]; then |