Improve addon readme display
- Add maintainer display support - Remove extra comma after author/maintainer lists
This commit is contained in:
parent
b158914c41
commit
17faeca241
|
@ -254,17 +254,17 @@ class Addon
|
|||
*
|
||||
* like
|
||||
* \code
|
||||
*...* Name: addon
|
||||
* * Name: addon
|
||||
* * Description: An addon which plugs in
|
||||
* . * Version: 1.2.3
|
||||
* * Author: John <profile url>
|
||||
* * Author: Jane <email>
|
||||
* * Maintainer: Jess <email>
|
||||
* *
|
||||
* *\endcode
|
||||
* @param string $addon the name of the addon
|
||||
* @return array with the addon information
|
||||
*/
|
||||
|
||||
public static function getInfo($addon)
|
||||
{
|
||||
$a = get_app();
|
||||
|
@ -273,6 +273,7 @@ class Addon
|
|||
'name' => $addon,
|
||||
'description' => "",
|
||||
'author' => [],
|
||||
'maintainer' => [],
|
||||
'version' => "",
|
||||
'status' => ""
|
||||
];
|
||||
|
@ -292,18 +293,18 @@ class Addon
|
|||
foreach ($ll as $l) {
|
||||
$l = trim($l, "\t\n\r */");
|
||||
if ($l != "") {
|
||||
list($k,$v) = array_map("trim", explode(":", $l, 2));
|
||||
$k= strtolower($k);
|
||||
if ($k == "author") {
|
||||
list($type, $v) = array_map("trim", explode(":", $l, 2));
|
||||
$type = strtolower($type);
|
||||
if ($type == "author" || $type == "maintainer") {
|
||||
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
|
||||
if ($r) {
|
||||
$info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];
|
||||
$info[$type][] = ['name' => $m[1], 'link' => $m[2]];
|
||||
} else {
|
||||
$info['author'][] = ['name'=>$v];
|
||||
$info[$type][] = ['name' => $v];
|
||||
}
|
||||
} else {
|
||||
if (array_key_exists($k, $info)) {
|
||||
$info[$k]=$v;
|
||||
if (array_key_exists($type, $info)) {
|
||||
$info[$type] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
<p>{{$info.description}}</p>
|
||||
|
||||
<p class="author">{{$str_author}}
|
||||
{{foreach $info.author as $a}}
|
||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
|
||||
{{foreach $info.author as $a name=authors}}
|
||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.authors.last}}{{else}}, {{/if}}
|
||||
{{/foreach}}
|
||||
</p>
|
||||
|
||||
<p class="maintainer">{{$str_maintainer}}
|
||||
{{foreach $info.maintainer as $a}}
|
||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}},
|
||||
{{foreach $info.maintainer as $a name=maintainers}}
|
||||
{{if $a.link}}<a href="{{$a.link}}">{{$a.name}}</a>{{else}}{{$a.name}}{{/if}}{{if $smarty.foreach.maintainers.last}}{{else}}, {{/if}}
|
||||
{{/foreach}}
|
||||
</p>
|
||||
|
||||
|
|
Loading…
Reference in a new issue