fix more readme issues
This commit is contained in:
parent
9e47968a59
commit
14600caaff
@ -328,6 +328,7 @@ class Package extends ActiveRecord
|
||||
if ($text) {
|
||||
$this->readme = Git::getFile($this->url, $file);
|
||||
if ($this->readme) {
|
||||
$this->readme_format = 'text';
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -462,7 +463,7 @@ class Package extends ActiveRecord
|
||||
}
|
||||
if ($this->readme_format == 'text') {
|
||||
$readme = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1">$1</a>', $this->readme);
|
||||
return '<pre class="readme">' . $readme . '</pre>';
|
||||
return '<h1>' . $this->name . '</h1><pre class="readme">' . $readme . '</pre>';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
|
@ -19,12 +19,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<?= $model->getReadmeHtml() ?>
|
||||
<?php
|
||||
if (!$model->readme) {
|
||||
echo '<h1>' . Html::encode($this->title) . '</h1>';
|
||||
echo Alert::widget([
|
||||
'options' => [
|
||||
'class' => 'alert-danger',
|
||||
],
|
||||
'closeButton' => false,
|
||||
'body' => 'This mod has no readme. If you are the owner please consider adding one to the <a href="' . Git::getUrl($model->url) . '">repository</a>.',
|
||||
'body' => 'This mod has no <code>README.md</code> or <code>README.txt</code> file. If you are the owner please consider adding one to the <a href="' . Git::getUrl($model->url) . '">repository</a>.',
|
||||
]);
|
||||
}
|
||||
?>
|
||||
@ -78,7 +79,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'class' => 'alert-info',
|
||||
],
|
||||
'closeButton' => false,
|
||||
'body' => 'This mod has no valid bower.json file. If you are the owner please consider adding one to the repository, then click Update.',
|
||||
'body' => 'This mod has no valid <code>bower.json</code> file. If you are the owner please consider adding one to the repository, then click Update.',
|
||||
]); ?>
|
||||
<?php } ?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user