Skip to content

Conversation

@moka-dev
Copy link

…eator)

adds support for setting specific headers and footers for each logical DokuWiki page by using named @page styles and corresponding blocks. Each page is wrapped in a
with a matching @page pageX CSS rule that defines the appropriate header and footer names.

All named headers and footers are defined before to start html.

also adjusted how pagebreak are handled, because mPDF automatically inserts a page break before any new div with a different page style.

…eator)

adds support for setting specific headers and footers for each logical DokuWiki page by using named @page styles and corresponding
blocks. Each page is wrapped in a
with a matching @page pageX CSS rule that defines the appropriate header and footer names.

All named headers and footers are defined before to start html.

also adjusted how pagebreak are handled, because mPDF automatically inserts a page break before any new div with a different page style.
    Implement support for header_ and footer_ templates specific to:

        Back page: header_last.html, footer_last.html

        Table of contents (TOC): header_toc.html, footer_toc.html

        Multi pages, ns and bookcreator(useful for white pages between cover, TOC, and first page): header_book.html, footer_book.html
Copy link
Owner

@splitbrain splitbrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on a bunch of stuff, however...

I would not merge this as is. It makes an already messy and complex file more messy and complex. That is not fully your fault, this class needs some serious refactoring on it's own, but your code would make that even harder.

I am also not sure about the intend behind this PR. Do you really want create templates for individual pages? Or wouldn't you rather assign a certain template to a whole group of pages (eg. identified by namespace, or maybe some kind of meta data)?

I feel like this is an implementation that allowed you to address an issue you had but the same issue could have been maybe addressed in a more general and better way.

Unfortunately the actual issue you're trying to solve is not well explained in the PR.

/** @var bool|string path to temporary cachefile */
/**
* @var bool|string path to temporary cachefile
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why reformatting these to multiline?

public function __construct()
{
require_once __DIR__ . '/vendor/autoload.php';
include_once __DIR__ . '/vendor/autoload.php';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing from require_once to include_once?

BTW. requiring vendor/autoload.php should no longer be necessary for recent DokuWiki releases.

}
return true;
});
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, these lines only seem to do reformatting? I am not opposed to it, but having it as a separate PR would make reviewing a bit easier.

/** @deprecated April 2016 replaced by localStorage version of Bookcreator */
/**
* @deprecated April 2016 replaced by localStorage version of Bookcreator
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation broken.

/** @var action_plugin_bookcreator_handleselection $SelectionHandling */
/**
* @var action_plugin_bookcreator_handleselection $SelectionHandling
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation broken

$output['back'] = '<pagebreak />';
$output['back'] .= file_get_contents($backfile);
$output['back'] = str_replace(array_keys($replace), array_values($replace), $output['back']);
$output['back'] = file_get_contents($backfile);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pagebreak got removed!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I guess this is what you meant by a div with a new page style adds a pagebreak automatically?

$html = str_replace(array_keys($replace), array_values($replace), $raw);

return $html;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! I like that this moved into it's own method. It's missing a doc block though.

//reuse the CSS dispatcher functions without triggering the main function
define('SIMPLE_TEST', 1);
require_once(DOKU_INC . 'lib/exe/css.php');
include_once DOKU_INC . 'lib/exe/css.php';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include vs. require

$this->cssPluginPDFstyles(),
[
DOKU_PLUGIN . 'dw2pdf/conf/style.css' => DOKU_BASE . 'lib/plugins/dw2pdf/conf/',
DOKU_PLUGIN . '$dw2pdf/conf/style.css' => DOKU_BASE . 'lib/plugins/dw2pdf/conf/',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stray $ seems wrong

/** @var helper_plugin_translation $trans */
/**
* @var helper_plugin_translation $trans
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants