Compare commits

..

3 Commits

Author SHA1 Message Date
fish 5321277cec 添加应用图标 2026-07-12 15:55:14 +08:00
fish c0e2a0293a 同步工程配置并添加格式化脚本 2026-07-12 15:42:25 +08:00
fish cb65163e5c 添加文案格式化页面 2026-07-12 15:41:53 +08:00
8 changed files with 190 additions and 7 deletions
+6 -6
View File
@@ -264,10 +264,10 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 26.2;
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 26.2;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fishestlife.note.Note;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -281,7 +281,7 @@
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 26.2;
XROS_DEPLOYMENT_TARGET = 26.0;
};
name = Debug;
};
@@ -308,10 +308,10 @@
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 26.2;
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 26.2;
MACOSX_DEPLOYMENT_TARGET = 26.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.fishestlife.note.Note;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -325,7 +325,7 @@
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
XROS_DEPLOYMENT_TARGET = 26.2;
XROS_DEPLOYMENT_TARGET = 26.0;
};
name = Release;
};
@@ -1,6 +1,7 @@
{
"images" : [
{
"filename" : "note_app_logo_appstore.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
@@ -12,6 +13,7 @@
"value" : "dark"
}
],
"filename" : "note_app_logo_appstore 1.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
@@ -23,6 +25,7 @@
"value" : "tinted"
}
],
"filename" : "note_app_logo_appstore 2.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+134
View File
@@ -0,0 +1,134 @@
//
// FormatterView.swift
// Note
//
// Created by fish on 2026/7/12.
//
import SwiftUI
struct FormatterView: View {
@State private var inputText: String = ""
@State private var outputText: String = ""
@State private var showCopied: Bool = false
var body: some View {
NavigationStack {
VStack(spacing: 16) {
TextEditor(text: $inputText)
.frame(minHeight: 120)
.padding(8)
.background(Color(.systemGray6))
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color(.systemGray4), lineWidth: 1)
)
Button(action: formatText) {
Label("格式化", systemImage: "wand.and.stars")
.font(.headline)
.frame(maxWidth: .infinity)
.padding()
.background(Color.accentColor)
.foregroundStyle(.white)
.cornerRadius(10)
}
if !outputText.isEmpty {
VStack(alignment: .leading, spacing: 8) {
HStack {
Text("格式化结果")
.font(.subheadline)
.foregroundStyle(.secondary)
Spacer()
Button(action: copyOutput) {
Image(systemName: "doc.on.doc")
}
}
TextEditor(text: .constant(outputText))
.frame(minHeight: 120)
.padding(8)
.background(Color(.systemGray6))
.cornerRadius(8)
.overlay(
RoundedRectangle(cornerRadius: 8)
.stroke(Color(.systemGray4), lineWidth: 1)
)
}
}
Spacer()
}
.padding()
.navigationTitle("文案格式化")
.overlay {
if showCopied {
VStack {
Spacer()
Text("已复制")
.font(.subheadline)
.padding(.horizontal, 16)
.padding(.vertical, 8)
.background(Color.black.opacity(0.75))
.foregroundStyle(.white)
.cornerRadius(20)
.padding(.bottom, 32)
}
.transition(.opacity)
}
}
}
}
private func formatText() {
var content = inputText
// #
content = content.replacingOccurrences(of: "# ", with: "")
content = content.replacingOccurrences(of: "#", with: "")
// ;
content = content.replacingOccurrences(of: ";", with: "")
//
content = content.replacingOccurrences(of: "", with: "")
// .
content = content.replacingOccurrences(of: ".", with: "")
// (
content = content.replacingOccurrences(of: "", with: "(")
// )
content = content.replacingOccurrences(of: "", with: ")")
// ?
content = content.replacingOccurrences(of: "?", with: "")
// ,
content = content.replacingOccurrences(of: ",", with: "")
// :
content = content.replacingOccurrences(of: ":", with: "")
//
content = content.replacingOccurrences(of: "日星期", with: "日 星期")
// #
content = "# " + content
//
content = content.replacingOccurrences(of: "一、生活方面", with: "## 一、生活方面")
content = content.replacingOccurrences(of: "二、交易方面", with: "## 二、交易方面")
content = content.replacingOccurrences(of: "三、工作方面", with: "## 三、工作方面")
outputText = content
}
private func copyOutput() {
UIPasteboard.general.string = outputText
withAnimation {
showCopied = true
}
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
withAnimation {
showCopied = false
}
}
}
}
#Preview {
FormatterView()
}
+1 -1
View File
@@ -11,7 +11,7 @@ import SwiftUI
struct NoteApp: App {
var body: some Scene {
WindowGroup {
ContentView()
FormatterView()
}
}
}
+46
View File
@@ -0,0 +1,46 @@
import os
def format_md_file(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# 去#
content = content.replace('# ', '')
content = content.replace('#', '')
# 将;转为句号
content = content.replace(';', '')
# 将;转为句号
content = content.replace('', '')
# 将.转为句号
content = content.replace('.', '')
# 将(转为(
content = content.replace('', '(')
# 将)转为)
content = content.replace('', ')')
# 将?转为?
content = content.replace('?', '')
# 将,转为,
content = content.replace(',', '')
# 将:转为:
content = content.replace(':', '')
# 将 日星期 转为:日 星期
content = content.replace('日星期', '日 星期')
# 在第一行插入 #
content = '# ' + content
# 标题设置
content = content.replace('一、生活方面', '## 一、生活方面')
content = content.replace('二、交易方面', '## 二、交易方面')
content = content.replace('三、工作方面', '## 三、工作方面')
with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)
if __name__ == "__main__":
current_dir = os.path.dirname(os.path.abspath(__file__))
print(current_dir)
for root, dirs, files in os.walk(current_dir):
for file in files:
if file.endswith('.md'):
file_path = os.path.join(root, file)
format_md_file(file_path)