Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorJupyterDocumentEngine.php
<?php | <?php | ||||
final class PhabricatorJupyterDocumentEngine | final class PhabricatorJupyterDocumentEngine | ||||
extends PhabricatorDocumentEngine { | extends PhabricatorDocumentEngine { | ||||
const ENGINEKEY = 'jupyter'; | const ENGINEKEY = 'jupyter'; | ||||
public function getViewAsLabel(PhabricatorDocumentRef $ref) { | public function getViewAsLabel(PhabricatorDocumentRef $ref) { | ||||
return pht('View as Jupyter Notebook'); | return pht('View as Jupyter Notebook'); | ||||
} | } | ||||
protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | ||||
return 'fa-sun-o'; | return 'fa-sun-o'; | ||||
} | } | ||||
protected function getDocumentRenderingText(PhabricatorDocumentRef $ref) { | |||||
return pht('Rendering Jupyter Notebook...'); | |||||
} | |||||
public function shouldRenderAsync(PhabricatorDocumentRef $ref) { | |||||
return true; | |||||
} | |||||
protected function getContentScore(PhabricatorDocumentRef $ref) { | protected function getContentScore(PhabricatorDocumentRef $ref) { | ||||
$name = $ref->getName(); | $name = $ref->getName(); | ||||
if (preg_match('/\\.ipynb\z/i', $name)) { | if (preg_match('/\\.ipynb\z/i', $name)) { | ||||
return 2000; | return 2000; | ||||
} | } | ||||
return 500; | return 500; | ||||
▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines |