@@ -13,14 +13,14 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('searchIndex', function (Blueprint $table) { |
|
16 | + Schema::create('searchIndex', function(Blueprint $table) { |
|
17 | 17 | $table->integer('id'); |
18 | 18 | $table->text('name'); |
19 | 19 | $table->text('type'); |
20 | 20 | $table->text('path'); |
21 | 21 | |
22 | 22 | $table->primary('id'); |
23 | - $table->unique(['name', 'type', 'path'], 'anchor'); |
|
23 | + $table->unique([ 'name', 'type', 'path' ], 'anchor'); |
|
24 | 24 | }); |
25 | 25 | } |
26 | 26 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | | |
27 | 27 | */ |
28 | 28 | |
29 | - 'paths' => [app_path('Commands')], |
|
29 | + 'paths' => [ app_path('Commands') ], |
|
30 | 30 | |
31 | 31 | /* |
32 | 32 | |-------------------------------------------------------------------------- |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | $entries = collect(); |
38 | 38 | |
39 | - $crawler->filter('.lvl0, .lvl1')->each(function (HtmlPageCrawler $node) use ($entries) { |
|
39 | + $crawler->filter('.lvl0, .lvl1')->each(function(HtmlPageCrawler $node) use ($entries) { |
|
40 | 40 | if ($this->isRealPage(trim($node->text()))) { |
41 | 41 | $entries->push([ |
42 | 42 | 'name' => trim($node->text()), |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function isRealPage($name) |
53 | 53 | { |
54 | - return ! in_array($name, ['Usage', 'Add-ons']); |
|
54 | + return !in_array($name, [ 'Usage', 'Add-ons' ]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | protected function sectionEntries(HtmlPageCrawler $crawler, string $file) |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | |
61 | 61 | $h1 = $crawler->filter('h1')->last(); |
62 | 62 | |
63 | - $crawler->filter('h2, h3, h4')->each(static function (HtmlPageCrawler $node) use ($entries, $file, $h1) { |
|
63 | + $crawler->filter('h2, h3, h4')->each(static function(HtmlPageCrawler $node) use ($entries, $file, $h1) { |
|
64 | 64 | $fileBasename = basename($file); |
65 | 65 | |
66 | - if (! in_array($fileBasename, ['index.html', '404.html'])) { |
|
66 | + if (!in_array($fileBasename, [ 'index.html', '404.html' ])) { |
|
67 | 67 | $entries->push([ |
68 | - 'name' => trim($node->text() . ' - ' . $h1->text()), |
|
68 | + 'name' => trim($node->text().' - '.$h1->text()), |
|
69 | 69 | 'type' => 'Section', |
70 | - 'path' => basename($file) . '#' . Str::slug($node->text()) |
|
70 | + 'path' => basename($file).'#'.Str::slug($node->text()) |
|
71 | 71 | ]); |
72 | 72 | } |
73 | 73 | }); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | $crawler->filter('h1') |
139 | 139 | ->before('<a name="//apple_ref/cpp/Section/Top" class="dashAnchor"></a>'); |
140 | 140 | |
141 | - $crawler->filter('h2, h3, h4')->each(static function (HtmlPageCrawler $node) { |
|
141 | + $crawler->filter('h2, h3, h4')->each(static function(HtmlPageCrawler $node) { |
|
142 | 142 | $node->before( |
143 | - '<a id="' . Str::slug($node->text()) . '" name="//apple_ref/cpp/Section/' . rawurlencode($node->text()) . '" class="dashAnchor"></a>' |
|
143 | + '<a id="'.Str::slug($node->text()).'" name="//apple_ref/cpp/Section/'.rawurlencode($node->text()).'" class="dashAnchor"></a>' |
|
144 | 144 | ); |
145 | 145 | }); |
146 | 146 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public const PLAYGROUND = ''; |
16 | 16 | public const ICON_16 = 'favicon-16x16.png'; |
17 | 17 | public const ICON_32 = 'favicon-32x32.png'; |
18 | - public const EXTERNAL_DOMAINS = []; |
|
18 | + public const EXTERNAL_DOMAINS = [ ]; |
|
19 | 19 | |
20 | 20 | |
21 | 21 | public function entries(string $file): Collection |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | $crawler = HtmlPageCrawler::create(Storage::get($file)); |
26 | 26 | |
27 | - $crawler->filter('a.nav-item')->each(static function (HtmlPageCrawler $node) use ($entries) { |
|
27 | + $crawler->filter('a.nav-item')->each(static function(HtmlPageCrawler $node) use ($entries) { |
|
28 | 28 | $entries->push([ |
29 | 29 | 'name' => $node->text(), |
30 | 30 | 'type' => 'Guide', |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | $entries->push([ |
53 | 53 | 'name' => $this->cleanAnchorText($parent->text()), |
54 | 54 | 'type' => 'Sample', |
55 | - 'path' => basename($file) . '#' . Str::slug($parent->text()), |
|
55 | + 'path' => basename($file).'#'.Str::slug($parent->text()), |
|
56 | 56 | ]); |
57 | 57 | |
58 | - $crawler->filter('h2')->each(function (HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
58 | + $crawler->filter('h2')->each(function(HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
59 | 59 | $entries->push([ |
60 | - 'name' => $this->cleanAnchorText($node->text()) . ' - ' . $parent->text(), |
|
60 | + 'name' => $this->cleanAnchorText($node->text()).' - '.$parent->text(), |
|
61 | 61 | 'type' => 'Sample', |
62 | - 'path' => basename($file) . '#' . Str::slug($node->text()), |
|
62 | + 'path' => basename($file).'#'.Str::slug($node->text()), |
|
63 | 63 | ]); |
64 | 64 | }); |
65 | 65 | |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | $entries->push([ |
78 | 78 | 'name' => $this->cleanAnchorText($parent->text()), |
79 | 79 | 'type' => 'Resource', |
80 | - 'path' => basename($file) . '#' . Str::slug($parent->text()), |
|
80 | + 'path' => basename($file).'#'.Str::slug($parent->text()), |
|
81 | 81 | ]); |
82 | 82 | |
83 | - $crawler->filter('h2')->each(function (HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
83 | + $crawler->filter('h2')->each(function(HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
84 | 84 | $entries->push([ |
85 | - 'name' => $this->cleanAnchorText($node->text()) . ' - ' . $parent->text(), |
|
85 | + 'name' => $this->cleanAnchorText($node->text()).' - '.$parent->text(), |
|
86 | 86 | 'type' => 'Resource', |
87 | - 'path' => basename($file) . '#' . Str::slug($node->text()), |
|
87 | + 'path' => basename($file).'#'.Str::slug($node->text()), |
|
88 | 88 | ]); |
89 | 89 | }); |
90 | 90 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $entries = collect(); |
100 | 100 | |
101 | 101 | if ($pageTitle === 'Installation - Tailwind CSS') { |
102 | - $crawler->filter('#navWrapper li a')->each(static function (HtmlPageCrawler $node) use ($entries) { |
|
102 | + $crawler->filter('#navWrapper li a')->each(static function(HtmlPageCrawler $node) use ($entries) { |
|
103 | 103 | $entries->push([ |
104 | 104 | 'name' => trim($node->text()), |
105 | 105 | 'type' => 'Guide', |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | |
118 | 118 | $parent = $crawler->filter('h1')->first(); |
119 | 119 | |
120 | - $crawler->filter('h2')->each(function (HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
120 | + $crawler->filter('h2')->each(function(HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
121 | 121 | $entries->push([ |
122 | - 'name' => $this->cleanAnchorText($node->text()) . ' - ' . $parent->text(), |
|
122 | + 'name' => $this->cleanAnchorText($node->text()).' - '.$parent->text(), |
|
123 | 123 | 'type' => 'Section', |
124 | - 'path' => basename($file) . '#' . Str::slug($node->text()), |
|
124 | + 'path' => basename($file).'#'.Str::slug($node->text()), |
|
125 | 125 | ]); |
126 | 126 | }); |
127 | 127 | |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | $crawler->filter('h1') |
221 | 221 | ->before('<a name="//apple_ref/cpp/Section/Top" class="dashAnchor"></a>'); |
222 | 222 | |
223 | - $crawler->filter('h2, h3')->each(function (HtmlPageCrawler $node) { |
|
223 | + $crawler->filter('h2, h3')->each(function(HtmlPageCrawler $node) { |
|
224 | 224 | $node->prepend( |
225 | - '<a id="' . Str::slug($node->text()) . '" name="//apple_ref/cpp/Section/' . rawurlencode($this->cleanAnchorText($node->text())) . '" class="dashAnchor"></a>' |
|
225 | + '<a id="'.Str::slug($node->text()).'" name="//apple_ref/cpp/Section/'.rawurlencode($this->cleanAnchorText($node->text())).'" class="dashAnchor"></a>' |
|
226 | 226 | ); |
227 | 227 | }); |
228 | 228 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public const PLAYGROUND = ''; |
17 | 17 | public const ICON_16 = '../icon.png'; |
18 | 18 | public const ICON_32 = '../[email protected]'; |
19 | - public const EXTERNAL_DOMAINS = []; |
|
19 | + public const EXTERNAL_DOMAINS = [ ]; |
|
20 | 20 | |
21 | 21 | |
22 | 22 | public function entries(string $file): Collection |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $entries = collect(); |
36 | 36 | |
37 | - $crawler->filter('h2')->each(static function (HtmlPageCrawler $node) use ($entries, $file) { |
|
37 | + $crawler->filter('h2')->each(static function(HtmlPageCrawler $node) use ($entries, $file) { |
|
38 | 38 | $fileBasename = basename($file); |
39 | 39 | |
40 | 40 | if ($fileBasename !== 'index.html') { |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | |
56 | 56 | $parent = $crawler->filter('h4')->first()->text() ?: $crawler->filter('h2')->first()->text(); |
57 | 57 | |
58 | - $crawler->filter('h3')->each(static function (HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
58 | + $crawler->filter('h3')->each(static function(HtmlPageCrawler $node) use ($entries, $file, $parent) { |
|
59 | 59 | $fileBasename = basename($file); |
60 | 60 | |
61 | 61 | if ($fileBasename !== 'index.html') { |
62 | 62 | $entries->push([ |
63 | - 'name' => trim($node->text() . ' - ' . $parent), |
|
63 | + 'name' => trim($node->text().' - '.$parent), |
|
64 | 64 | 'type' => 'Section', |
65 | - 'path' => $fileBasename . '#' . Str::slug($node->text()) |
|
65 | + 'path' => $fileBasename.'#'.Str::slug($node->text()) |
|
66 | 66 | ]); |
67 | 67 | } |
68 | 68 | }); |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | $crawler->filter('h2') |
158 | 158 | ->before('<a name="//apple_ref/cpp/Section/Top" class="dashAnchor"></a>'); |
159 | 159 | |
160 | - $crawler->filter('h3')->each(static function (HtmlPageCrawler $node) { |
|
160 | + $crawler->filter('h3')->each(static function(HtmlPageCrawler $node) { |
|
161 | 161 | $node->before( |
162 | - '<a id="' . Str::slug($node->text()) . '" name="//apple_ref/cpp/Section/' . rawurlencode($node->text()) . '" class="dashAnchor"></a>' |
|
162 | + '<a id="'.Str::slug($node->text()).'" name="//apple_ref/cpp/Section/'.rawurlencode($node->text()).'" class="dashAnchor"></a>' |
|
163 | 163 | ); |
164 | 164 | }); |
165 | 165 | } |
@@ -63,37 +63,37 @@ discard block |
||
63 | 63 | |
64 | 64 | final public function file(): string |
65 | 65 | { |
66 | - return static::CODE . '/' . static::CODE . '.docset'; |
|
66 | + return static::CODE.'/'.static::CODE.'.docset'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | final public function innerDirectory(): string |
70 | 70 | { |
71 | - return self::file() . '/Contents/Resources/Documents'; |
|
71 | + return self::file().'/Contents/Resources/Documents'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | final public function innerIndex(): string |
75 | 75 | { |
76 | - return self::innerDirectory() . '/' . static::INDEX; |
|
76 | + return self::innerDirectory().'/'.static::INDEX; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | final public function downloadedDirectory(): string |
80 | 80 | { |
81 | - return static::CODE . '/docs/' . static::URL; |
|
81 | + return static::CODE.'/docs/'.static::URL; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | final public function downloadedIndex(): string |
85 | 85 | { |
86 | - return self::downloadedDirectory() . '/' . static::INDEX; |
|
86 | + return self::downloadedDirectory().'/'.static::INDEX; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | final public function infoPlistFile(): string |
90 | 90 | { |
91 | - return self::file() . '/Contents/Info.plist'; |
|
91 | + return self::file().'/Contents/Info.plist'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | final public function databaseFile(): string |
95 | 95 | { |
96 | - return self::file() . '/Contents/Resources/docSet.dsidx'; |
|
96 | + return self::file().'/Contents/Resources/docSet.dsidx'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | final public function htmlFiles(): Collection |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | self::innerDirectory() |
103 | 103 | ); |
104 | 104 | |
105 | - return collect($files)->reject(static function ($file) { |
|
105 | + return collect($files)->reject(static function($file) { |
|
106 | 106 | return substr($file, -5) !== '.html'; |
107 | 107 | }); |
108 | 108 | } |
@@ -148,8 +148,4 @@ |
||
148 | 148 | if ($this->docset->icon32()) { |
149 | 149 | Storage::copy( |
150 | 150 | "{$this->docset->downloadedDirectory()}/{$this->docset->icon32()}", |
151 | - "{$this->docset->file()}/[email protected]" |
|
152 | - ); |
|
153 | - } |
|
154 | - } |
|
155 | -} |
|
151 | + "{$this->docset->file()} |
|
156 | 152 | \ No newline at end of file |
@@ -148,8 +148,4 @@ |
||
148 | 148 | if ($this->docset->icon32()) { |
149 | 149 | Storage::copy( |
150 | 150 | "{$this->docset->downloadedDirectory()}/{$this->docset->icon32()}", |
151 | - "{$this->docset->file()}/[email protected]" |
|
152 | - ); |
|
153 | - } |
|
154 | - } |
|
155 | -} |
|
151 | + "{$this->docset->file()} |
|
156 | 152 | \ No newline at end of file |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | |
105 | 105 | $entries->each(static function ($entry) { |
106 | 106 | DB::table('searchIndex')->insert([ |
107 | - 'name' => $entry['name'], |
|
108 | - 'type' => $entry['type'], |
|
109 | - 'path' => $entry['path'], |
|
107 | + 'name' => $entry[ 'name'], |
|
108 | + 'type' => $entry[ 'type'], |
|
109 | + 'path' => $entry[ 'path'], |
|
110 | 110 | ]); |
111 | 111 | }); |
112 | 112 | } |
@@ -148,8 +148,4 @@ discard block |
||
148 | 148 | if ($this->docset->icon32()) { |
149 | 149 | Storage::copy( |
150 | 150 | "{$this->docset->downloadedDirectory()}/{$this->docset->icon32()}", |
151 | - "{$this->docset->file()}/[email protected]" |
|
152 | - ); |
|
153 | - } |
|
154 | - } |
|
155 | -} |
|
151 | + "{$this->docset->file()} |
|
156 | 152 | \ No newline at end of file |
@@ -148,8 +148,4 @@ |
||
148 | 148 | if ($this->docset->icon32()) { |
149 | 149 | Storage::copy( |
150 | 150 | "{$this->docset->downloadedDirectory()}/{$this->docset->icon32()}", |
151 | - "{$this->docset->file()}/[email protected]" |
|
152 | - ); |
|
153 | - } |
|
154 | - } |
|
155 | -} |
|
151 | + "{$this->docset->file()} |
|
156 | 152 | \ No newline at end of file |
@@ -148,8 +148,4 @@ |
||
148 | 148 | if ($this->docset->icon32()) { |
149 | 149 | Storage::copy( |
150 | 150 | "{$this->docset->downloadedDirectory()}/{$this->docset->icon32()}", |
151 | - "{$this->docset->file()}/[email protected]" |
|
152 | - ); |
|
153 | - } |
|
154 | - } |
|
155 | -} |
|
151 | + "{$this->docset->file()} |
|
156 | 152 | \ No newline at end of file |
@@ -46,52 +46,52 @@ |
||
46 | 46 | |
47 | 47 | protected function grabFromSitemap() |
48 | 48 | { |
49 | - return $this->command->task(' - Downloading doc from sitemap', function () { |
|
49 | + return $this->command->task(' - Downloading doc from sitemap', function() { |
|
50 | 50 | return $this->grabber->grabFromSitemap(); |
51 | 51 | }); |
52 | 52 | } |
53 | 53 | |
54 | 54 | protected function grabFromIndex() |
55 | 55 | { |
56 | - return $this->command->task(' - Downloading doc from index', function () { |
|
56 | + return $this->command->task(' - Downloading doc from index', function() { |
|
57 | 57 | return $this->grabber->grabFromIndex(); |
58 | 58 | }); |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function package() |
62 | 62 | { |
63 | - $this->command->task(' - Remove previous .docset', function () { |
|
63 | + $this->command->task(' - Remove previous .docset', function() { |
|
64 | 64 | return $this->packager->removePreviousDocsetFile(); |
65 | 65 | }); |
66 | 66 | |
67 | - $this->command->task(' - Create new .docset', function () { |
|
67 | + $this->command->task(' - Create new .docset', function() { |
|
68 | 68 | return $this->packager->createDocsetFile(); |
69 | 69 | }); |
70 | 70 | |
71 | - $this->command->task(' - Copy original doc files', function () { |
|
71 | + $this->command->task(' - Copy original doc files', function() { |
|
72 | 72 | return $this->packager->copyDocFiles(); |
73 | 73 | }); |
74 | 74 | |
75 | - $this->command->task(' - Create Info.plist', function () { |
|
75 | + $this->command->task(' - Create Info.plist', function() { |
|
76 | 76 | return $this->packager->createInfoPlist(); |
77 | 77 | }); |
78 | 78 | |
79 | - $this->command->task(' - Populate SQLiteIndex', function () { |
|
79 | + $this->command->task(' - Populate SQLiteIndex', function() { |
|
80 | 80 | return $this->packager->createAndPopulateSQLiteIndex(); |
81 | 81 | }); |
82 | 82 | |
83 | - $this->command->task(' - Format doc files for Dash', function () { |
|
83 | + $this->command->task(' - Format doc files for Dash', function() { |
|
84 | 84 | return $this->packager->formatDocFiles(); |
85 | 85 | }); |
86 | 86 | |
87 | - $this->command->task(' - Copy icons', function () { |
|
87 | + $this->command->task(' - Copy icons', function() { |
|
88 | 88 | return $this->packager->copyIcons(); |
89 | 89 | }); |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function archive() |
93 | 93 | { |
94 | - $this->command->task(' - Archiving package', function () { |
|
94 | + $this->command->task(' - Archiving package', function() { |
|
95 | 95 | return $this->archiver->archive(); |
96 | 96 | }); |
97 | 97 | } |