Skip to content

Rename HydeSmartDocs to SemanticDocumentationArticle #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This serves two purposes:
- for new features.

### Changed
- for changes in existing functionality.
- Renamed HydeSmartDocs.php to SemanticDocumentationArticle.php

### Deprecated
- for soon-to-be removed features.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@props([
/** @var \Hyde\Framework\Services\HydeSmartDocs */
/** @var \Hyde\Framework\Services\SemanticDocumentationArticle */
'document'
])

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/docs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@include('hyde::components.docs.sidebar')

<main id="content" class="dark:bg-gray-900 min-h-screen bg-gray-50 md:bg-white absolute top-16 md:top-0 w-screen md:left-64 md:w-[calc(100vw_-_16rem)]">
<x-hyde::docs.documentation-article :document="\Hyde\Framework\Services\HydeSmartDocs::create($page, $markdown)"/>
<x-hyde::docs.documentation-article :document="\Hyde\Framework\Services\SemanticDocumentationArticle::create($page, $markdown)"/>
</main>

<div id="support">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @see \Hyde\Framework\Testing\Feature\Services\HydeSmartDocsTest
*/
class HydeSmartDocs
class SemanticDocumentationArticle
{
protected DocumentationPage $page;
protected string $html;
Expand Down Expand Up @@ -113,7 +113,7 @@ protected function renderSourceLink(): string
}

/**
* Create a new HydeSmartDocs instance, process, and return it.
* Create a new SemanticDocumentationArticle instance, process, and return it.
*
* @param \Hyde\Framework\Models\Pages\DocumentationPage $page The source page object
* @param string $html compiled HTML content
Expand Down
32 changes: 16 additions & 16 deletions packages/framework/tests/Feature/Services/HydeSmartDocsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use Hyde\Framework\Hyde;
use Hyde\Framework\Models\Markdown;
use Hyde\Framework\Models\Pages\DocumentationPage;
use Hyde\Framework\Services\HydeSmartDocs;
use Hyde\Framework\Services\SemanticDocumentationArticle;
use Hyde\Testing\TestCase;

/**
* @covers \Hyde\Framework\Services\HydeSmartDocs
* @covers \Hyde\Framework\Services\SemanticDocumentationArticle
*/
class HydeSmartDocsTest extends TestCase
{
Expand Down Expand Up @@ -58,17 +58,17 @@ protected function mockTorchlight(): void

public function test_create_helper_creates_new_instance_and_processes_it()
{
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertInstanceOf(HydeSmartDocs::class, $page);
$this->assertInstanceOf(SemanticDocumentationArticle::class, $page);

$this->assertEqualsIgnoringNewlines('<p>Hello world.</p>', $page->renderBody());
}

public function test_instance_can_be_constructed_directly_with_same_result_as_facade()
{
$class = new HydeSmartDocs($this->mock, $this->html);
$facade = HydeSmartDocs::create($this->mock, $this->html);
$class = new SemanticDocumentationArticle($this->mock, $this->html);
$facade = SemanticDocumentationArticle::create($this->mock, $this->html);

// Baseline since we manually need to call the process method
$this->assertNotEquals($class, $facade);
Expand All @@ -81,7 +81,7 @@ public function test_instance_can_be_constructed_directly_with_same_result_as_fa

public function test_render_header_returns_the_extracted_header()
{
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlines('<h1>Foo</h1>', $page->renderHeader());
}
Expand All @@ -95,14 +95,14 @@ public function test_render_header_returns_the_extracted_header_with_varying_new
];

foreach ($tests as $test) {
$page = HydeSmartDocs::create($this->mock, Markdown::render($test));
$page = SemanticDocumentationArticle::create($this->mock, Markdown::render($test));
$this->assertEqualsIgnoringNewlines('<h1>Foo</h1>', $page->renderHeader());
}
}

public function test_render_body_returns_the_extracted_body()
{
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlines('<p>Hello world.</p>', $page->renderBody());
}
Expand All @@ -116,14 +116,14 @@ public function test_render_body_returns_the_extracted_body_with_varying_newline
];

foreach ($tests as $test) {
$page = HydeSmartDocs::create($this->mock, Markdown::render($test));
$page = SemanticDocumentationArticle::create($this->mock, Markdown::render($test));
$this->assertEqualsIgnoringNewlines('<p>Hello world.</p>', $page->renderBody());
}
}

public function test_render_footer_is_empty_by_default()
{
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlines('', $page->renderFooter());
}
Expand All @@ -132,7 +132,7 @@ public function test_add_dynamic_header_content_adds_source_link_when_conditions
{
config(['docs.source_file_location_base' => 'https://example.com/']);
config(['docs.edit_source_link_position' => 'header']);
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlinesAndIndentation('<h1>Foo</h1><p class="edit-page-link"><a href="https://example.com/foo.md">Edit Source</a></p>', $page->renderHeader());
}
Expand All @@ -141,7 +141,7 @@ public function test_edit_source_link_is_added_to_footer_when_conditions_are_met
{
config(['docs.source_file_location_base' => 'https://example.com/']);
config(['docs.edit_source_link_position' => 'footer']);
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlinesAndIndentation('<p class="edit-page-link"><a href="https://example.com/foo.md">Edit Source</a></p>', $page->renderFooter());
}
Expand All @@ -150,7 +150,7 @@ public function test_edit_source_link_can_be_added_to_both_header_and_footer()
{
config(['docs.source_file_location_base' => 'https://example.com/']);
config(['docs.edit_source_link_position' => 'both']);
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlinesAndIndentation('<h1>Foo</h1><p class="edit-page-link"><a href="https://example.com/foo.md">Edit Source</a></p>', $page->renderHeader());
$this->assertEqualsIgnoringNewlinesAndIndentation('<p class="edit-page-link"><a href="https://example.com/foo.md">Edit Source</a></p>', $page->renderFooter());
Expand All @@ -161,7 +161,7 @@ public function test_edit_source_link_text_can_be_customized()
config(['docs.source_file_location_base' => 'https://example.com/']);
config(['docs.edit_source_link_position' => 'both']);
config(['docs.edit_source_link_text' => 'Go to Source']);
$page = HydeSmartDocs::create($this->mock, $this->html);
$page = SemanticDocumentationArticle::create($this->mock, $this->html);

$this->assertEqualsIgnoringNewlinesAndIndentation('<h1>Foo</h1><p class="edit-page-link"><a href="https://example.com/foo.md">Go to Source</a></p>', $page->renderHeader());
$this->assertEqualsIgnoringNewlinesAndIndentation('<p class="edit-page-link"><a href="https://example.com/foo.md">Go to Source</a></p>', $page->renderFooter());
Expand All @@ -170,7 +170,7 @@ public function test_edit_source_link_text_can_be_customized()
public function test_add_dynamic_footer_content_adds_torchlight_attribution_when_conditions_are_met()
{
$this->mockTorchlight();
$page = HydeSmartDocs::create($this->mock, 'Syntax highlighted by torchlight.dev');
$page = SemanticDocumentationArticle::create($this->mock, 'Syntax highlighted by torchlight.dev');

$this->assertStringContainsString('Syntax highlighting by <a href="https://torchlight.dev/"', $page->renderFooter());
}
Expand Down