Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ODT exporting tables #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eduardomozart
Copy link
Contributor

Fixes #272

@nerun
Copy link
Contributor

nerun commented Nov 28, 2023

It fails in 4 tests and you changed null to 0cm, maybe "null" works better.

@eduardomozart
Copy link
Contributor Author

It shouldn't be null because null isn't a valid CSS value for margin. In fact, if you see the lines 710-717, you'll see that for the problem you're facing (float is null), the code set the margins to 0cm. I just set it directly to 0cm to avoid code changes, but you're free to change the float detection and variable assignments if you will and commit a PR to the code.

$margin_right = $css_properties ['margin-right'];
$margin_bottom = $css_properties ['margin-bottom'];
$margin_left = $css_properties ['margin-left'];
$margin_top = $css_properties ['margin-top'] ?? '0cm';
Copy link
Contributor

Choose a reason for hiding this comment

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

0 does not really need a unit. So '0' instead of '0cm' would be fine (and shorter).

Copy link
Contributor Author

@eduardomozart eduardomozart Nov 28, 2023

Choose a reason for hiding this comment

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

I'm not sure, because it isn't exactly CSS, it uses ODT that uses a XML like syntax. If you do not specify the unit the ODT rendering on LibreOffice may fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok. I didn't realise that. I have no experience with ODT so I'll shut up now ;-)

@@ -692,7 +692,7 @@ function renderODTOpenTable ($renderer, $attr, $style, $attr_string) {
}
$frame_props ['min-height'] = '1cm';
$frame_props ['width'] = $attr ['width'];
$frame_props ['float'] = $css_properties ['float'];
$frame_props ['float'] = $css_properties ['float'] ?? null;
Copy link
Contributor

Choose a reason for hiding this comment

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

'none' might be better than null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't a CSS property, it's for PHP control only. On line https://github.com/selfthinker/dokuwiki_plugin_wrap/blob/master/helper.php#L709 PHP just checks if this value is null to proper set the margin and padding values to '0cm'.

@nerun
Copy link
Contributor

nerun commented Nov 28, 2023

Submited PR #275, but same errors, same tests.

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.

PHP 8+ warnings, "undefined array key", margins lines 671-4 and 695
3 participants