@panda-agent/panda-cli 0.1.29 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pandacli.mjs +6 -1
- package/bundled-preset-skills/.gitkeep +0 -0
- package/bundled-preset-skills/README.md +17 -0
- package/bundled-preset-skills/docx/.skill-metadata.yaml +173 -0
- package/bundled-preset-skills/docx/LICENSE.txt +30 -0
- package/bundled-preset-skills/docx/SKILL.md +589 -0
- package/bundled-preset-skills/docx/scripts/__init__.py +1 -0
- package/bundled-preset-skills/docx/scripts/accept_changes.py +206 -0
- package/bundled-preset-skills/docx/scripts/comment.py +442 -0
- package/bundled-preset-skills/docx/scripts/office/helpers/__init__.py +1 -0
- package/bundled-preset-skills/docx/scripts/office/helpers/merge_runs.py +190 -0
- package/bundled-preset-skills/docx/scripts/office/helpers/simplify_redlines.py +185 -0
- package/bundled-preset-skills/docx/scripts/office/pack.py +167 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/bundled-preset-skills/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/bundled-preset-skills/docx/scripts/office/soffice.py +194 -0
- package/bundled-preset-skills/docx/scripts/office/unpack.py +145 -0
- package/bundled-preset-skills/docx/scripts/office/validate.py +114 -0
- package/bundled-preset-skills/docx/scripts/office/validators/__init__.py +16 -0
- package/bundled-preset-skills/docx/scripts/office/validators/base.py +733 -0
- package/bundled-preset-skills/docx/scripts/office/validators/docx.py +354 -0
- package/bundled-preset-skills/docx/scripts/office/validators/pptx.py +230 -0
- package/bundled-preset-skills/docx/scripts/office/validators/redlining.py +212 -0
- package/bundled-preset-skills/docx/scripts/templates/comments.xml +3 -0
- package/bundled-preset-skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/bundled-preset-skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/bundled-preset-skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/bundled-preset-skills/docx/scripts/templates/people.xml +3 -0
- package/bundled-preset-skills/frontend-design/LICENSE.txt +177 -0
- package/bundled-preset-skills/frontend-design/SKILL.md +42 -0
- package/bundled-preset-skills/pdf/.skill-metadata.yaml +273 -0
- package/bundled-preset-skills/pdf/LICENSE.txt +30 -0
- package/bundled-preset-skills/pdf/SKILL.md +324 -0
- package/bundled-preset-skills/pdf/advanced-reference.md +609 -0
- package/bundled-preset-skills/pdf/form-filling-guide.md +318 -0
- package/bundled-preset-skills/pdf/forms.md +294 -0
- package/bundled-preset-skills/pdf/reference.md +612 -0
- package/bundled-preset-skills/pdf/scripts/check_bounding_boxes.py +198 -0
- package/bundled-preset-skills/pdf/scripts/check_fillable_fields.py +64 -0
- package/bundled-preset-skills/pdf/scripts/convert_pdf_to_images.py +102 -0
- package/bundled-preset-skills/pdf/scripts/create_validation_image.py +125 -0
- package/bundled-preset-skills/pdf/scripts/extract_form_field_info.py +220 -0
- package/bundled-preset-skills/pdf/scripts/extract_form_structure.py +202 -0
- package/bundled-preset-skills/pdf/scripts/fill_fillable_fields.py +205 -0
- package/bundled-preset-skills/pdf/scripts/fill_pdf_form_with_annotations.py +193 -0
- package/bundled-preset-skills/pptx-generator/SKILL.md +204 -0
- package/bundled-preset-skills/pptx-generator/assets/styles/business.json +8 -0
- package/bundled-preset-skills/pptx-generator/assets/styles/minimal.json +8 -0
- package/bundled-preset-skills/pptx-generator/assets/styles/modern.json +8 -0
- package/bundled-preset-skills/pptx-generator/assets/templates/ppt_data_template.json +40 -0
- package/bundled-preset-skills/pptx-generator/references/collaboration_guide.md +381 -0
- package/bundled-preset-skills/pptx-generator/references/json_format_spec.md +215 -0
- package/bundled-preset-skills/pptx-generator/references/layout_guide.md +290 -0
- package/bundled-preset-skills/pptx-generator/scripts/json_validator.py +194 -0
- package/bundled-preset-skills/pptx-generator/scripts/pptx_builder.py +340 -0
- package/bundled-preset-skills/pptx-generator/scripts/pptx_validator.py +162 -0
- package/bundled-preset-skills/skill-creator/LICENSE.txt +202 -0
- package/bundled-preset-skills/skill-creator/SKILL.md +479 -0
- package/bundled-preset-skills/skill-creator/agents/analyzer.md +274 -0
- package/bundled-preset-skills/skill-creator/agents/comparator.md +202 -0
- package/bundled-preset-skills/skill-creator/agents/grader.md +223 -0
- package/bundled-preset-skills/skill-creator/assets/eval_review.html +146 -0
- package/bundled-preset-skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/bundled-preset-skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/bundled-preset-skills/skill-creator/references/schemas.md +430 -0
- package/bundled-preset-skills/skill-creator/scripts/__init__.py +0 -0
- package/bundled-preset-skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/bundled-preset-skills/skill-creator/scripts/generate_report.py +326 -0
- package/bundled-preset-skills/skill-creator/scripts/improve_description.py +248 -0
- package/bundled-preset-skills/skill-creator/scripts/package_skill.py +136 -0
- package/bundled-preset-skills/skill-creator/scripts/quick_validate.py +103 -0
- package/bundled-preset-skills/skill-creator/scripts/run_eval.py +310 -0
- package/bundled-preset-skills/skill-creator/scripts/run_loop.py +332 -0
- package/bundled-preset-skills/skill-creator/scripts/utils.py +47 -0
- package/bundled-preset-skills/xlsx/.skill-metadata.yaml +185 -0
- package/bundled-preset-skills/xlsx/LICENSE.txt +30 -0
- package/bundled-preset-skills/xlsx/SKILL.md +233 -0
- package/bundled-preset-skills/xlsx/scripts/office/helpers/__init__.py +1 -0
- package/bundled-preset-skills/xlsx/scripts/office/helpers/merge_runs.py +226 -0
- package/bundled-preset-skills/xlsx/scripts/office/helpers/simplify_redlines.py +198 -0
- package/bundled-preset-skills/xlsx/scripts/office/pack.py +162 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/bundled-preset-skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/bundled-preset-skills/xlsx/scripts/office/soffice.py +185 -0
- package/bundled-preset-skills/xlsx/scripts/office/unpack.py +146 -0
- package/bundled-preset-skills/xlsx/scripts/office/validate.py +108 -0
- package/bundled-preset-skills/xlsx/scripts/office/validators/__init__.py +13 -0
- package/bundled-preset-skills/xlsx/scripts/office/validators/base.py +800 -0
- package/bundled-preset-skills/xlsx/scripts/office/validators/docx.py +383 -0
- package/bundled-preset-skills/xlsx/scripts/office/validators/pptx.py +250 -0
- package/bundled-preset-skills/xlsx/scripts/office/validators/redlining.py +229 -0
- package/bundled-preset-skills/xlsx/scripts/recalc.py +296 -0
- package/dist/panda-cli-ink.bundle.mjs +276 -342
- package/package.json +6 -4
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
PPTX Builder - Generate .pptx files from JSON data.
|
|
4
|
+
|
|
5
|
+
This module creates standard PowerPoint (.pptx) files from JSON data,
|
|
6
|
+
supporting multiple layouts, styles, charts, and tables.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any, Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
from pptx import Presentation
|
|
17
|
+
from pptx.util import Inches, Pt
|
|
18
|
+
from pptx.enum.text import PP_ALIGN
|
|
19
|
+
from pptx.dml.color import RgbColor
|
|
20
|
+
except ImportError:
|
|
21
|
+
print("错误: 未安装 python-pptx")
|
|
22
|
+
print("请运行: pip install python-pptx")
|
|
23
|
+
exit(1)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# =============================================================================
|
|
27
|
+
# Constants
|
|
28
|
+
# =============================================================================
|
|
29
|
+
|
|
30
|
+
DEFAULT_OUTPUT_PATH = "presentation.pptx"
|
|
31
|
+
DEFAULT_SLIDE_WIDTH = Inches(10)
|
|
32
|
+
DEFAULT_SLIDE_HEIGHT = Inches(7.5)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# =============================================================================
|
|
36
|
+
# PPTX Builder
|
|
37
|
+
# =============================================================================
|
|
38
|
+
|
|
39
|
+
class PPTXBuilder:
|
|
40
|
+
"""Builder for creating .pptx files from JSON data."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, style_config: Optional[Dict[str, Any]] = None):
|
|
43
|
+
"""
|
|
44
|
+
Initialize PPTX builder.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
style_config: Style configuration dictionary.
|
|
48
|
+
"""
|
|
49
|
+
self.style_config = style_config or {}
|
|
50
|
+
self.presentation = None
|
|
51
|
+
|
|
52
|
+
print(f"PPTX 构建器已初始化")
|
|
53
|
+
if style_config:
|
|
54
|
+
print(f" 风格配置已加载")
|
|
55
|
+
|
|
56
|
+
def load_json(self, json_path: str) -> Dict[str, Any]:
|
|
57
|
+
"""
|
|
58
|
+
Load PPT data from JSON file.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
json_path: Path to JSON file.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Parsed JSON data.
|
|
65
|
+
"""
|
|
66
|
+
with open(json_path, 'r', encoding='utf-8') as f:
|
|
67
|
+
data = json.load(f)
|
|
68
|
+
|
|
69
|
+
print(f"✓ JSON 数据已加载: {json_path}")
|
|
70
|
+
return data
|
|
71
|
+
|
|
72
|
+
def create_presentation(self, metadata: Dict[str, Any]) -> None:
|
|
73
|
+
"""
|
|
74
|
+
Create presentation with metadata.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
metadata: Metadata dictionary.
|
|
78
|
+
"""
|
|
79
|
+
self.presentation = Presentation()
|
|
80
|
+
self.presentation.slide_width = DEFAULT_SLIDE_WIDTH
|
|
81
|
+
self.presentation.slide_height = DEFAULT_SLIDE_HEIGHT
|
|
82
|
+
|
|
83
|
+
# Set core properties
|
|
84
|
+
if metadata.get('title'):
|
|
85
|
+
self.presentation.core_properties.title = metadata['title']
|
|
86
|
+
if metadata.get('author'):
|
|
87
|
+
self.presentation.core_properties.author = metadata['author']
|
|
88
|
+
|
|
89
|
+
print(f"✓ 演示文稿已创建: {metadata.get('title', 'Untitled')}")
|
|
90
|
+
|
|
91
|
+
def add_slide(
|
|
92
|
+
self,
|
|
93
|
+
slide_data: Dict[str, Any],
|
|
94
|
+
slide_index: int
|
|
95
|
+
) -> None:
|
|
96
|
+
"""
|
|
97
|
+
Add a slide to the presentation.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
slide_data: Slide data dictionary.
|
|
101
|
+
slide_index: Slide index (1-based).
|
|
102
|
+
"""
|
|
103
|
+
if not self.presentation:
|
|
104
|
+
raise ValueError("演示文稿未创建")
|
|
105
|
+
|
|
106
|
+
layout_name = slide_data.get('layout', 'ContentSlide')
|
|
107
|
+
title = slide_data.get('title', '')
|
|
108
|
+
content = slide_data.get('content', [])
|
|
109
|
+
notes = slide_data.get('notes', '')
|
|
110
|
+
|
|
111
|
+
# Select layout
|
|
112
|
+
slide_layout = self._select_layout(layout_name)
|
|
113
|
+
slide = self.presentation.slides.add_slide(slide_layout)
|
|
114
|
+
|
|
115
|
+
# Add title
|
|
116
|
+
if slide.shapes.title:
|
|
117
|
+
title_shape = slide.shapes.title
|
|
118
|
+
title_shape.text = title
|
|
119
|
+
self._apply_title_style(title_shape)
|
|
120
|
+
|
|
121
|
+
# Add content
|
|
122
|
+
self._add_content(slide, content)
|
|
123
|
+
|
|
124
|
+
# Add notes
|
|
125
|
+
if notes:
|
|
126
|
+
notes_slide = slide.notes_slide
|
|
127
|
+
notes_text_frame = notes_slide.notes_text_frame
|
|
128
|
+
notes_text_frame.text = notes
|
|
129
|
+
|
|
130
|
+
print(f" ✓ 幻灯片 {slide_index} 已添加: {title}")
|
|
131
|
+
|
|
132
|
+
def _select_layout(self, layout_name: str):
|
|
133
|
+
"""
|
|
134
|
+
Select slide layout based on layout name.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
layout_name: Layout name.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
Slide layout object.
|
|
141
|
+
"""
|
|
142
|
+
layout_map = {
|
|
143
|
+
'TitleSlide': 0, # Title slide
|
|
144
|
+
'ContentSlide': 5, # Title and Content
|
|
145
|
+
'TwoColumnSlide': 6, # Two Content
|
|
146
|
+
'SectionHeaderSlide': 2, # Section Header
|
|
147
|
+
'ContentWithCaptionSlide': 7, # Content with Caption
|
|
148
|
+
'SummarySlide': 5, # Similar to ContentSlide
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
layout_idx = layout_map.get(layout_name, 5)
|
|
152
|
+
return self.presentation.slide_layouts[layout_idx]
|
|
153
|
+
|
|
154
|
+
def _apply_title_style(self, title_shape):
|
|
155
|
+
"""
|
|
156
|
+
Apply style to title shape.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
title_shape: Title shape object.
|
|
160
|
+
"""
|
|
161
|
+
text_frame = title_shape.text_frame
|
|
162
|
+
paragraph = text_frame.paragraphs[0]
|
|
163
|
+
|
|
164
|
+
# Font settings
|
|
165
|
+
font = paragraph.font
|
|
166
|
+
font.name = self.style_config.get('title_font', 'Arial')
|
|
167
|
+
font.size = Pt(self.style_config.get('title_font_size', 36))
|
|
168
|
+
font.bold = True
|
|
169
|
+
font.color.rgb = RgbColor(*self._hex_to_rgb(
|
|
170
|
+
self.style_config.get('title_color', '#333333')
|
|
171
|
+
))
|
|
172
|
+
|
|
173
|
+
def _add_content(self, slide, content: List[str]):
|
|
174
|
+
"""
|
|
175
|
+
Add content to slide.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
slide: Slide object.
|
|
179
|
+
content: List of content strings.
|
|
180
|
+
"""
|
|
181
|
+
if not content:
|
|
182
|
+
return
|
|
183
|
+
|
|
184
|
+
# Find text frame for content
|
|
185
|
+
text_frame = None
|
|
186
|
+
for shape in slide.shapes:
|
|
187
|
+
if hasattr(shape, 'text_frame') and shape != slide.shapes.title:
|
|
188
|
+
text_frame = shape.text_frame
|
|
189
|
+
break
|
|
190
|
+
|
|
191
|
+
if not text_frame:
|
|
192
|
+
return
|
|
193
|
+
|
|
194
|
+
# Clear existing paragraphs
|
|
195
|
+
for paragraph in text_frame.paragraphs[1:]:
|
|
196
|
+
p = paragraph._element
|
|
197
|
+
p.getparent().remove(p)
|
|
198
|
+
|
|
199
|
+
# Add content as bullet points
|
|
200
|
+
for i, item in enumerate(content):
|
|
201
|
+
if i == 0:
|
|
202
|
+
paragraph = text_frame.paragraphs[0]
|
|
203
|
+
else:
|
|
204
|
+
paragraph = text_frame.add_paragraph()
|
|
205
|
+
|
|
206
|
+
paragraph.text = item
|
|
207
|
+
paragraph.level = 0
|
|
208
|
+
|
|
209
|
+
# Font settings
|
|
210
|
+
font = paragraph.font
|
|
211
|
+
font.name = self.style_config.get('content_font', 'Arial')
|
|
212
|
+
font.size = Pt(self.style_config.get('content_font_size', 24))
|
|
213
|
+
font.color.rgb = RgbColor(*self._hex_to_rgb(
|
|
214
|
+
self.style_config.get('content_color', '#555555')
|
|
215
|
+
))
|
|
216
|
+
|
|
217
|
+
def _hex_to_rgb(self, hex_color: str) -> tuple:
|
|
218
|
+
"""
|
|
219
|
+
Convert hex color to RGB tuple.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
hex_color: Hex color string (e.g., '#RRGGBB').
|
|
223
|
+
|
|
224
|
+
Returns:
|
|
225
|
+
RGB tuple (r, g, b).
|
|
226
|
+
"""
|
|
227
|
+
hex_color = hex_color.lstrip('#')
|
|
228
|
+
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
|
|
229
|
+
|
|
230
|
+
def save(self, output_path: str) -> None:
|
|
231
|
+
"""
|
|
232
|
+
Save presentation to .pptx file.
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
output_path: Output .pptx file path.
|
|
236
|
+
"""
|
|
237
|
+
if not self.presentation:
|
|
238
|
+
raise ValueError("演示文稿未创建")
|
|
239
|
+
|
|
240
|
+
output_path = Path(output_path)
|
|
241
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
242
|
+
|
|
243
|
+
self.presentation.save(str(output_path))
|
|
244
|
+
print(f"✓ PPTX 文件已保存: {output_path}")
|
|
245
|
+
|
|
246
|
+
def build_from_json(
|
|
247
|
+
self,
|
|
248
|
+
json_path: str,
|
|
249
|
+
output_path: str
|
|
250
|
+
) -> bool:
|
|
251
|
+
"""
|
|
252
|
+
Build .pptx file from JSON data.
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
json_path: Path to JSON file.
|
|
256
|
+
output_path: Output .pptx file path.
|
|
257
|
+
|
|
258
|
+
Returns:
|
|
259
|
+
True if successful, False otherwise.
|
|
260
|
+
"""
|
|
261
|
+
try:
|
|
262
|
+
# Load JSON
|
|
263
|
+
print(f"\n开始构建 PPTX...")
|
|
264
|
+
data = self.load_json(json_path)
|
|
265
|
+
|
|
266
|
+
# Create presentation
|
|
267
|
+
metadata = data.get('metadata', {})
|
|
268
|
+
self.create_presentation(metadata)
|
|
269
|
+
|
|
270
|
+
# Add slides
|
|
271
|
+
slides = data.get('slides', [])
|
|
272
|
+
print(f"\n添加幻灯片...")
|
|
273
|
+
for i, slide_data in enumerate(slides, 1):
|
|
274
|
+
self.add_slide(slide_data, i)
|
|
275
|
+
|
|
276
|
+
# Save
|
|
277
|
+
print(f"\n保存文件...")
|
|
278
|
+
self.save(output_path)
|
|
279
|
+
|
|
280
|
+
print(f"\n✓ PPTX 文件生成成功: {output_path}")
|
|
281
|
+
print(f" 总页数: {len(slides)}")
|
|
282
|
+
return True
|
|
283
|
+
|
|
284
|
+
except Exception as e:
|
|
285
|
+
print(f"\n✗ 错误: {e}")
|
|
286
|
+
import traceback
|
|
287
|
+
traceback.print_exc()
|
|
288
|
+
return False
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
# =============================================================================
|
|
292
|
+
# Main Function
|
|
293
|
+
# =============================================================================
|
|
294
|
+
|
|
295
|
+
def main():
|
|
296
|
+
"""Main entry point."""
|
|
297
|
+
parser = argparse.ArgumentParser(
|
|
298
|
+
description='Generate .pptx files from JSON data'
|
|
299
|
+
)
|
|
300
|
+
parser.add_argument(
|
|
301
|
+
'--input', '-i',
|
|
302
|
+
required=True,
|
|
303
|
+
help='Input JSON file path'
|
|
304
|
+
)
|
|
305
|
+
parser.add_argument(
|
|
306
|
+
'--style', '-s',
|
|
307
|
+
help='Style configuration JSON file path'
|
|
308
|
+
)
|
|
309
|
+
parser.add_argument(
|
|
310
|
+
'--output', '-o',
|
|
311
|
+
default=DEFAULT_OUTPUT_PATH,
|
|
312
|
+
help='Output .pptx file path'
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
args = parser.parse_args()
|
|
316
|
+
|
|
317
|
+
# Load style config
|
|
318
|
+
style_config = None
|
|
319
|
+
if args.style:
|
|
320
|
+
print(f"\n加载风格配置: {args.style}")
|
|
321
|
+
with open(args.style, 'r', encoding='utf-8') as f:
|
|
322
|
+
style_config = json.load(f)
|
|
323
|
+
|
|
324
|
+
# Create builder
|
|
325
|
+
builder = PPTXBuilder(style_config=style_config)
|
|
326
|
+
|
|
327
|
+
# Build PPTX
|
|
328
|
+
success = builder.build_from_json(
|
|
329
|
+
args.input,
|
|
330
|
+
args.output
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
if success:
|
|
334
|
+
print(f"\n完成!PPTX 文件已保存到: {args.output}")
|
|
335
|
+
else:
|
|
336
|
+
print(f"\n失败:无法生成 PPTX 文件")
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
if __name__ == '__main__':
|
|
340
|
+
main()
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
PPTX Validator - Validate generated .pptx files.
|
|
4
|
+
|
|
5
|
+
This module validates .pptx files to ensure they are
|
|
6
|
+
correctly generated and can be opened in PowerPoint.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Optional
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from pptx import Presentation
|
|
16
|
+
except ImportError:
|
|
17
|
+
print("错误: 未安装 python-pptx")
|
|
18
|
+
print("请运行: pip install python-pptx")
|
|
19
|
+
sys.exit(1)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# =============================================================================
|
|
23
|
+
# PPTX Validator
|
|
24
|
+
# =============================================================================
|
|
25
|
+
|
|
26
|
+
class PPTXValidator:
|
|
27
|
+
"""Validator for .pptx files."""
|
|
28
|
+
|
|
29
|
+
def __init__(self):
|
|
30
|
+
"""Initialize PPTX validator."""
|
|
31
|
+
self.errors = []
|
|
32
|
+
self.warnings = []
|
|
33
|
+
|
|
34
|
+
def validate(self, pptx_path: str) -> bool:
|
|
35
|
+
"""
|
|
36
|
+
Validate .pptx file.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
pptx_path: Path to .pptx file.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
True if valid, False otherwise.
|
|
43
|
+
"""
|
|
44
|
+
print(f"验证 PPTX 文件: {pptx_path}\n")
|
|
45
|
+
|
|
46
|
+
# Check file exists
|
|
47
|
+
if not Path(pptx_path).exists():
|
|
48
|
+
self.errors.append(f"文件不存在: {pptx_path}")
|
|
49
|
+
self._print_results()
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
# Check file extension
|
|
53
|
+
if not pptx_path.lower().endswith('.pptx'):
|
|
54
|
+
self.warnings.append("文件扩展名不是 .pptx")
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
# Open presentation
|
|
58
|
+
presentation = Presentation(pptx_path)
|
|
59
|
+
except Exception as e:
|
|
60
|
+
self.errors.append(f"无法打开 PPTX 文件: {e}")
|
|
61
|
+
self._print_results()
|
|
62
|
+
return False
|
|
63
|
+
|
|
64
|
+
# Validate slides
|
|
65
|
+
self._validate_slides(presentation)
|
|
66
|
+
|
|
67
|
+
# Print results
|
|
68
|
+
self._print_results()
|
|
69
|
+
|
|
70
|
+
return len(self.errors) == 0
|
|
71
|
+
|
|
72
|
+
def _validate_slides(self, presentation) -> None:
|
|
73
|
+
"""
|
|
74
|
+
Validate slides in presentation.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
presentation: Presentation object.
|
|
78
|
+
"""
|
|
79
|
+
slide_count = len(presentation.slides)
|
|
80
|
+
|
|
81
|
+
if slide_count == 0:
|
|
82
|
+
self.errors.append("演示文稿中没有幻灯片")
|
|
83
|
+
else:
|
|
84
|
+
print(f"✓ 幻灯片数量: {slide_count}\n")
|
|
85
|
+
|
|
86
|
+
# Validate each slide
|
|
87
|
+
for i, slide in enumerate(presentation.slides, 1):
|
|
88
|
+
self._validate_slide(slide, i)
|
|
89
|
+
|
|
90
|
+
def _validate_slide(self, slide, index: int) -> None:
|
|
91
|
+
"""
|
|
92
|
+
Validate a slide.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
slide: Slide object.
|
|
96
|
+
index: Slide index.
|
|
97
|
+
"""
|
|
98
|
+
shape_count = len(slide.shapes)
|
|
99
|
+
|
|
100
|
+
if shape_count == 0:
|
|
101
|
+
self.warnings.append(f"幻灯片 {index} 没有内容")
|
|
102
|
+
else:
|
|
103
|
+
# Check for title
|
|
104
|
+
has_title = False
|
|
105
|
+
for shape in slide.shapes:
|
|
106
|
+
if hasattr(shape, 'text_frame'):
|
|
107
|
+
if shape.has_text_frame:
|
|
108
|
+
text = shape.text_frame.text.strip()
|
|
109
|
+
if text and shape == slide.shapes.title:
|
|
110
|
+
has_title = True
|
|
111
|
+
break
|
|
112
|
+
|
|
113
|
+
if not has_title:
|
|
114
|
+
self.warnings.append(f"幻灯片 {index} 没有标题")
|
|
115
|
+
|
|
116
|
+
def _print_results(self) -> None:
|
|
117
|
+
"""Print validation results."""
|
|
118
|
+
if self.errors:
|
|
119
|
+
print(f"❌ 发现 {len(self.errors)} 个错误:\n")
|
|
120
|
+
for i, error in enumerate(self.errors, 1):
|
|
121
|
+
print(f" {i}. {error}")
|
|
122
|
+
print()
|
|
123
|
+
|
|
124
|
+
if self.warnings:
|
|
125
|
+
print(f"⚠️ 发现 {len(self.warnings)} 个警告:\n")
|
|
126
|
+
for i, warning in enumerate(self.warnings, 1):
|
|
127
|
+
print(f" {i}. {warning}")
|
|
128
|
+
print()
|
|
129
|
+
|
|
130
|
+
if not self.errors and not self.warnings:
|
|
131
|
+
print("✓ PPTX 文件验证通过!\n")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
# =============================================================================
|
|
135
|
+
# Main Function
|
|
136
|
+
# =============================================================================
|
|
137
|
+
|
|
138
|
+
def main():
|
|
139
|
+
"""Main entry point."""
|
|
140
|
+
parser = argparse.ArgumentParser(
|
|
141
|
+
description='Validate generated .pptx files'
|
|
142
|
+
)
|
|
143
|
+
parser.add_argument(
|
|
144
|
+
'--input', '-i',
|
|
145
|
+
required=True,
|
|
146
|
+
help='Input .pptx file path'
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
args = parser.parse_args()
|
|
150
|
+
|
|
151
|
+
# Create validator
|
|
152
|
+
validator = PPTXValidator()
|
|
153
|
+
|
|
154
|
+
# Validate
|
|
155
|
+
is_valid = validator.validate(args.input)
|
|
156
|
+
|
|
157
|
+
# Exit with appropriate code
|
|
158
|
+
sys.exit(0 if is_valid else 1)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if __name__ == '__main__':
|
|
162
|
+
main()
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|