dokuwiki-plugin-dw2pdf
dokuwiki-plugin-dw2pdf copied to clipboard
Add older revisions to PDF
Hello,
is it possible to add the revision history of the page to the PDF export?
Thanks in advance!
No, that is not possible.
What is your purpose of adding the history to the export? Could you elaborate more on it?
I need some kind of record with the revision history of a page. I edited the sources of the PDF plugin to add a revision table at the end of a PDF export.
that is by using html_revisions()? And that works as expected? Or does it needs additional formatting?
I added the following code in the action.php:
// add history
if(file_exists($backfile)) {
$output['back'] = '<pagebreak />';
foreach($this->list as $pageid){
$changes[] = metaFN($pageid, '.changes');
$f_changes = $changes[0];
$changes = $this->changesToArray($f_changes);
$html = $this->changesToHTML($changes);
$output['back'] .= $html;
}
$output['back'] = $this->page_depend_replacements($output['back'], $ID);
}
where I get the change history from
metaFN($pageid, '.changes');
and then format it to HTML.
As I can recall, the html_revisions() sounded right but was not applicable for my problem...
Are you planning on adding the feature?
I'm looking for the pro and cons.
An idea could be to have @OLDREVISIONS@ placeholder, which can be used for example at the back.html or in citation.html of the PDF Template https://www.dokuwiki.org/plugin:dw2pdf:pdftemplate
~~In back.html if it exports one page, thenhtml_revisions() has to be called for only one page ($ID).
Otherwise it needs iteration over the $this->list.~~
In back.html the export with html_revisions() has to be iterated over the $this->list.
In citation.html it should only be called for the current page.
(maybe distinction by @OLDREVISIONS@ vs @OLDREVISIONS_ALLPAGES@)
Edit: or one @OLDREVISIONS@ which behaves different in back.html vs citation.html
In my opinion this would be a nice extension as many companies require some form of a revision history to trace the changes of a document. If you want I can provide my source code, but this is more of a hack than a clean implementation because my time was limited to make this work.
The check box to enable or disable the revision history could be added in the plugin options.
I don't intend to add a config option, because the admin first has to add the placeholder to his PDF template if he/she likes to use it.
The idea is now adding the placeholder @OLDREVISIONS@, which can be used in the template parts citation.html, cover.html and back.html. In the citation.html the placeholder is replaced by the html_revisions() of the previous page. In cover.html and back.html it is replaced by html_revisions() of all pages in $this->list.
Maybe I split html_revisions() in a part that build the revision list, and a part that add the headers, so that in dw2pdf only the list is displayed. My intention is to reuse as much as possible, and therefore simplifying maintenance in the future.
Hello, is the anything new to adding the revision history of the page to the PDF export? We would like to print the last modifikation (date and description) and the corresponding user into the PDF. Would it be possoble to add replacements like @user@ and @last_mod_descr@ for that, so that we can include it in p.e. citation.html? We use dokuwiki for internal dokumentation of quality management, and therefore the name and decription of the last modification (-or) ist needed in the PDF files.
Thank you for the good work!