Once you've checked out the project simply run the FatJar
gradle task to build ktt.jar, a jar containing the project and its dependencies. Then you can run the program as follows:
java -jar ktt.jar
You can start the wiki by running the WikiApplication
class. The server will start on port 8080. Data will be stored in database file main.db in the same directory.
You can also start up the wiki from your own code by calling
WikiApplication.startup()
Macros have a syntax that looks as follows:
{@macro:MacroName}
Where @macro
opens a new macro. The colon is followed by the name of the macro type. Macro types should be acquired using a registry of named macros rather than using class lookups by name.
Arguments are provided using values specified with quotes, as in:
{@macro:Greeting msg="Hello to the world"}
Define a class that implements the Macro
interface. Then add it to the macro registry:
WikiApplication.macroRegistry.register(myMacro)
At the moment this is done in the WikiApplication.kt file.
You'll note that the Macro
interface's execute()
method includes a SystemAccess
argument. You can use this to store or retrieve data when your macro executes.
You can customize the css for the wiki by updating the styling for the appropriate section of each page on the main screen (by going to /
on the wiki). Note that for now css classes are used to control most of the styling. So, for example, the body of a wiki entry being displayed falls under css class .wiki_entry
. You can extend this system by adding more classes (see the Classes
class). If you wish to make a given css class customizable simply add an entry for it to the StylesheetType enum, and provide the css class you wish to make customizable as constructor argument, as in:
enum class StylesheetType(val cssClass: String) {
WikiEntry(wikiEntry),
ControlPanel(controlPanel)
}
You can use the WikiApplication.systemAccess
field to get a SystemAccess
that lets you store data should you need to store or retrieve configurations etc.
Generally, if you are modifying or maintaining this project, the SystemAccess should provide only a minimal set of features. This allows for the rest of the application to function smoothly without say someone's third party code messing around with wiki pages in the database.
Repo to try out some development using ktor for Kotlin server-side coding
- https://github.com/xerial/sqlite-jdbc/tree/master
- https://github.com/xerial/sqlite-jdbc/blob/master/USAGE.md
- https://github.com/kevinvandenbreemen/sqlite-dao
https://github.com/JetBrains/markdown
https://www.markdownguide.org/cheat-sheet/
- Right now the css is just hard-coded in the
Styling
class. - Provide a way of letting the user enter their own CSS on a page in the wiki that then styles the wiki.