Repository Public
1// ORIX Docs2// File: Packages/ORIXDocsKit/Sources/DocTemplates/Templates+Publishing.swift3// Description: Legal memorandum, technical manual, book manuscript and newsletter templates.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import Foundation8import DocModel910extension TemplateLibrary {11 // MARK: Legal memorandum1213 static func legalMemorandum(_ c: TemplateContext) -> DocumentModel {14 var b = TemplateBuilder(c, theme: .classic, margins: Insets(top: 72, left: 80, bottom: 76, right: 80))15 let t = b.t16 let text = b.theme.text, muted = b.muted17 let label: Points = t.french ? 120 : 7618 b.adjust(StyleID.normal) { $0.para.alignment = .justified; $0.para.lineSpacing = .multiple(1.35); $0.para.spaceAfter = 10 }19 b.adjust(StyleID.heading(1)) { $0.char.fontSize = 12; $0.char.color = text; $0.char.allCaps = true; $0.char.tracking = 0.5; $0.para.spaceBefore = 18 }20 b.adjust(StyleID.heading(2)) { $0.char.fontSize = 12; $0.char.italic = true }21 b.numberHeadings(1...2)22 b.define("MemoTitle", t("Memorandum Title", "Titre de la note"), basedOn: StyleID.title, next: "Privilege",23 char: CharProps(fontSize: 18, tracking: 3, allCaps: true), para: ParaProps(alignment: .center, spaceAfter: 4))24 b.define("Privilege", t("Privilege Notice", "Mention de confidentialité"), next: "MemoHeader",25 char: CharProps(fontSize: 9.5, bold: true, tracking: 0.8, allCaps: true), para: ParaProps(alignment: .center, spaceAfter: 20))26 b.define("MemoHeader", t("Memorandum Header", "En-tête de la note"), next: "MemoHeader",27 para: ParaProps(alignment: .left, indentLeft: label, firstLineIndent: -label, spaceAfter: 4, lineSpacing: .multiple(1.2), keepWithNext: true, tabs: [TabStop(position: label)]))28 b.define("MemoHeaderLast", t("Memorandum Header (last line)", "En-tête de la note (dernière ligne)"), basedOn: "MemoHeader", next: StyleID.heading(1),29 para: ParaProps(spaceAfter: 16, borderBottom: BorderLine(width: 1, color: text)))30 b.define("NumberedParagraph", t("Numbered Paragraph", "Paragraphe numéroté"), basedOn: StyleID.listParagraph, next: "NumberedParagraph",31 para: ParaProps(alignment: .justified, spaceAfter: 8, lineSpacing: .multiple(1.35)))32 b.adjust(StyleID.footer) { $0.char.fontSize = 8.5; $0.char.color = muted }3334 let confidential = t("Privileged and confidential – solicitor-client communication", "Privilégié et confidentiel – communication protégée par le secret professionnel")35 b.setup.header = HeaderFooter()36 b.setup.footer = HeaderFooter(default: [b.footer([r(confidential), tab, tab] + b.pageOfTotal)])37 let factsID = DocID.make(), issueID = DocID.make()3839 b.p("MemoTitle", t("Memorandum", "Note de service"))40 b.p("Privilege", confidential)41 b.p("MemoHeader", [strong(t("TO:", "DESTINATAIRE :")), tab, r(t("[Name, title]", "[Nom, titre]"))])42 b.p("MemoHeader", [strong(t("FROM:", "EXPÉDITEUR :")), tab, b.authorRun, r(", " + b.organization)])43 b.p("MemoHeader", [strong(t("DATE:", "DATE :")), tab, r(b.dateText)])44 b.p("MemoHeader", [strong(t("FILE:", "DOSSIER :")), tab, r(t("[Client – matter number]", "[Client – numéro de dossier]"))])45 b.p("MemoHeaderLast", [strong(t("RE:", "OBJET :")), tab, r(t("[Subject of the memorandum, in one line]", "[Objet de la note, en une ligne]"))])4647 // Questions and answers are numbered paragraphs of one multilevel list: 1., 1.1., …48 let legal = b.newList(.multilevel())49 b.heading(1, t("Questions Presented", "Questions en litige"))50 b.item([r(t("[State the first legal question in one sentence that contains the decisive facts.]", "[Formulez la première question de droit en une phrase qui contient les faits déterminants.]"))], list: legal, style: "NumberedParagraph")51 b.item([r(t("[Second question, if any.]", "[Deuxième question, s'il y a lieu.]"))], list: legal, style: "NumberedParagraph")5253 b.heading(1, t("Brief Answers", "Réponses brèves"))54 let answers = b.newList(.multilevel())55 b.item([r(t("[Probably yes / Probably no.] [The reason in one or two sentences.]", "[Probablement oui / Probablement non.] [Le motif en une ou deux phrases.]"))], list: answers, style: "NumberedParagraph")56 b.item([r(t("[Qualification or condition attached to the answer.]", "[Réserve ou condition dont la réponse est assortie.]"))], list: answers, level: 1, style: "NumberedParagraph")57 b.item([r(t("[Answer to the second question.]", "[Réponse à la deuxième question.]"))], list: answers, style: "NumberedParagraph")5859 b.heading(1, t("Statement of Facts", "Exposé des faits"), id: factsID)60 b.body(t("[Set out the relevant facts in chronological order, favourable or not, and say where each comes from (document, witness, client).] State the facts you assumed.",61 "[Exposez les faits pertinents dans l'ordre chronologique, favorables ou non, en précisant leur provenance (document, témoin, client).] Indiquez les faits que vous avez tenus pour acquis."))6263 b.heading(1, t("Analysis", "Analyse"))64 b.heading(2, t("[First issue]", "[Première question]"), id: issueID)65 let authority = b.footnote(t("[Full citation of the statute or the decision, with the pinpoint reference.]", "[Référence complète de la loi ou de la décision, avec le renvoi précis.]"))66 b.body([r(t("[State the rule and its source.]", "[Énoncez la règle et sa source.]")), authority,67 r(t(" [Apply it to the facts set out in ", " [Appliquez-la aux faits exposés à la "))] + b.ref(factsID, .section)68 + [r(t(", address the opposing argument, then conclude on the issue.]", ", répondez à l'argument contraire, puis concluez sur la question.]"))])69 b.heading(2, t("[Second issue]", "[Deuxième question]"))70 b.body([r(t("[Follow the same structure: rule, application, counter-argument, conclusion. Refer back to ", "[Suivez la même structure : règle, application, argument contraire, conclusion. Renvoyez à la "))]71 + b.ref(issueID, .section) + [r(t(" where the reasoning overlaps.]", " lorsque le raisonnement se recoupe.]"))])7273 b.heading(1, t("Conclusion and Recommendation", "Conclusion et recommandation"))74 b.body(t("[Summarize the answers, assess the risk and recommend the next steps, with deadlines and limitation periods.]",75 "[Résumez les réponses, évaluez le risque et recommandez les prochaines étapes, avec les échéances et les délais de prescription.]"))76 return b.build(title: t("Memorandum – [Subject]", "Note de service – [Objet]"))77 }7879 // MARK: Technical manual8081 static func technicalManual(_ c: TemplateContext) -> DocumentModel {82 var b = TemplateBuilder(c, theme: .technical, margins: Insets(top: 80, left: 76, bottom: 76, right: 68))83 let t = b.t84 let accent = b.theme.accent, tint = b.tint85 let warn = RGBA(hex: 0xB45309)86 coverStyles(&b)87 b.adjust(StyleID.heading(1)) { $0.para.pageBreakBefore = true; $0.char.fontSize = 22; $0.para.spaceAfter = 14 }88 b.numberHeadings(1...3)89 b.define("FrontHeading", t("Front Matter Heading", "Titre des pages liminaires"), basedOn: TStyle.unnumberedHeading, next: StyleID.normal, para: ParaProps(pageBreakBefore: false))90 b.define("Note", t("Note", "Remarque"), next: StyleID.normal,91 para: ParaProps(indentLeft: 12, indentRight: 12, spaceBefore: 6, spaceAfter: 12, keepLinesTogether: true, shading: tint, borderLeft: BorderLine(width: 3, color: accent)))92 b.define("Warning", t("Warning", "Mise en garde"), basedOn: "Note", next: StyleID.normal,93 para: ParaProps(shading: RGBA(r: warn.r, g: warn.g, b: warn.b, a: 0.1), borderLeft: BorderLine(width: 3, color: warn)))94 b.define("Step", t("Procedure Step", "Étape de procédure"), basedOn: StyleID.listParagraph, next: "Step", para: ParaProps(spaceAfter: 5))95 b.define("GlossaryTerm", t("Glossary Entry", "Entrée de glossaire"), next: "GlossaryTerm", para: ParaProps(indentLeft: 22, firstLineIndent: -22, spaceAfter: 5))9697 let title = t("[Product Name] – User Manual", "[Nom du produit] – Manuel de l'utilisateur")98 b.setup.differentFirstPage = true99 b.setup.header = HeaderFooter(default: [b.header([field(.title), tab, tab, field(.headingText(level: 1))])])100 b.setup.footer = HeaderFooter(default: [b.footer([r(t("Version [1.0] – ", "Version [1.0] – ") + b.dateText), tab, tab, field(.pageNumber)])])101 let conventionsTab = DocID.make(), installID = DocID.make(), figID = DocID.make(), paramTab = DocID.make(), troubleID = DocID.make(), requirementsID = DocID.make()102103 b.p("CoverKicker", t("User manual", "Manuel de l'utilisateur"))104 b.p("CoverTitle", t("[Product Name]", "[Nom du produit]"))105 b.p("CoverSubtitle", t("[Model or software version covered by this manual]", "[Modèle ou version du logiciel visé par ce manuel]"))106 b.p("CoverMeta", b.organization)107 b.p("CoverMeta", [r(t("Written by ", "Rédigé par ")), b.authorRun])108 b.p("CoverMeta", t("Document [number] · Version [1.0] · ", "Document [numéro] · Version [1.0] · ") + b.dateText)109 b.pageBreak()110111 b.heading(1, t("Revision History", "Historique des révisions"), style: "FrontHeading")112 b.table([0.8, 1.2, 1.4, 3],113 header: [th(t("Version", "Version")), th(t("Date", "Date")), th(t("Author", "Auteur")), th(t("Changes", "Modifications"))],114 rows: [[cell("[1.0]"), cell(b.dateText), cell(b.author), cell(t("First release.", "Première publication."))],115 [cell("[1.1]"), cell("[date]"), cell(t("[Name]", "[Nom]")), cell(t("[Summary of the changes]", "[Résumé des modifications]"))]])116 b.pageBreak()117 b.toc(.contents, maxLevel: 3)118 b.pageBreak()119 b.toc(.figures)120 b.toc(.tables)121122 b.heading(1, t("About This Manual", "À propos de ce manuel"))123 b.heading(2, t("Audience", "Public visé"))124 b.body(t("[Say who the manual is for and what the reader is expected to know.]", "[Indiquez à qui s'adresse le manuel et ce que le lecteur est censé savoir.]"))125 b.heading(2, t("Conventions", "Conventions"))126 b.body([r(t("The typographic conventions are listed in ", "Les conventions typographiques sont présentées au "))] + b.ref(conventionsTab, .table) + [r(".")])127 b.caption(.table, t("Typographic conventions", "Conventions typographiques"), id: conventionsTab)128 b.table([1.3, 3],129 header: [th(t("Convention", "Convention")), th(t("Meaning", "Signification"))],130 rows: [[cell([strong(t("Bold", "Gras"))]), cell(t("Names of buttons, menus and fields.", "Noms de boutons, de menus et de champs."))],131 [cell([code("monospace")]), cell(t("Commands, file names and values to type.", "Commandes, noms de fichiers et valeurs à saisir."))],132 [cell([em(t("Italic", "Italique"))]), cell(t("New terms, defined in the glossary.", "Termes nouveaux, définis dans le glossaire."))]])133 b.p("Note", [strong(t("Note. ", "Remarque. ")), r(t("[A note gives useful information that is not essential to the task.]", "[Une remarque donne un renseignement utile, mais non essentiel à la tâche.]"))])134 b.p("Warning", [strong(t("Warning. ", "Mise en garde. ")), r(t("[A warning describes a risk of injury, damage or data loss, and how to avoid it.]",135 "[Une mise en garde décrit un risque de blessure, de dommage ou de perte de données, et la façon de l'éviter.]"))])136137 b.heading(1, t("Getting Started", "Mise en route"))138 b.heading(2, t("Requirements", "Configuration requise"), id: requirementsID)139 b.bullets([t("[Operating system and version]", "[Système d'exploitation et version]"), t("[Hardware: memory, storage, ports]", "[Matériel : mémoire, stockage, ports]"),140 t("[Accounts, licences or permissions]", "[Comptes, licences ou autorisations]")])141 b.heading(2, t("Installation", "Installation"), id: installID)142 b.body(t("[One sentence on the goal and the time needed.] Each step is one action and starts with a verb.", "[Une phrase sur le but et le temps nécessaire.] Chaque étape correspond à une action et commence par un verbe."))143 let steps = b.newList(.numbered())144 b.item([r(t("[Download the installer from …]", "[Téléchargez le programme d'installation à partir de …]"))], list: steps, style: "Step")145 b.item([r(t("[Open the installer and follow the instructions.]", "[Ouvrez le programme d'installation et suivez les instructions.]"))], list: steps, style: "Step")146 b.item([r(t("[Result you should see at this point.]", "[Résultat que vous devriez obtenir à cette étape.]"))], list: steps, level: 1, style: "Step")147 b.item([r(t("[Check the installation by running:]", "[Vérifiez l'installation en exécutant la commande suivante :]"))], list: steps, style: "Step")148 b.p(StyleID.code, t("[command] --version", "[commande] --version"))149150 b.heading(1, t("Using [Product Name]", "Utilisation de [Nom du produit]"))151 b.heading(2, t("Overview of the Interface", "Aperçu de l'interface"))152 b.body([r(t("[Describe the main areas of the window or the device.] ", "[Décrivez les principales zones de la fenêtre ou de l'appareil.] "))]153 + b.ref(figID, .figure).capitalizedFirst(t.french, article: "La ") + [r(t(" identifies them.", " les désigne."))])154 b.figure(label: t("[Insert screenshot or diagram]", "[Insérer la capture d'écran ou le schéma]"),155 alt: t("Placeholder for a screenshot: replace this rectangle with your image and describe here the areas it identifies.",156 "Espace réservé à une capture d'écran : remplacez ce rectangle par votre image et décrivez ici les zones qu'elle désigne."), height: 190)157 b.caption(.figure, t("[Main window]", "[Fenêtre principale]"), id: figID)158 b.heading(2, t("[Task 1]", "[Tâche 1]"))159 b.heading(3, t("Before You Begin", "Avant de commencer"))160 b.body([r(t("[Prerequisites.] The product must be installed as described in ", "[Conditions préalables.] Le produit doit être installé de la façon décrite à la "))] + b.ref(installID, .section) + [r(".")])161 b.heading(3, t("Procedure", "Marche à suivre"))162 b.numbered([[r(t("[Select ", "[Sélectionnez ")), strong(t("Menu > Command", "Menu > Commande")), r(".]")],163 [r(t("[Enter the value, then select ", "[Entrez la valeur, puis sélectionnez ")), strong("OK"), r(".]")]])164165 b.heading(1, t("Reference", "Référence"))166 b.body([r(t("[Describe every setting.] Defaults are listed in ", "[Décrivez chaque réglage.] Les valeurs par défaut figurent au "))] + b.ref(paramTab, .table) + [r(".")])167 b.caption(.table, t("Settings", "Réglages"), id: paramTab)168 b.table([1.4, 1, 1, 2.6],169 header: [th(t("Setting", "Réglage")), th(t("Values", "Valeurs")), th(t("Default", "Défaut")), th(t("Description", "Description"))],170 rows: (1...3).map { [cell([code(t("[setting\($0)]", "[reglage\($0)]"))]), cell(t("[range]", "[plage]")), cell(t("[value]", "[valeur]")), cell(t("[What the setting does]", "[Effet du réglage]"))] },171 style: b.bandedTable)172173 b.heading(1, t("Troubleshooting", "Dépannage"), id: troubleID)174 b.body([r(t("[List the most frequent problems first.] Check the requirements in ", "[Présentez d'abord les problèmes les plus fréquents.] Vérifiez la configuration requise à la "))]175 + b.ref(requirementsID, .section) + [r(t(" before contacting support.", " avant de communiquer avec le soutien technique."))])176 b.caption(.table, t("Common problems", "Problèmes courants"))177 b.table([1.5, 1.5, 2],178 header: [th(t("Symptom", "Symptôme")), th(t("Likely cause", "Cause probable")), th(t("Solution", "Solution"))],179 rows: (1...2).map { [cell(t("[Symptom \($0)]", "[Symptôme \($0)]")), cell(t("[Cause]", "[Cause]")), cell(t("[What to do]", "[Mesure à prendre]"))] })180181 b.heading(1, t("Appendix A. Glossary", "Annexe A. Glossaire"), style: TStyle.unnumberedHeading)182 b.p("GlossaryTerm", [strong(t("[Term]", "[Terme]")), r(t(" – [Definition in one sentence.]", " – [Définition en une phrase.]"))])183 b.p("GlossaryTerm", [strong(t("[Term]", "[Terme]")), r(t(" – [Definition in one sentence.]", " – [Définition en une phrase.]"))])184 b.heading(1, t("Appendix B. Support", "Annexe B. Soutien technique"), style: TStyle.unnumberedHeading)185 b.body(t("[How to reach support, the information to have at hand and the hours of service.]", "[Façon de joindre le soutien technique, renseignements à avoir sous la main et heures de service.]"))186 return b.build(title: title)187 }188189 // MARK: Book manuscript190191 static func bookManuscript(_ c: TemplateContext) -> DocumentModel {192 var b = TemplateBuilder(c, theme: .classic, margins: Insets(top: 84, left: 90, bottom: 84, right: 80))193 let t = b.t194 let size = b.theme.bodySize195 let text = b.theme.text, muted = b.muted196 b.adjust(StyleID.normal) { $0.para.alignment = .justified; $0.para.firstLineIndent = 20; $0.para.spaceAfter = 0; $0.para.lineSpacing = .multiple(1.5); $0.para.hyphenate = true }197 b.define("BookTitle", t("Book Title", "Titre du livre"), basedOn: StyleID.title, next: "BookSubtitle",198 char: CharProps(fontSize: 34), para: ParaProps(alignment: .center, firstLineIndent: 0, spaceBefore: 150, spaceAfter: 12))199 b.define("BookSubtitle", t("Book Subtitle", "Sous-titre du livre"), basedOn: StyleID.subtitle, next: "BookAuthor", para: ParaProps(alignment: .center, firstLineIndent: 0, spaceAfter: 70))200 b.define("BookAuthor", t("Book Author", "Auteur du livre"), next: "FrontMatter", char: CharProps(fontSize: size + 4, tracking: 1),201 para: ParaProps(alignment: .center, firstLineIndent: 0, spaceAfter: 8))202 b.define("FrontMatter", t("Front Matter Text", "Texte des pages liminaires"), next: "FrontMatter", char: CharProps(fontSize: size - 1.5),203 para: ParaProps(alignment: .left, firstLineIndent: 0, spaceAfter: 6, lineSpacing: .multiple(1.2), hyphenate: false))204 b.define("Dedication", t("Dedication", "Dédicace"), next: StyleID.normal, char: CharProps(italic: true),205 para: ParaProps(alignment: .center, firstLineIndent: 0, spaceBefore: 180))206 b.define("ChapterLabel", t("Chapter Label", "Mention de chapitre"), next: "ChapterTitle",207 char: CharProps(fontFamily: b.theme.headingFont, fontSize: size, color: muted, tracking: 2.5, allCaps: true),208 para: ParaProps(alignment: .center, firstLineIndent: 0, spaceBefore: 90, spaceAfter: 8, keepWithNext: true, pageBreakBefore: true, hyphenate: false))209 b.define("ChapterTitle", t("Chapter Title", "Titre de chapitre"), basedOn: StyleID.heading(1), next: "FirstParagraph",210 char: CharProps(fontSize: 24, color: text), para: ParaProps(alignment: .center, spaceBefore: 0, spaceAfter: 44))211 b.define("BackMatterTitle", t("Back Matter Title", "Titre des pages annexes"), basedOn: "ChapterTitle", next: "FirstParagraph", para: ParaProps(spaceBefore: 90, pageBreakBefore: true))212 b.define("FirstParagraph", t("First Paragraph", "Premier paragraphe"), next: StyleID.normal, para: ParaProps(firstLineIndent: 0, dropCapLines: 3))213 b.define("AfterBreak", t("Paragraph After Break", "Paragraphe après une coupure"), next: StyleID.normal, para: ParaProps(firstLineIndent: 0))214 b.define("SceneBreak", t("Scene Break", "Coupure de scène"), next: "AfterBreak", para: ParaProps(alignment: .center, firstLineIndent: 0, spaceBefore: 14, spaceAfter: 14, keepWithNext: true))215 b.define("Epigraph", t("Epigraph", "Épigraphe"), basedOn: StyleID.quote, next: "FirstParagraph",216 para: ParaProps(alignment: .right, indentLeft: 120, indentRight: 0, firstLineIndent: 0, spaceAfter: 24))217218 let title = t("[Book Title]", "[Titre du livre]")219 // Front matter: roman numerals, nothing on the title page.220 b.setup.differentFirstPage = true221 b.setup.differentOddEven = true222 b.setup.pageNumberFormat = .lowerRoman223 b.setup.pageNumberStart = 1224 b.setup.footer = HeaderFooter(default: [b.pageNumberFooter(.center)], even: [b.pageNumberFooter(.center)])225226 b.p("BookTitle", title)227 b.p("BookSubtitle", t("[Subtitle]", "[Sous-titre]"))228 b.p("BookAuthor", [b.authorRun])229 b.p("FrontMatter", [r(t("Manuscript – ", "Manuscrit – ") + b.dateText + t(" – approximately [00,000] words", " – environ [00 000] mots"))], props: ParaProps(alignment: .center, spaceBefore: 120))230 b.pageBreak()231 b.p("FrontMatter", [r("© " + t.year(c.date) + " "), b.authorRun], props: ParaProps(spaceBefore: 260))232 b.p("FrontMatter", t("All rights reserved. [Publisher or contact information]", "Tous droits réservés. [Maison d'édition ou coordonnées]") + (c.organization.isEmpty ? "" : " · " + c.organization))233 b.p("FrontMatter", t("[ISBN, legal deposit and edition, when the book is published]", "[ISBN, dépôt légal et édition, à la publication du livre]"))234 b.pageBreak()235 b.p("Dedication", t("[Dedication]", "[Dédicace]"))236 b.pageBreak()237 b.toc(.contents, maxLevel: 1)238239 // Text: arabic numbering restarts at 1 on a right-hand page; author on even pages, chapter title on odd pages.240 let textHeader = HeaderFooter(default: [b.header([tab, field(.headingText(level: 1))])], even: [b.header([tab, b.authorRun])])241 let textFooter = HeaderFooter(default: [b.pageNumberFooter(.right)], even: [b.pageNumberFooter(.left)])242 b.section(.oddPage) { s in243 s.differentFirstPage = false244 s.pageNumberFormat = .decimal245 s.pageNumberStart = 1246 s.header = textHeader247 s.footer = textFooter248 }249250 func chapter(_ name: String) {251 // The chapter number is a sequence field: chapters renumber themselves when they are moved.252 b.p("ChapterLabel", [r(t("Chapter", "Chapitre") + nbsp), field(.sequence("Chapter"))])253 b.heading(1, name, style: "ChapterTitle")254 }255256 chapter(t("[Title of the First Chapter]", "[Titre du premier chapitre]"))257 b.p("Epigraph", t("[An epigraph, if you use one, with its attribution.]", "[Une épigraphe, si vous en utilisez une, avec son attribution.]"))258 b.p("FirstParagraph", t("Begin your first chapter here. The opening paragraph of a chapter has no indent and starts with a drop cap; the paragraphs that follow take the body style, which indents the first line instead of leaving space between paragraphs.",259 "Commencez votre premier chapitre ici. Le premier paragraphe d'un chapitre n'a pas d'alinéa et s'ouvre sur une lettrine ; les paragraphes suivants prennent le style du corps de texte, qui met la première ligne en retrait au lieu d'espacer les paragraphes."))260 b.body(t("Write dialogue with the quotation marks of your language, “like this.” Set thoughts and titles in italics with a character style rather than with direct formatting, so the typesetter can restyle them at once.",261 "Présentez les dialogues avec les guillemets de votre langue, « comme ceci ». Mettez les pensées et les titres en italique au moyen d'un style de caractères plutôt que par une mise en forme directe, afin que l'éditeur puisse les modifier d'un seul coup."))262 b.p("SceneBreak", "* * *")263 b.p("AfterBreak", t("A scene break marks a change of time, place or point of view. The paragraph that follows it has no indent.",264 "Une coupure de scène marque un changement de temps, de lieu ou de point de vue. Le paragraphe qui la suit n'a pas d'alinéa."))265 b.body(t("[Continue the chapter.]", "[Poursuivez le chapitre.]"))266267 chapter(t("[Title of the Second Chapter]", "[Titre du deuxième chapitre]"))268 b.p("FirstParagraph", t("Each new chapter starts on a new page, numbers itself and appears in the table of contents. Duplicate this chapter to add another one.",269 "Chaque nouveau chapitre commence sur une nouvelle page, se numérote lui-même et figure dans la table des matières. Dupliquez ce chapitre pour en ajouter un autre."))270 b.body(t("[Continue the chapter.]", "[Poursuivez le chapitre.]"))271272 b.heading(1, t("About the Author", "À propos de l'auteur"), style: "BackMatterTitle")273 b.p("AfterBreak", [b.authorRun, r(t(" [lives in …, has published … and is working on …]. Write the biography in the third person, in fewer than one hundred words.",274 " [vit à …, a publié … et travaille à …]. Rédigez la notice biographique à la troisième personne, en moins de cent mots."))])275 return b.build(title: title)276 }277278 // MARK: Newsletter279280 static func newsletter(_ c: TemplateContext) -> DocumentModel {281 var b = TemplateBuilder(c, theme: .editorial, margins: Insets(top: 54, left: 54, bottom: 60, right: 54))282 let t = b.t283 let w = b.width284 let size = b.theme.bodySize285 let accent = b.theme.accent, muted = b.muted, tint = b.tint, text = b.theme.text286 b.adjust(StyleID.normal) { $0.para.spaceAfter = 7; $0.para.lineSpacing = .multiple(1.3); $0.para.hyphenate = true }287 b.adjust(StyleID.heading(1)) { $0.char.fontSize = 19; $0.char.color = text; $0.para.spaceBefore = 14; $0.para.spaceAfter = 3 }288 b.adjust(StyleID.heading(2)) { $0.char.fontSize = 13; $0.char.color = accent; $0.para.spaceBefore = 10; $0.para.spaceAfter = 2 }289 b.define("Masthead", t("Masthead", "Cartouche"), basedOn: StyleID.title, next: "IssueLine",290 char: CharProps(fontSize: 44, color: accent, tracking: -0.8), para: ParaProps(spaceAfter: 0))291 b.define("IssueLine", t("Issue Line", "Ligne de numéro"), next: StyleID.heading(1),292 char: CharProps(fontFamily: b.theme.headingFont, fontSize: 9.5, color: muted, tracking: 1, allCaps: true),293 para: ParaProps(spaceBefore: 4, spaceAfter: 14, tabs: [TabStop(position: w, kind: .right)], borderTop: BorderLine(width: 1.5, color: accent), borderBottom: b.hair))294 b.define("LeadHeadline", t("Lead Headline", "Titre de tête"), basedOn: StyleID.heading(1), next: "Standfirst", char: CharProps(fontSize: 28), para: ParaProps(spaceBefore: 4, spaceAfter: 4))295 b.define("Standfirst", t("Standfirst", "Chapeau"), next: "Byline", char: CharProps(fontSize: size + 2.5, color: muted), para: ParaProps(spaceAfter: 6, lineSpacing: .multiple(1.25), hyphenate: false))296 b.define("Byline", t("Byline", "Signature d'article"), next: StyleID.normal,297 char: CharProps(fontFamily: b.theme.headingFont, fontSize: 9, bold: true, color: muted, tracking: 0.8, allCaps: true), para: ParaProps(spaceAfter: 6, keepWithNext: true, hyphenate: false))298 b.define("Sidebar", t("Sidebar", "Encadré"), next: "Sidebar", char: CharProps(fontFamily: b.theme.headingFont, fontSize: size - 1.5),299 para: ParaProps(indentLeft: 8, indentRight: 8, spaceAfter: 0, lineSpacing: .multiple(1.3), keepLinesTogether: true, hyphenate: false, shading: tint))300 b.define("SidebarHeading", t("Sidebar Heading", "Titre d'encadré"), basedOn: "Sidebar", next: "Sidebar", char: CharProps(bold: true, color: accent, tracking: 0.8, allCaps: true),301 para: ParaProps(spaceBefore: 10, keepWithNext: true, borderTop: BorderLine(width: 2, color: accent)))302 b.define("PullQuote", t("Pull Quote", "Exergue"), basedOn: StyleID.quote, next: StyleID.normal, char: CharProps(fontSize: size + 4, color: accent),303 para: ParaProps(alignment: .left, indentLeft: 10, indentRight: 0, spaceBefore: 10, spaceAfter: 10, lineSpacing: .multiple(1.2), keepLinesTogether: true, hyphenate: false))304 b.define("Colophon", t("Colophon", "Bloc-générique"), next: "Colophon", char: CharProps(fontFamily: b.theme.headingFont, fontSize: 9, color: muted),305 para: ParaProps(alignment: .center, spaceBefore: 12, spaceAfter: 0, hyphenate: false, borderTop: b.hair))306307 let name = t("[Newsletter Name]", "[Nom de l'infolettre]")308 b.setup.differentFirstPage = true309 b.setup.header = HeaderFooter(default: [b.header([r(name), tab, tab, r(t.monthYear(c.date))])])310 b.setup.footer = HeaderFooter(default: [b.footer([r(b.organization), tab, tab, field(.pageNumber)])], first: [b.footer([r(b.organization), tab, tab, field(.pageNumber)])])311312 // Full-width opening: masthead and lead story.313 b.p("Masthead", name)314 b.p("IssueLine", [r(t("Volume [0], issue [0]", "Volume [0], numéro [0]") + " · " + b.organization), tab, r(b.dateText)])315 b.heading(1, t("[Headline of the Lead Story]", "[Titre de l'article de tête]"), style: "LeadHeadline")316 b.p("Standfirst", t("[A standfirst of one or two sentences that tells the reader why the story matters.]", "[Un chapeau d'une ou deux phrases qui dit au lecteur pourquoi l'article compte.]"))317318 // Two columns from here, on the same page.319 b.section(.continuous) { s in320 s.columns = 2321 s.columnGap = 22322 s.columnRule = true323 }324 b.p("Byline", [r(t("By ", "Par ")), b.authorRun])325 b.body(t("[Start with the most important fact: who, what, when, where.] Short paragraphs read better in narrow columns; aim for two or three sentences each.",326 "[Commencez par le fait le plus important : qui, quoi, quand, où.] Les paragraphes courts se lisent mieux dans des colonnes étroites ; visez deux ou trois phrases chacun."))327 b.body(t("[Add context and a quotation from a person involved.]", "[Ajoutez du contexte et une citation d'une personne concernée.]"))328 b.p("PullQuote", t("“[A striking sentence taken from the story.]”", "« [Une phrase marquante tirée de l'article.] »"))329 b.body(t("[Close with what happens next and where to learn more.]", "[Terminez par la suite des choses et l'endroit où en apprendre davantage.]"))330 b.figure(label: t("[Insert photo]", "[Insérer la photo]"),331 alt: t("Placeholder for a photo: replace this rectangle with your image and describe here who and what it shows.",332 "Espace réservé à une photo : remplacez ce rectangle par votre image et décrivez ici les personnes et la scène qu'elle montre."), height: 150, fraction: 1)333 b.caption(.figure, t("[Who is in the photo, where and when. Photo: [credit]]", "[Qui figure sur la photo, où et quand. Photo : [mention de source]]"))334335 b.heading(1, t("[Second Story]", "[Deuxième article]"))336 b.p("Byline", t("By [Name]", "Par [Nom]"))337 b.body(t("[A shorter story: a project, a portrait, a result.]", "[Un article plus court : un projet, un portrait, un résultat.]"))338 b.heading(2, t("[Subheading]", "[Intertitre]"))339 b.body(t("[Subheadings help readers scan a long story.]", "[Les intertitres aident à parcourir un long article.]"))340341 b.p("SidebarHeading", t("In brief", "En bref"))342 b.p("Sidebar", [strong(t("[Short item.] ", "[Brève.] ")), r(t("[Two sentences at most.]", "[Deux phrases au plus.]"))])343 b.p("Sidebar", [strong(t("[Short item.] ", "[Brève.] ")), r(t("[Two sentences at most.]", "[Deux phrases au plus.]"))], props: ParaProps(spaceAfter: 12))344345 b.heading(1, t("Coming Up", "À venir"))346 b.bullets([[strong(t("[Date]", "[Date]")), r(t(" – [Event, place, how to register]", " – [Activité, lieu, façon de s'inscrire]"))],347 [strong(t("[Date]", "[Date]")), r(t(" – [Event]", " – [Activité]"))],348 [strong(t("[Date]", "[Date]")), r(t(" – [Event]", " – [Activité]"))]])349350 // Back to one column for the closing block.351 b.section(.continuous) { s in352 s.columns = 1353 s.columnRule = false354 }355 b.p("Colophon", t("[Newsletter Name] is published [monthly] by ", "[Nom de l'infolettre] est publiée [chaque mois] par ") + b.organization356 + t(" · Editor: ", " · Rédaction : ") + b.author + t(" · [E-mail] · [How to subscribe or unsubscribe]", " · [Courriel] · [Façon de s'abonner ou de se désabonner]"))357 return b.build(title: name)358 }359}360