-
-
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.
first reconversion from dash-docsets repo
- Loading branch information
0 parents
commit 4816e19
Showing
185 changed files
with
142,194 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/vendor | ||
|
||
.DS_Store | ||
|
||
.phpunit.result.cache | ||
.php_cs.cache | ||
|
||
/storage/*/*.docset |
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,29 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in([ | ||
__DIR__ . '/app', | ||
__DIR__ . '/tests' | ||
]) | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => ['default' => 'single_space'], | ||
'blank_line_after_opening_tag' => true, | ||
'blank_line_before_statement' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'method_chaining_indentation' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'ordered_imports' => ['sortAlgorithm' => 'alpha'], | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_order' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'whitespace_after_comma_in_array' => true, | ||
]) | ||
->setFinder($finder) | ||
; |
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,14 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PSR2"> | ||
<description>Hopefully PSR2 standard that works</description> | ||
<rule ref="PSR2"> | ||
</rule> | ||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> | ||
<exclude-pattern>*Test.php</exclude-pattern> | ||
</rule> | ||
<rule ref="Generic.Formatting.SpaceAfterCast"> | ||
<properties> | ||
<property name="equalsSpacing" value="1"/> | ||
</properties> | ||
</rule> | ||
</ruleset> |
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,14 @@ | ||
build: | ||
nodes: | ||
analysis: | ||
tests: | ||
override: | ||
- php-scrutinizer-run | ||
|
||
filter: | ||
excluded_paths: [tests/*] | ||
|
||
tools: | ||
external_code_coverage: | ||
runs: 6 | ||
timeout: 1000 |
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 @@ | ||
preset: psr12 |
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,24 @@ | ||
dist: bionic | ||
|
||
language: php | ||
|
||
php: | ||
- 7.2 | ||
- 7.3 | ||
- 7.4 | ||
|
||
env: | ||
matrix: | ||
- COMPOSER_FLAGS="--prefer-lowest" | ||
- COMPOSER_FLAGS="" | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
|
||
script: | ||
- composer test -- --coverage-text --coverage-clover=coverage.clover | ||
|
||
after_script: | ||
- wget https://scrutinizer-ci.com/ocular.phar | ||
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Guillaume Leclerc <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,25 @@ | ||
<h1 align="center">Ploi API Dash Docset</h1> | ||
|
||
<p align="center"> | ||
<a href="https://travis-ci.com/godbout/ploi-api-dash-docset"><img src="https://img.shields.io/travis/com/godbout/ploi-api-dash-docset/master.svg?style=flat-square" alt="Build Status"></a> | ||
<a href="https://scrutinizer-ci.com/g/godbout/ploi-api-dash-docset"><img src="https://img.shields.io/scrutinizer/g/godbout/ploi-api-dash-docset.svg?style=flat-square" alt="Quality Score"></a> | ||
<a href="https://scrutinizer-ci.com/g/godbout/ploi-api-dash-docset"><img src="https://scrutinizer-ci.com/g/godbout/ploi-api-dash-docset/badges/coverage.png?b=master" alt="Code Coverage"></a> | ||
</p> | ||
|
||
<p align="center"> | ||
Ploi API <a href="https://kapeli.com/dash">Dash</a> <a href="https://kapeli.com/docsets">Docset</a> created with the lovely—not biased here—<a href="https://github.com/godbout/dash-docset-builder">Dash Docset Builder</a> in PHP. | ||
</p> | ||
|
||
___ | ||
|
||
## Docsets born here, sorted by eldest first | ||
|
||
* [Laravel-Zero](https://laravel-zero.com/docs/introduction/) | ||
* [Jigsaw by Tighten](https://jigsaw.tighten.co/docs/installation/) | ||
* [Tailwind CSS](https://tailwindcss.com/docs/installation/) | ||
* [Tiki](https://doc.tiki.org/All-the-Documentation) | ||
* ~~[Stripe](https://stripe.com/docs)~~ — [DECEASED](https://github.com/godbout/dash-docset-builder/tree/stripe/storage/stripe) | ||
* ~~[Stripe API](https://stripe.com/docs/api)~~ — [DECEASED](https://github.com/godbout/dash-docset-builder/tree/stripe-api/storage/stripe-api) | ||
* [Ploi API](https://developers.ploi.io/) | ||
* [Bulma](https://https://bulma.io/) | ||
* [Alfred 4](https://www.alfredapp.com/) |
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,146 @@ | ||
<?php | ||
|
||
namespace App\Docsets; | ||
|
||
use Godbout\DashDocsetBuilder\Docsets\BaseDocset; | ||
use Illuminate\Support\Collection; | ||
use Illuminate\Support\Facades\Storage; | ||
use Illuminate\Support\Str; | ||
use Wa72\HtmlPageDom\HtmlPageCrawler; | ||
|
||
class Ploi extends BaseDocset | ||
{ | ||
public const CODE = 'ploi-api'; | ||
public const NAME = 'Ploi API'; | ||
public const URL = 'developers.ploi.io'; | ||
public const INDEX = 'index.html'; | ||
public const PLAYGROUND = ''; | ||
public const ICON_16 = '../documentator.s3.eu-west-3.amazonaws.com/11/conversions/favicon-favicon-16.png'; | ||
public const ICON_32 = '../documentator.s3.eu-west-3.amazonaws.com/11/conversions/favicon-favicon-32.png'; | ||
public const EXTERNAL_DOMAINS = [ | ||
'documentator.s3.eu-west-3.amazonaws.com' | ||
]; | ||
|
||
|
||
/** | ||
* overriden because there's a sitemap but not usable | ||
*/ | ||
public function grab(): bool | ||
{ | ||
system( | ||
"echo; wget {$this->url()} \ | ||
--mirror \ | ||
--trust-server-names \ | ||
--page-requisites \ | ||
--adjust-extension \ | ||
--convert-links \ | ||
--span-hosts \ | ||
--domains={$this->externalDomains()} \ | ||
--directory-prefix=storage/{$this->downloadedDirectory()} \ | ||
-e robots=off \ | ||
--quiet \ | ||
--show-progress", | ||
$result | ||
); | ||
|
||
return $result === 0; | ||
} | ||
|
||
public function entries(string $file): Collection | ||
{ | ||
$crawler = HtmlPageCrawler::create(Storage::get($file)); | ||
|
||
$entries = collect(); | ||
$entries = $entries->merge($this->guideEntries($crawler, $file)); | ||
|
||
return $entries; | ||
} | ||
|
||
protected function guideEntries(HtmlPageCrawler $crawler, string $file) | ||
{ | ||
$entries = collect(); | ||
|
||
if (Str::contains($file, "{$this->url()}/index.html")) { | ||
$crawler->filter('aside a.ml-2')->each(function (HtmlPageCrawler $node) use ($entries) { | ||
$entries->push([ | ||
'name' => trim($node->text()), | ||
'type' => 'Guide', | ||
'path' => $this->url() . '/' . $node->attr('href'), | ||
]); | ||
}); | ||
} | ||
|
||
return $entries; | ||
} | ||
|
||
public function format(string $file): string | ||
{ | ||
$crawler = HtmlPageCrawler::create(Storage::get($file)); | ||
|
||
$this->removeHeader($crawler); | ||
$this->removeSidebar($crawler); | ||
$this->removePreviousAndNextNavigation($crawler); | ||
$this->updateTopPadding($crawler); | ||
$this->removeUnwantedJavaScript($crawler); | ||
|
||
$this->insertOnlineRedirection($crawler, $file); | ||
$this->insertDashTableOfContents($crawler); | ||
|
||
return $crawler->saveHTML(); | ||
} | ||
|
||
protected function removeHeader(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter('header')->remove(); | ||
} | ||
|
||
protected function removeSidebar(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter('aside')->remove(); | ||
} | ||
|
||
protected function removePreviousAndNextNavigation(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter('#previous-and-next')->remove(); | ||
} | ||
|
||
protected function updateTopPadding(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter('main') | ||
->addClass('md:pt-12') | ||
; | ||
} | ||
|
||
protected function removeUnwantedJavaScript(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter("link[href*='analytics.dennissmink.com']")->remove(); | ||
$crawler->filterXPath("//script[text()[contains(.,'analytics.dennissmink.com')]]")->remove(); | ||
$crawler->filter('noscript')->remove(); | ||
} | ||
|
||
protected function insertOnlineRedirection(HtmlPageCrawler $crawler, string $file) | ||
{ | ||
$onlineUrl = Str::substr(Str::after($file, $this->innerDirectory()), 1, -5); | ||
|
||
$crawler->filter('html')->prepend("<!-- Online page at $onlineUrl -->"); | ||
} | ||
|
||
|
||
protected function insertDashTableOfContents(HtmlPageCrawler $crawler) | ||
{ | ||
$crawler->filter('h1') | ||
->before('<a name="//apple_ref/cpp/Section/Top" class="dashAnchor"></a>'); | ||
|
||
$crawler->filter('h2, h3, h4')->each(static function (HtmlPageCrawler $node) { | ||
$node->before( | ||
'<a id="' . Str::slug($node->text()) . '" name="//apple_ref/cpp/Section/' . rawurlencode($node->text()) . '" class="dashAnchor"></a>' | ||
); | ||
}); | ||
|
||
$crawler->filterXPath('//p[not(descendant::code)]')->each(static function (HtmlPageCrawler $node) { | ||
$node->before( | ||
'<a id="' . Str::slug($node->text()) . '" name="//apple_ref/cpp/Section/' . rawurlencode($node->text()) . '" class="dashAnchor"></a>' | ||
); | ||
}); | ||
} | ||
} |
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,57 @@ | ||
{ | ||
"name": "godbout/dash-docsets", | ||
"description": "Dash Docsets built with Dash Docset Builder.", | ||
"keywords": [ | ||
"dash", | ||
"docset", | ||
"docsets", | ||
"builder", | ||
"build", | ||
"offline", | ||
"documentation", | ||
"PHP", | ||
"love" | ||
], | ||
"homepage": "https://github.com/godbout/dash-docsets", | ||
"type": "project", | ||
"license": "MIT", | ||
"support": { | ||
"issues": "https://github.com/godbout/dash-docset/issues", | ||
"source": "https://github.com/godbout/dash-docset" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Guillaume Leclerc", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"godbout/dash-docset-builder": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"App\\": "app/" | ||
} | ||
}, | ||
"require-dev": { | ||
"codedungeon/phpunit-result-printer": "^0.27", | ||
"mockery/mockery": "^1.3", | ||
"phpunit/phpunit": "^8" | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"preferred-install": "dist", | ||
"sort-packages": true, | ||
"optimize-autoloader": true | ||
}, | ||
"scripts": { | ||
"test": "phpunit --group=default,download --color=always", | ||
"format": "php-cs-fixer fix -vvv --config=.php_cs.dist --ansi" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
Oops, something went wrong.