1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-10-23 19:06:05 +02:00

Converted chapters to markdown and changed pages to vertical layout

This commit is contained in:
Andrew Davis
2019-01-02 20:12:35 -06:00
parent 0c17549268
commit cbd3c539bb
56 changed files with 1305 additions and 1060 deletions

View File

@@ -30,7 +30,9 @@ class BuildTest extends BaseTestCase
$html = file_get_contents('/tmp/apprentice_output/test.html');
$expectedHtml = "<div>Test Title</div>\n" .
"<div>Test Subtitle</div>\n" .
"<div>Test Description</div>\n";
"<div>Test Description</div>\n" .
"<div>&lt;p&gt;Test comment&lt;/p&gt;\n" .
"&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;\$test = &#039;test&#039;;&lt;/code&gt;&lt;/pre&gt;</div>\n";
$this->assertFalse(empty($html));
$this->assertEquals($expectedHtml, $html);
@@ -44,7 +46,9 @@ class BuildTest extends BaseTestCase
$expectedHtml = "<div>Test Title</div>\n" .
"<div>Test Subtitle</div>\n" .
"<div>Test Description</div>\n";
"<div>Test Description</div>\n" .
"<div>&lt;p&gt;Test comment&lt;/p&gt;\n" .
"&lt;pre&gt;&lt;code class=&quot;language-php&quot;&gt;\$test = &#039;test&#039;;&lt;/code&gt;&lt;/pre&gt;</div>\n";
$expectedHtml2 = "<div>index</div>\n";
$html = file_get_contents('/tmp/apprentice_output/test.html');

View File

@@ -50,17 +50,6 @@ class FunctionsTest extends BaseTestCase
$this->assertEquals("<test></test>\n", $icon);
}
public function test_code_table()
{
$php = file_get_contents(__DIR__ . '/static/code_table.php');
$expectedOutput = file_get_contents(__DIR__ . '/static/code_table.html');
$html = code_table($php);
$this->assertFalse(empty($html));
$this->assertEquals($expectedOutput, $html . "\n");
}
public function test_partial()
{
partial('partial', ['test' => 'test var']);

View File

@@ -0,0 +1,4 @@
Test comment
```php
$test = 'test';
```

View File

@@ -1,4 +0,0 @@
<?php
// test comment
$test = 'test';

View File

@@ -1,4 +0,0 @@
<div class="grid-code"><div class="doc"></div><div class="code"><pre><code class="language-php">&lt;?php
</code></pre></div><div class="doc">this is a test</div><div class="code"><pre><code class="language-php">$test = 'some test code';
</code></pre></div></div>

View File

@@ -1,4 +0,0 @@
<?php
// this is a test
$test = 'some test code';

View File

@@ -4,13 +4,13 @@ use Apprentice\Page;
return [
'icon_dir' => __DIR__ . '/../icons',
'code_dir' => __DIR__ . '/code',
'chapter_dir' => __DIR__ . '/chapter',
'templates_dir' => __DIR__ . '/templates',
'output_dir' => '/tmp/apprentice_output',
'files_dir' => __DIR__ . '/files',
'pages' => [
Page::create('index', 'index.phtml'),
Page::create('test', null, 'test.php', [
Page::create('test', null, 'test.md', [
'title' => 'Test Title',
'subtitle' => 'Test Subtitle',
'description' => 'Test Description',

View File

@@ -1,3 +1,4 @@
<div><?= escape($title) ?></div>
<div><?= escape($subtitle) ?></div>
<div><?= escape($description) ?></div>
<div><?= escape($chapter) ?></div>