============================================== Splitting into multiple files - PD ============================================== For large documents or projects, it's often easier to split your templates into multiple files. These can be separate stylesheets, pages, components and the top level document. As a converions the files should have the following extensions. * Documents - [MyTemplate].html * Stylesheets - [MyStyles].css * Pages and content - [MyInnerContent].html It just makes life easier. 4 file example --------------- As an example we can split a single document into 4 files. Here we will take the top level document and reference a stylesheet, a page header component and a cover page. DocumentRefs.html ----------------- At the top level is the Document - `DocumentRefs.html` .. code-block:: html My multi file document

This is the second page

This contains a reference to `includeScreen.css` and `includePrint.css` in the `css` folder. As the first link is specified as for screen only it will not be loaded, and only the includePrint.css will be loaded. An embedded reference to a `PageHeader.html` in the `Fragments` folder for a standard document header, and a reference to a `CoverPage.html` in the `Fragments` folder for the cover page content. The path references are relative to the current document (but could be absolute urls) includePrint.css ----------------- This is the content of the `includePrint.css` .. code-block:: css .title{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight:bold; font-size:60pt; margin: 20pt; padding:10pt; text-align:center; } .page-head { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-weight: normal; font-size: 14pt; margin: 20pt 10pt 10pt 10pt; padding: 10pt; border-bottom:solid 1pt black; } This file declares 2 style classes that can be applied to any element with class names `title` and `page-head` For more info about styles see :doc:`document_styles` CoverPage.html --------------- This is the content of the `CoverPage.html`, which will be directly included in the content of the document, so should not start with the HTML of body tag, but go directly to the actual content used. As this is intended to be the first page, and always a page, the page-break-before and page-break-after have been switched. The namespace is important on includes, just as with top-level documents, the namespace is **critical** .. code-block:: html

Heading Page

.. note:: These are just samples and can be as complex as you like, but to be good xml it should still only have a single root. PageHeader.html ---------------- The component is referenced from link in the `DocumentRefs.pdfx`. This file is just used as the content for the header of the pages. .. code-block:: html
Referenced File Example
The content could be anything, but for this time we are using it as a standard header. It has 2 columns with a title on one side and then a date label on the other. Bringing it all together ------------------------- These are all the files, and we just need to generate them. All being well, then when we bring it together we will get a 2 page document with consistent headers and content. .. image:: images/referencefilesoutput.png The styles are used across all content even referenced files, and the layout flows just as you would expect. Circular references ------------------- Scryber will not allow circular references. i.e. files that reference either themselves, or other files that reference back to the original as it could create an infinie parsing loop. Whilst a file can be embedded from multiple places in multiple documents, each time it will be loaded as new content. Once loaded changes to one instance will not affect any other instances loaded from that file. iFrame support ---------------- Along with the embed option, scryber supports the use of iFrames with a src. .. code-block:: html