Commit def7b3a5 authored by Tobias Munk's avatar Tobias Munk

updated docs application

parent b789bb65
{
"plugins": [
"remark-preset-lint-recommended",
"remark-lint-blank-lines-1-0-2"
]
}
\ No newline at end of file
make bash
$ composer install --no-dev
\ No newline at end of file
{
"name": "dmstr/phd5-template",
"minimum-stability": "stable",
"require": {
"wikimedia/composer-merge-plugin": "~1.4"
},
"extra": {
"merge-plugin": {
"require": [
"/app/composer.phd5.json"
]
}
},
"config": {
"preferred-install": {
"dmstr/*": "source",
"hrzg/*": "source",
"schmunk42/*": "source",
"*": "auto"
},
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
},
"vcs-driver-options": {
"github-no-api": true
},
"git-skip-update": "2 days",
"pattern-skip-version": "(-build|-patch)",
"optimize-with-installed-packages": false
}
}
}
This diff is collapsed.
<?php
use schmunk42\markdocs\commands\DocsController;
use yii\base\Event;
Event::on(
'\yii\web\View',
'afterRender',
// TOOD: hotfixes for markdown images
function ($event) {
$event->output = str_replace('src="file:///phd5-docs/help',
'style="width: 100%" src="/img/stream/help',
$event->output);
$event->output = str_replace('.jpg"', '.jpg,p"', $event->output);
$event->output = str_replace('.png"', '.png,p"', $event->output);
});
return [
'aliases' => [
'schmunk42/markdocs/commands' => __DIR__.'/../src/modules/docs/commands'
],
'controllerMap' => [
'markdocs' => DocsController::class,
],
'components' => [
'fsLocal' => [
'class' => 'creocoder\flysystem\LocalFilesystem',
'path' => '/phd5-docs',
],
],
'modules' => [
'guide' => [
'class' => 'schmunk42\markdocs\Module',
#'layout' => '@backend/views/layouts/box',
'enableEmojis' => true,
'enableMermaid' => true,
'markdownUrl' => 'file:///docs-phd5/guide',
'markdownUrl' => 'file:///phd5-docs/guide',
'defaultIndexFile' => 'index.md',
],
'help' => [
......@@ -15,7 +42,7 @@ return [
#'layout' => '@backend/views/layouts/box',
'enableEmojis' => true,
'enableMermaid' => true,
'markdownUrl' => 'file:///docs-phd5/help',
'markdownUrl' => 'file:///phd5-docs/help',
'defaultIndexFile' => 'index.md',
],
'cookbook' => [
......
{
"name": "phd5-docs",
"version": "1.0.0",
"description": "make bash",
"main": "index.js",
"dependencies": {
"remark-cli": "^4.0.0",
"remark-lint-blank-lines-1-0-2": "^2.0.0",
"remark-lint-code": "^2.0.0",
"remark-preset-lint-recommended": "^3.0.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint-md": "remark -r ./.remarkrc"
},
"author": "",
"license": "ISC"
}
<?php
/**
* @link http://www.diemeisterei.de/
* @copyright Copyright (c) 2017 diemeisterei GmbH, Stuttgart
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace schmunk42\markdocs\commands;
use yii\console\Controller;
use yii\helpers\FileHelper;
use yii\helpers\Markdown;
class DocsController extends Controller
{
private $_basePath;
private $_toc;
public function actionIndex($path)
{
$this->_basePath = \Yii::getAlias($path);
$this->stdout('Docs'.PHP_EOL);
$tocLinks = $this->parseToc();
$files = FileHelper::findFiles($path, ['only' => ['*.md']]);
foreach ($files AS $file) {
#\Yii::trace("Processing {$file}...");
$this->stdout("Processing {$file}...".PHP_EOL);
$links[] = str_replace($path, '', $file);
}
#var_dump($links, $tocLinks);
$notInToc = array_diff($links, $tocLinks);
$brokenLinks = array_diff($tocLinks, $links);
var_dump($notInToc, $brokenLinks);
}
private function markdownFileAsDomDocument($file)
{
$html = Markdown::process(file_get_contents($file));
if (!$html) {
$this->stdout("EMPTY!");
return false;
}
$doc = new \DOMDocument();
libxml_use_internal_errors(true);
$doc->strictErrorChecking = false;
$doc->loadHtml($html);
echo $html;
return $doc;
}
private function getMarkdownFiles()
{
}
private function parseToc($tocFile = 'README.md')
{
echo $this->_basePath.'/'.$tocFile;
$xpath = new \DOMXPath($this->markdownFileAsDomDocument($this->_basePath.'/'.$tocFile));
$list = $xpath->query('//a');
foreach ($list AS $element) {
$links[] = $element->getAttribute('href');
}
return $links;
}
}
\ No newline at end of file
.app/node_modules
.app/vendor
npm-debug.log
{
"name": "dmstr/phd5-docs",
"description": "Documentation for phd5",
"type": "library",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Tobias Munk",
"email": "tobias@diemeisterei.de"
}
],
"require": {}
}
version: '2'
services:
php:
image: dmstr/phd5-app:5.1.0-rc1
image: dmstr/phd5-app:5.1.0-rc2
working_dir: /phd5-docs/.app
ports:
- 17200:80
depends_on:
......@@ -12,13 +13,16 @@ services:
- DB_ENV_MYSQL_PASSWORD=ENTER_A_STRONG_RANDOM_PASSWORD_HERE
- DB_ENV_MYSQL_USER=phd
- DB_ENV_MYSQL_DATABASE=docs
- APP_TITLE=phd5 docs
- APP_CONFIG_FILE=/docs-phd5/.app/config/docs.php
#- APP_TITLE=phd5 docs
- APP_CONFIG_FILE=/phd5-docs/.app/config/docs.php
- APP_ADMIN_EMAIL=docs@phd5.local
- APP_ADMIN_PASSWORD=admin1
- APP_MAILER_USE_FILE_TRANSPORT=1
- COMPOSER_VENDOR_DIR=/phd5-docs/.app/vendor
volumes:
- ./:/docs-phd5
# Re-use local composer cache via host-volume
- ~/.composer-docker/cache:/root/.composer/cache:delegated
- ./:/phd5-docs
redis:
image: redis:3
db:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment