(refs #775)Add new extension point to add markup render
1 parent fd1ee07 commit aa5a07b98eb55a25e806fef4f308d76616614fd1
@Naoki Takezoe Naoki Takezoe authored on 4 Jun 2015
Showing 7 changed files
View
7
src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala
package gitbucket.core.controller
 
import gitbucket.core.api._
import gitbucket.core.plugin.PluginRegistry
import gitbucket.core.repo.html
import gitbucket.core.helper
import gitbucket.core.service._
import gitbucket.core.util._
(id, path.substring(id.length).stripPrefix("/"))
}
 
 
private val readmeFiles = view.helpers.renderableSuffixes.map(suffix => s"readme${suffix}") ++ Seq("readme.txt", "readme")
private val readmeFiles = PluginRegistry().renderableExtensions.map { extension =>
s"readme.${extension}"
} ++ Seq("readme.txt", "readme")
 
/**
* Provides HTML of the file list.
*
View
8
src/main/scala/gitbucket/core/plugin/Plugin.scala
*/
val javaScripts: Seq[(String, String)] = Nil
 
/**
* Override to declare this plug-in provides renderers.
*/
val renderers: Seq[(String, Renderer)] = Nil
 
/**
* This method is invoked in initialization of plugin system.
* Register plugin functionality to PluginRegistry.
*/
def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = {
registry.addController(path, controller)
}
javaScripts.foreach { case (path, script) =>
registry.addJavaScript(path, script)
}
renderers.foreach { case (extension, renderer) =>
registry.addRenderer(extension, renderer)
}
}
 
/**
View
src/main/scala/gitbucket/core/plugin/PluginRegistory.scala
View
src/main/scala/gitbucket/core/plugin/Renderer.scala 0 → 100644
View
src/main/scala/gitbucket/core/view/helpers.scala
View
src/main/twirl/gitbucket/core/repo/blob.scala.html
View
src/main/twirl/gitbucket/core/repo/editor.scala.html