Skip to content

Commit

Permalink
Add option picturesRatio
Browse files Browse the repository at this point in the history
may address #103
  • Loading branch information
gturri committed Mar 23, 2020
1 parent 1c30a92 commit d0c6b6f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions optionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ static function checkNbColumns(&$match, &$varAffected){
}
}

static function checkPictureRatio(&$match, &$varAffected){
if(optionParser::preg_match_wrapper("pictures?Ratio *=? *\"?([[:digit:]]*)\"?", $match, $found)) {
if($found[1] != '') {
$varAffected = (int) $found[1];
if ($varAffected <= 0){
$varAffected = 0.01;
}
}
$match = optionParser::_removeFromMatch($found[0], $match);
}
}

static function checkNbItemsMax(&$match, &$varAffected){
if(optionParser::preg_match_wrapper("nb?Items?Max *=? *\"?([[:digit:]]*)\"?", $match, $found)) {
if($found[1] != '') {
Expand Down
3 changes: 2 additions & 1 deletion printers/printerPictures.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ function __construct($plugin, $mode, $renderer, $data){
parent::__construct($plugin, $mode, $renderer, $data);
$this->_displayModificationDate = $data['modificationDateOnPictures'];
$this->_defaultPicture = $data['defaultPicture'];
$this->_picturesRatio = $data['picturesRatio'];
}

function _print($tab, $type) {
$this->renderer->doc .= '<div class="nspagesPicturesModeMain">';
$dim = array('w'=>350, 'h'=>220);
$dim = array('w'=>350 * $this->_picturesRatio, 'h'=>220 * $this->_picturesRatio);
foreach($tab as $item) {
$picture = $this->_getFirstImage($item['id']);
$url = wl($item['id']);
Expand Down
2 changes: 2 additions & 0 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
optionParser::checkAnchorName($match, $return['anchorName']);
optionParser::checkActualTitle($match, $return['actualTitleLevel']);
optionParser::checkDefaultPicture($match, $return['defaultPicture'], $this);
optionParser::checkPictureRatio($match, $return['picturesRatio']);



Expand Down Expand Up @@ -112,6 +113,7 @@ private function _getDefaultOptions(){
'showhidden' => false, 'dictOrder' => false,
'modificationDateOnPictures' => false,
'sortByCreationDate' => false, 'defaultPicture' => null,
'picturesRatio' => 1,
);
}

Expand Down

0 comments on commit d0c6b6f

Please sign in to comment.