fix more readme issues
This commit is contained in:
parent
9e47968a59
commit
14600caaff
@ -328,6 +328,7 @@ class Package extends ActiveRecord
|
|||||||
if ($text) {
|
if ($text) {
|
||||||
$this->readme = Git::getFile($this->url, $file);
|
$this->readme = Git::getFile($this->url, $file);
|
||||||
if ($this->readme) {
|
if ($this->readme) {
|
||||||
|
$this->readme_format = 'text';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -462,7 +463,7 @@ class Package extends ActiveRecord
|
|||||||
}
|
}
|
||||||
if ($this->readme_format == 'text') {
|
if ($this->readme_format == 'text') {
|
||||||
$readme = preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1">$1</a>', $this->readme);
|
$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 '';
|
return '';
|
||||||
|
@ -19,12 +19,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
<?= $model->getReadmeHtml() ?>
|
<?= $model->getReadmeHtml() ?>
|
||||||
<?php
|
<?php
|
||||||
if (!$model->readme) {
|
if (!$model->readme) {
|
||||||
|
echo '<h1>' . Html::encode($this->title) . '</h1>';
|
||||||
echo Alert::widget([
|
echo Alert::widget([
|
||||||
'options' => [
|
'options' => [
|
||||||
'class' => 'alert-danger',
|
'class' => 'alert-danger',
|
||||||
],
|
],
|
||||||
'closeButton' => false,
|
'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',
|
'class' => 'alert-info',
|
||||||
],
|
],
|
||||||
'closeButton' => false,
|
'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 } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user