Compare commits

...

12 Commits

5 changed files with 151 additions and 4 deletions

View File

@@ -91,3 +91,12 @@ Before committing:
- [ ] `docs/` index and detail pages are updated?
- [ ] Root `README.md` is updated?
- [ ] All version numbers match exactly?
## 5. Git Operations (Agent Rules)
**CRITICAL RULE FOR AGENTS**:
- **No Auto-Push**: Agents **MUST NOT** automatically push changes to the remote `main` branch.
- **Local Commit Only**: All changes must be committed locally.
- **User Approval**: Pushing to remote requires explicit user action or approval.

View File

@@ -54,6 +54,9 @@ permissions:
jobs:
check-changes:
runs-on: ubuntu-latest
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
outputs:
has_changes: ${{ steps.detect.outputs.has_changes }}
changed_plugins: ${{ steps.detect.outputs.changed_plugins }}
@@ -65,6 +68,12 @@ jobs:
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global core.quotepath false
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
- name: Set up Python
uses: actions/setup-python@v5
with:
@@ -131,6 +140,7 @@ jobs:
echo "changed_plugins<<EOF" >> $GITHUB_OUTPUT
cat changed_files.txt >> $GITHUB_OUTPUT
echo "" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
fi
@@ -138,6 +148,7 @@ jobs:
{
echo 'release_notes<<EOF'
cat changes.md
echo ""
echo 'EOF'
} >> $GITHUB_OUTPUT
@@ -156,6 +167,12 @@ jobs:
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global core.quotepath false
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
- name: Set up Python
uses: actions/setup-python@v5
with:
@@ -209,6 +226,17 @@ jobs:
echo "=== Collected Files ==="
find release_plugins -name "*.py" -type f | head -20
- name: Debug Filenames
run: |
python3 -c "import sys; print(f'Filesystem encoding: {sys.getfilesystemencoding()}')"
ls -R release_plugins
- name: Upload Debug Artifacts
uses: actions/upload-artifact@v4
with:
name: debug-plugins
path: release_plugins/
- name: Get commit messages
id: commits
if: github.event_name == 'push'
@@ -224,8 +252,9 @@ jobs:
{
echo 'commits<<EOF'
echo "$COMMITS"
echo ""
echo 'EOF'
} >> $GITHUB_OUTPUT
} >> "$GITHUB_OUTPUT"
- name: Generate release notes
id: notes
@@ -305,10 +334,15 @@ jobs:
prerelease: ${{ github.event.inputs.prerelease || false }}
files: |
plugin_versions.json
release_plugins/**/*.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
find release_plugins -type f -name "*.py" -print0 | xargs -0 gh release upload ${{ steps.version.outputs.version }} --clobber
- name: Summary
run: |
echo "## 🚀 Release Created Successfully!" >> $GITHUB_STEP_SUMMARY

View File

@@ -749,6 +749,28 @@ class Action:
}
)
# Bold cell style (for full cell bolding)
text_bold_format = workbook.add_format(
{
"border": 1,
"align": "left",
"valign": "vcenter",
"text_wrap": True,
"bold": True,
}
)
# Italic cell style (for full cell italics)
text_italic_format = workbook.add_format(
{
"border": 1,
"align": "left",
"valign": "vcenter",
"text_wrap": True,
"italic": True,
}
)
for i, table in enumerate(tables):
try:
table_data = table["data"]
@@ -820,6 +842,8 @@ class Action:
decimal_format,
date_format,
sequence_format,
text_bold_format,
text_italic_format,
)
except Exception as e:
@@ -843,6 +867,8 @@ class Action:
decimal_format,
date_format,
sequence_format,
text_bold_format=None,
text_italic_format=None,
):
"""
Apply enhanced formatting
@@ -851,6 +877,7 @@ class Action:
- Text: Left aligned
- Date: Center aligned
- Sequence: Center aligned
- Supports full cell Markdown bold (**text**) and italic (*text*)
"""
try:
# 1. Write headers (Center aligned)
@@ -912,6 +939,27 @@ class Action:
# Text - Left aligned
current_format = text_format
if content_type == "text" and isinstance(value, str):
# Check for full cell bold (**text**)
match_bold = re.fullmatch(r"\*\*(.+)\*\*", value.strip())
# Check for full cell italic (*text*)
match_italic = re.fullmatch(r"\*(.+)\*", value.strip())
if match_bold:
# Extract content and apply bold format
clean_value = match_bold.group(1)
worksheet.write(
row_idx + 1, col_idx, clean_value, text_bold_format
)
elif match_italic:
# Extract content and apply italic format
clean_value = match_italic.group(1)
worksheet.write(
row_idx + 1, col_idx, clean_value, text_italic_format
)
else:
worksheet.write(row_idx + 1, col_idx, value, current_format)
else:
worksheet.write(row_idx + 1, col_idx, value, current_format)
# 4. Auto-adjust column width
@@ -1002,3 +1050,6 @@ class Action:
except Exception as e:
print(f"Error in basic formatting: {str(e)}")
except Exception as e:
print(f"Error in basic formatting: {str(e)}")

View File

@@ -754,6 +754,28 @@ class Action:
}
)
# 粗体单元格样式 (用于全单元格加粗)
text_bold_format = workbook.add_format(
{
"border": 1,
"align": "left",
"valign": "vcenter",
"text_wrap": True,
"bold": True,
}
)
# 斜体单元格样式 (用于全单元格斜体)
text_italic_format = workbook.add_format(
{
"border": 1,
"align": "left",
"valign": "vcenter",
"text_wrap": True,
"italic": True,
}
)
for i, table in enumerate(tables):
try:
table_data = table["data"]
@@ -825,6 +847,8 @@ class Action:
decimal_format,
date_format,
sequence_format,
text_bold_format,
text_italic_format,
)
except Exception as e:
@@ -848,6 +872,8 @@ class Action:
decimal_format,
date_format,
sequence_format,
text_bold_format=None,
text_italic_format=None,
):
"""
应用符合中国官方表格规范的格式化
@@ -856,6 +882,7 @@ class Action:
- 文本: 左对齐
- 日期: 居中对齐
- 序号: 居中对齐
- 支持全单元格 Markdown 粗体 (**text**) 和斜体 (*text*)
"""
try:
# 1. 写入表头(居中对齐)
@@ -917,6 +944,27 @@ class Action:
# 文本类型 - 左对齐
current_format = text_format
if content_type == "text" and isinstance(value, str):
# 检查是否全单元格加粗 (**text**)
match_bold = re.fullmatch(r"\*\*(.+)\*\*", value.strip())
# 检查是否全单元格斜体 (*text*)
match_italic = re.fullmatch(r"\*(.+)\*", value.strip())
if match_bold:
# 提取内容并应用粗体格式
clean_value = match_bold.group(1)
worksheet.write(
row_idx + 1, col_idx, clean_value, text_bold_format
)
elif match_italic:
# 提取内容并应用斜体格式
clean_value = match_italic.group(1)
worksheet.write(
row_idx + 1, col_idx, clean_value, text_italic_format
)
else:
worksheet.write(row_idx + 1, col_idx, value, current_format)
else:
worksheet.write(row_idx + 1, col_idx, value, current_format)
# 4. 自动调整列宽
@@ -1017,3 +1065,6 @@ class Action:
except Exception as e:
print(f"Warning: Even basic formatting failed: {str(e)}")
except Exception as e:
print(f"Warning: Even basic formatting failed: {str(e)}")

View File

@@ -295,6 +295,8 @@ def main():
if args.output:
with open(args.output, "w", encoding="utf-8") as f:
f.write(output)
if not output.endswith("\n"):
f.write("\n")
print(f"Output written to {args.output}")
else:
print(output)