Inline # comments in gitignore are not supported — they were silently breaking three patterns (data/checkpoints/, data/adapter-migration-state.json, .claude/agents/.generated/). Moved comments to their own lines and added missing entries for runtime dirs (data/audit/, data/logs/, etc.) and temp files (.interaction_tmp.json, .design-build/, .taskmaster bak files). Also tracks previously untracked legitimate files: scripts, tests, docs, skills references, .env.example, taskmaster templates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
171 lines
5.0 KiB
Markdown
171 lines
5.0 KiB
Markdown
# Advanced Features — פיצ'רים מתקדמים
|
|
|
|
## הערות שוליים (Footnotes)
|
|
|
|
**שימוש מרכזי:** הפניות לחקיקה ופסיקה.
|
|
|
|
```javascript
|
|
const { FootnoteReferenceRun } = require('docx');
|
|
|
|
const doc = new Document({
|
|
footnotes: {
|
|
1: { children: [new Paragraph({
|
|
bidirectional: true, alignment: AlignmentType.START,
|
|
children: [new TextRun({
|
|
text: "חוק החוזים (חלק כללי), התשל״ג-1973, סעיף 12.",
|
|
font: "David", size: 20, rightToLeft: true
|
|
})]
|
|
})] },
|
|
},
|
|
// ...sections
|
|
});
|
|
|
|
// הפניה בגוף הטקסט:
|
|
new Paragraph({
|
|
bidirectional: true, alignment: AlignmentType.BOTH,
|
|
children: [
|
|
new TextRun({ text: "חובת תום הלב", font: "David", size: 24, rightToLeft: true }),
|
|
new FootnoteReferenceRun(1),
|
|
new TextRun({ text: " חלה על כל שלבי המשא ומתן.", font: "David", size: 24, rightToLeft: true }),
|
|
]
|
|
})
|
|
```
|
|
|
|
### תיקון RTL בהערות שוליים (post-unpack)
|
|
docx-js לא מגדיר RTL מלא. אחרי unpack, תקן ב-`word/footnotes.xml`:
|
|
```xml
|
|
<w:footnote w:id="1">
|
|
<w:p>
|
|
<w:pPr>
|
|
<w:pStyle w:val="FootnoteText"/>
|
|
<w:bidi/>
|
|
<w:jc w:val="start"/>
|
|
</w:pPr>
|
|
<w:r>
|
|
<w:rPr>
|
|
<w:rStyle w:val="FootnoteReference"/>
|
|
<w:rtl/>
|
|
</w:rPr>
|
|
<w:footnoteRef/>
|
|
</w:r>
|
|
</w:p>
|
|
</w:footnote>
|
|
```
|
|
|
|
---
|
|
|
|
## תוכן עניינים (TOC)
|
|
|
|
**⚠️ TOC ידני בלבד** — `TableOfContents` של docx-js מאבד הגדרות RTL בעדכון Word.
|
|
|
|
```javascript
|
|
const { Tab, TabStopType, LeaderType, LineRuleType } = require('docx');
|
|
|
|
const tocEntry = (text, pageNum, opts = {}) => new Paragraph({
|
|
bidirectional: true,
|
|
spacing: { after: 60, line: 276, lineRule: LineRuleType.AUTO },
|
|
...(opts.indent ? { indent: { right: opts.indent } } : {}),
|
|
tabStops: [{ type: TabStopType.RIGHT, position: 9026, leader: LeaderType.DOT }],
|
|
children: [
|
|
new TextRun({ text, font: "David", size: 24, rightToLeft: true, bold: opts.bold || false }),
|
|
new TextRun({ children: [new Tab()], font: "David", rightToLeft: true }),
|
|
new TextRun({ text: String(pageNum), font: "David", size: 24, rightToLeft: true }),
|
|
]
|
|
});
|
|
|
|
// שימוש:
|
|
tocEntry("פרק א׳ — הגדרות כלליות", 2, { bold: true }),
|
|
tocEntry("1. הגדרות יסוד", 2, { indent: 400 }),
|
|
```
|
|
|
|
---
|
|
|
|
## מספר סקשנים (Multiple Sections)
|
|
|
|
**שימוש:** כותרות שונות לנספחים, שוליים שונים.
|
|
|
|
```javascript
|
|
const doc = new Document({
|
|
sections: [
|
|
{
|
|
properties: {
|
|
page: { size: { width: 11906, height: 16838 }, margin: { top: 1417, right: 1417, bottom: 1417, left: 1417 } },
|
|
bidi: true,
|
|
},
|
|
headers: {
|
|
default: new Header({ children: [new Paragraph({
|
|
bidirectional: true, alignment: AlignmentType.CENTER,
|
|
children: [new TextRun({ text: "הסכם שירותים", font: "David", size: 20, bold: true, rightToLeft: true })]
|
|
})] })
|
|
},
|
|
children: [ /* גוף ההסכם */ ]
|
|
},
|
|
{
|
|
properties: {
|
|
page: { size: { width: 11906, height: 16838 }, margin: { top: 1417, right: 1417, bottom: 1417, left: 1417 } },
|
|
bidi: true,
|
|
},
|
|
headers: {
|
|
default: new Header({ children: [new Paragraph({
|
|
bidirectional: true, alignment: AlignmentType.START,
|
|
children: [new TextRun({ text: "נספח א׳ — לוח תעריפים", font: "David", size: 20, bold: true, rightToLeft: true })]
|
|
})] })
|
|
},
|
|
children: [ /* הנספח */ ]
|
|
}
|
|
]
|
|
});
|
|
```
|
|
|
|
---
|
|
|
|
## לוגו/תמונה בכותרת (Letterhead)
|
|
|
|
```javascript
|
|
const { ImageRun } = require('docx');
|
|
const logoBuffer = fs.readFileSync('/path/to/logo.png');
|
|
|
|
headers: {
|
|
default: new Header({
|
|
children: [
|
|
new Paragraph({
|
|
alignment: AlignmentType.CENTER,
|
|
children: [new ImageRun({ data: logoBuffer, transformation: { width: 200, height: 60 }, type: "png" })],
|
|
}),
|
|
new Paragraph({
|
|
bidirectional: true, alignment: AlignmentType.CENTER,
|
|
children: [new TextRun({ text: "משרד עורכי דין ישראלי ושות׳", font: "David", size: 20, bold: true, rightToLeft: true })],
|
|
}),
|
|
],
|
|
}),
|
|
}
|
|
```
|
|
|
|
**הערה:** תמונה חייבת להיות קובץ אמיתי — לבקש מהמשתמש אם אין.
|
|
|
|
---
|
|
|
|
## היפרלינקים
|
|
|
|
```javascript
|
|
const { ExternalHyperlink, UnderlineType } = require('docx');
|
|
|
|
new Paragraph({
|
|
bidirectional: true,
|
|
children: [
|
|
new TextRun({ text: "ראה: ", font: "David", size: 24, rightToLeft: true }),
|
|
new ExternalHyperlink({
|
|
link: "https://www.nevo.co.il/law_html/law01/073_002.htm",
|
|
children: [new TextRun({
|
|
text: "חוק החוזים באתר נבו",
|
|
font: "David", size: 24, rightToLeft: true,
|
|
color: "0563C1",
|
|
underline: { type: UnderlineType.SINGLE },
|
|
})],
|
|
}),
|
|
]
|
|
})
|
|
```
|
|
|
|
**⚠️ אל תשתמש ב-`style: "Hyperlink"`** — מפריע ל-RTL. הגדר `color` + `underline` ידנית.
|