From e20b4d2ea7b65258477b92edc00a632c09903b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Thu, 28 May 2020 18:58:49 +0200 Subject: [PATCH] tag2link: when formatterURLs are duplicates, check if we can add operator name --- bin/tag2link-converter | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/tag2link-converter b/bin/tag2link-converter index f7ab18d6..2d3c26d5 100755 --- a/bin/tag2link-converter +++ b/bin/tag2link-converter @@ -12,9 +12,17 @@ foreach ($files as $file) { if (array_key_exists($key, $tag2link)) { // avoid duplicates - if (sizeof(array_filter($tag2link[$key]['formatter'], function ($e) use ($link) { + $duplicates = array_filter($tag2link[$key]['formatter'], function ($e) use ($link) { return $e['link'] === $link; - }))) { + }); + + if (sizeof($duplicates)) { + if (array_key_exists('operatorLabel', $entry)) { + foreach ($duplicates as $i => $d) { + $tag2link[$key]['formatter'][$i]['operator'] = $entry['operatorLabel']['value']; + } + } + continue; } }