Exemple #1
0
 /**
  * Get the concat'ed commands
  *
  * @return string
  */
 private function commands()
 {
     $full_path = Path::assemble(root_path(), $this->data->path());
     $data = $this->data->toArray();
     $data['full_path'] = $full_path;
     $data['committer'] = User::getCurrent()->toArray();
     $commands = [];
     foreach ($this->getConfig('commands', []) as $command) {
         $commands[] = Parse::template($command, $data);
     }
     return join('; ', $commands);
 }
 /**
  * The {{ highlight }} tag
  *
  * Enables the Highlight.js script to color-code codeblocks.
  * parameter: style (defaults to 'default') contains the name of the optional style (css filename without the '.css')     
  * can be called with the style parameter like this: {{ highlight style="sunburst" }} to override the default or configured stylesheet
  *
  * @return string containing the css and js includes to be placed in the <HEAD> tags
  */
 public function index()
 {
     $baseCodeStyle = $this->getConfig('codestyle', 'default');
     $name = $this->getParam('style', $baseCodeStyle);
     // Style name defaults to 'default'
     $baseLibVer = $this->getConfig('library_version', 'small');
     // Include the needed CSS for this plugin
     $addon_name = $this->getAddonClassName();
     $addon_path = Path::makeRelative(addons_path($addon_name));
     $cssfile = $addon_path . '/highlightjs/styles/' . $name . '.css';
     $style = '<link rel="stylesheet" href="/' . $cssfile . '">';
     // Include the needed javascript
     $js = '
     <script src="/' . $addon_path . '/highlightjs/highlight.pack.' . $baseLibVer . '.js" type="text/javascript"> </script>
     <script type="text/javascript">
       hljs.initHighlightingOnLoad();
     </script>';
     return $style . $js;
 }