generated from 8fold/github-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from 8fold/description-meta
feature: Markdown can generate description
- Loading branch information
Showing
9 changed files
with
155 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use JoshBruce\Site\Content\Markdown; | ||
|
||
use JoshBruce\Site\File; | ||
use JoshBruce\Site\Tests\TestFileSystem; | ||
|
||
it('can get description from front matter', function() { | ||
$fileSystem = TestFileSystem::init(); | ||
$publicRoot = $fileSystem->publicRoot(); | ||
|
||
// description field | ||
$file = File::at($publicRoot . '/content.md', $fileSystem); | ||
expect( | ||
Markdown::for($file, $fileSystem)->description() | ||
)->toBe( | ||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce felis arcu, molestie nec imperdiet eu, tristique ut elit. Curabitur "iaculis" sodales turpis a pellentesque's. In ac nibh ex." | ||
); | ||
|
||
// derived description from content, short | ||
$file = File::at($publicRoot . '/published-sub/content.md', $fileSystem); | ||
expect( | ||
Markdown::for($file, $fileSystem)->description() | ||
)->toBe( | ||
"Short sentence. Something a little bit longer. Third sentence." | ||
); | ||
|
||
// derived description from content, long | ||
$file = File::at($publicRoot . '/published-sub/published-sub-sub/content.md', $fileSystem); | ||
expect( | ||
Markdown::for($file, $fileSystem)->description() | ||
)->toBe( | ||
"Short sentence. Something a little bit longer. Third sentence. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce felis arcu, molestie nec imperdiet eu, tristique ut elit." | ||
); | ||
})->group('markdown'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
--- | ||
title: Test content root | ||
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce felis arcu, molestie nec imperdiet eu, tristique ut elit. Curabitur "iaculis" sodales turpis a pellentesque's. In ac nibh ex. Maecenas ornare in nisi ut commodo. Etiam consequat aliquam erat. Quisque varius mattis risus, consequat viverra eros scelerisque in. Nulla faucibus porta libero a sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis finibus placerat ante faucibus hendrerit. Phasellus condimentum nisi sed velit pretium, at feugiat quam convallis. | ||
--- | ||
|
||
# Heading in the way | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce felis arcu, molestie nec imperdiet eu, tristique ut elit. Curabitur iaculis sodales turpis a pellentesque. In ac nibh ex. Maecenas ornare in nisi ut commodo. Etiam consequat aliquam erat. Quisque varius mattis risus, consequat viverra eros scelerisque in. Nulla faucibus porta libero a sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis finibus placerat ante faucibus hendrerit. Phasellus condimentum nisi sed velit pretium, at feugiat quam convallis. | ||
|
||
Nunc sed felis a lacus convallis porttitor ut eu nulla. Morbi ac neque elit. Cras sit amet hendrerit purus. Nullam in nisi sem. Phasellus sodales condimentum velit, eget tempus urna scelerisque ullamcorper. Curabitur viverra velit sem, vel finibus justo porttitor ultricies. Ut arcu turpis, convallis at efficitur eget, aliquet sit amet dolor. Vestibulum ut sem nec purus imperdiet finibus. Vestibulum auctor tortor a lacinia faucibus. Nulla sagittis fringilla tincidunt. Fusce suscipit et diam et porta. Mauris felis justo, aliquam et neque eget, aliquet venenatis risus. Maecenas erat arcu, semper vitae massa sit amet, facilisis vulputate diam. Praesent lacinia pulvinar vestibulum. Nullam tristique augue magna, vel fermentum mauris malesuada nec. Aenean molestie odio sodales ante molestie pharetra. | ||
|
||
Phasellus sit amet mi vitae turpis tristique luctus. Ut pellentesque mattis nisl, rutrum accumsan mi placerat ac. Vivamus nunc ligula, malesuada non lacinia in, accumsan id sem. Proin tempus ac lacus a pulvinar. Nunc laoreet maximus sem nec scelerisque. Maecenas sem erat, faucibus non arcu sed, accumsan vehicula sapien. Nullam ipsum lorem, bibendum non arcu convallis, fringilla interdum lacus. | ||
|
||
Vivamus elementum elit at lectus dignissim, in commodo sem convallis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vivamus venenatis non ante quis ullamcorper. In facilisis ultricies tempus. Proin mollis sagittis condimentum. Vestibulum ornare pretium pellentesque. In dictum sodales felis ut ornare. | ||
|
||
Fusce nec ullamcorper magna, ac pretium quam. Integer elementum tincidunt ligula eget tristique. Vivamus orci neque, finibus ultricies vulputate eget, rutrum at velit. Vestibulum at nisi ac est vehicula luctus vitae id mauris. Nam tempor egestas justo, a consectetur purus porta non. Curabitur suscipit odio eu enim fringilla, non elementum dui luctus. Sed nec feugiat libero. Mauris luctus nulla ornare, dignissim nulla id, rutrum nunc. |
12 changes: 12 additions & 0 deletions
12
tests/test-content/content/public/published-sub/content.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
--- | ||
title: Sub-folder content title | ||
--- | ||
|
||
# Heading in the way | ||
|
||
Short sentence. | ||
|
||
## Heading in the way | ||
|
||
Something a little bit longer. | ||
|
||
### Heading the way | ||
|
||
Third sentence. |
27 changes: 27 additions & 0 deletions
27
tests/test-content/content/public/published-sub/published-sub-sub/content.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Sub-folder content title | ||
--- | ||
|
||
# Heading in the way | ||
|
||
Short sentence. | ||
|
||
## Heading in the way | ||
|
||
Something a little bit longer. | ||
|
||
### Heading the way | ||
|
||
Third sentence. | ||
|
||
## Heading in the way | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce felis arcu, molestie nec imperdiet eu, tristique ut elit. Curabitur iaculis sodales turpis a pellentesque. In ac nibh ex. Maecenas ornare in nisi ut commodo. Etiam consequat aliquam erat. Quisque varius mattis risus, consequat viverra eros scelerisque in. Nulla faucibus porta libero a sollicitudin. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis finibus placerat ante faucibus hendrerit. Phasellus condimentum nisi sed velit pretium, at feugiat quam convallis. | ||
|
||
Nunc sed felis a lacus convallis porttitor ut eu nulla. Morbi ac neque elit. Cras sit amet hendrerit purus. Nullam in nisi sem. Phasellus sodales condimentum velit, eget tempus urna scelerisque ullamcorper. Curabitur viverra velit sem, vel finibus justo porttitor ultricies. Ut arcu turpis, convallis at efficitur eget, aliquet sit amet dolor. Vestibulum ut sem nec purus imperdiet finibus. Vestibulum auctor tortor a lacinia faucibus. Nulla sagittis fringilla tincidunt. Fusce suscipit et diam et porta. Mauris felis justo, aliquam et neque eget, aliquet venenatis risus. Maecenas erat arcu, semper vitae massa sit amet, facilisis vulputate diam. Praesent lacinia pulvinar vestibulum. Nullam tristique augue magna, vel fermentum mauris malesuada nec. Aenean molestie odio sodales ante molestie pharetra. | ||
|
||
Phasellus sit amet mi vitae turpis tristique luctus. Ut pellentesque mattis nisl, rutrum accumsan mi placerat ac. Vivamus nunc ligula, malesuada non lacinia in, accumsan id sem. Proin tempus ac lacus a pulvinar. Nunc laoreet maximus sem nec scelerisque. Maecenas sem erat, faucibus non arcu sed, accumsan vehicula sapien. Nullam ipsum lorem, bibendum non arcu convallis, fringilla interdum lacus. | ||
|
||
Vivamus elementum elit at lectus dignissim, in commodo sem convallis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Vivamus venenatis non ante quis ullamcorper. In facilisis ultricies tempus. Proin mollis sagittis condimentum. Vestibulum ornare pretium pellentesque. In dictum sodales felis ut ornare. | ||
|
||
Fusce nec ullamcorper magna, ac pretium quam. Integer elementum tincidunt ligula eget tristique. Vivamus orci neque, finibus ultricies vulputate eget, rutrum at velit. Vestibulum at nisi ac est vehicula luctus vitae id mauris. Nam tempor egestas justo, a consectetur purus porta non. Curabitur suscipit odio eu enim fringilla, non elementum dui luctus. Sed nec feugiat libero. Mauris luctus nulla ornare, dignissim nulla id, rutrum nunc. |