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

Remove 'template arguments' parameter #436

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ This is not a release yet.
* Raised minimum required version of PHP to 5.6
* Raised minimum required version of MediaWiki to 1.27
* Improved filtered format: More options, better test coverage, re-enabled by default (by Stephan Gambke)
* #248 Fixed localization of numbers in the math result formats (by James Hong Kong)
* [#248](https://github.com/SemanticMediaWiki/SemanticResultFormats/pull/248) Fixed localization of numbers in the math result formats (by James Hong Kong)
* [#365](https://github.com/SemanticMediaWiki/SemanticResultFormats/pull/365) Added support for the latest versions of the GraphViz extension
* [#375](https://github.com/SemanticMediaWiki/SemanticResultFormats/pull/375) Fixed exposing of file dimensions in captions for the "gallery" format
* Tree format: Removed `template arguments` parameter
* Added support for installation together with the latest versions of the Maps extension (by Jeroen De Dauw)
* Updated translations (by translatewiki.net community)

Expand Down
6 changes: 2 additions & 4 deletions formats/tree/TreeNodeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ protected function getParamNameForCell( $cell, $columnNumber ) {

$label = $cell->getPrintRequest()->getLabel();

if ( $this->configuration['template arguments'] === 'numbered' || ( $label === '' ) ) {
if ( $this->configuration[ 'named args' ] === true || ( $label === '' ) ) {
$paramName = $columnNumber + 1;
} elseif ( $this->configuration['template arguments'] === 'legacy' ) {
$paramName = '?' . $label;
} else { // $this->configuration[ 'template arguments' ] === 'named'
} else {
$paramName = $label;
}

Expand Down
23 changes: 5 additions & 18 deletions formats/tree/TreeResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ protected function postProcessParameters() {
// Don't support pagination in trees
$this->mSearchlabel = null;

if ( array_key_exists( 'template arguments', $this->params )
&& $this->params['template arguments'] !== 'numbered' ) {

if ( filter_var( $this->params['named args'], FILTER_VALIDATE_BOOLEAN ) === true ) {
$this->params['template arguments'] = 'legacy';
} elseif (
$this->params['template arguments'] !== 'named' &&
$this->params['template arguments'] !== 'legacy'
) {
// default
$this->params['template arguments'] = 'numbered';
}
}

// Allow "_" for encoding spaces, as documented
$this->params['sep'] = str_replace( '_', ' ', $this->params['sep'] );

Expand Down Expand Up @@ -177,6 +163,7 @@ public function getTemplateCall( $templateName, $params = [] ) {
* @param $definitions array of IParamDefinition
*
* @return array of IParamDefinition|array
* @throws Exception
*/
public function getParamDefinitions( array $definitions ) {
$params = parent::getParamDefinitions( $definitions );
Expand Down Expand Up @@ -290,11 +277,10 @@ public function getLinkerForColumn( $column ) {
private function initalizeStandardTemplateParameters() {

$query = $this->getQueryResult()->getQuery();
$userparam = trim( $this->params[ 'userparam' ] );

$this->standardTemplateParameters =
( trim( $this->params['userparam'] ) !== '' ? ( '|userparam=' . trim(
$this->params['userparam']
) ) : '' ) .
( $userparam !== '' ? ( '|userparam=' . $userparam ) : '' ) .
'|smw-resultquerycondition=' . $query->getQueryString() .
'|smw-resultquerylimit=' . $query->getLimit() .
'|smw-resultqueryoffset=' . $query->getOffset();
Expand All @@ -306,6 +292,7 @@ private function initalizeStandardTemplateParameters() {
* @param TreeNode[] $nodes
*
* @return TreeNode
* @throws \Exception
*/
protected function buildTreeFromNodeList( $rootHash, $nodes ) {

Expand Down Expand Up @@ -362,7 +349,7 @@ protected function buildLinesFromTree( $tree ) {
'format' => trim( $this->params['format'] ),
'template' => trim( $this->params['template'] ),
'headers' => $this->params['headers'],
'template arguments' => $this->params['template arguments'],
'named args' => $this->params['named args'],
'sep' => $this->params['sep'],
];

Expand Down