New contrib repository for document export tools macros

Hello everyone,

I plan to develop a set of macros dedicated for export and printing.
The idea is that theses macros will impact the page rendering when we do a PDF, ODF or RTF export.
One macro by example would be to show some content only when we render the page for PDF export. This could be useful when we would like to show some content only when it’s exported.
We could also need to hide some content on export because it don’t make sens on the exported content.

In the more advanced usage we could also imagine to have macro which add an explicit page break at some place on the exported content.

An other feature that I might need, but I’m not sure if it’s easy to implement would be to have a macro which give the possibility to override the title of the exported document. Maybe @mflorea do you have any idea how it’s complicated to do this for PDF export ?

Note this previous ideas is not an exhaustive list of the feature for this set of macros, this is something that could be extended in long term.

Here are an example of what I would like to implement:

{{export-ignore}}
my content which will be hidden on the export...
{{/export-ignore}}

{{export-only}}
my content which will be shown only on the export...
{{/export-only}}

{{export-pagetitle}}
My title of the PDF Header
{{/export-pagetitle}}

{{export-pagebreak /}}

my content on new page...

About the contrib repository name I propose to name it to something like export-control-macros-pack or export-control-pack. WDYT ?

Best regards

Josué

Why not just export-control ?
With a export-control-macro sub-module. See https://contrib.xwiki.org/xwiki/bin/view/Main/WebHome#HChoosingthename
It would make it easier to introduce new modules, such as export-control-ui if you need an admin page someday for instance.

1 Like

Thanks,

Yes it’s good idea export-control. Yes the idea was to make a submodule dedicated for the macros, so we can add some other components in the same project.

Following this discussion, it seem that export-control has an existing meaning (see Export control - Wikipedia), so the proposal would by to name the project export-tools instead of export-control.

Note I also need a Jira project for this repository. For the jira project name I propose to use EXTOOLS or EXPORTTOOLS.

Github and Jira projects created:

Hi @Josue,

WDYM by “title of the exported document”? The title displayed on the cover page? This is controlled by the PDF template. See xwiki-platform/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-ui/src/main/resources/XWiki/PDFExport/Template.xml at master · xwiki/xwiki-platform · GitHub . You can create a custom PDF template that takes the title from a xobject of the exported document, or from a specific macro call found in the content of the exported document. Whatever you need. Ping me when you start working on this and we can discuss.

Thanks,
Marius

Hello,

Thank you @mflorea for the explanation. Yes I mean the title displayed on the cover page. I’ll investigate about this with the link that you provided and comme back to you if need.