index.gmi, README.gmi: copyedit
[gemini.koplugin.git] / main.lua
blobbda33fd1e6eb278737ce2f9ef6ea1f74bc9c99d9
1 local Client = require("client")
3 local WidgetContainer = require("ui/widget/container/widgetcontainer")
4 local Dispatcher = require("dispatcher")
5 local DocumentRegistry = require("document/documentregistry")
6 local _ = require("gettext")
8 local GeminiPlugin = WidgetContainer:extend{
9 name = "gemini",
10 fullname = _("Gemini plugin"),
13 local done_setup = false
14 function GeminiPlugin:setup()
15 if not done_setup then
16 require("identities"):setup()
17 self:onDispatcherRegisterActions()
18 done_setup = true
19 local GeminiDocument = require("geminidocument")
20 DocumentRegistry:addProvider("gmi", "text/gemini", GeminiDocument, 100)
21 end
22 end
24 function GeminiPlugin:onDispatcherRegisterActions()
25 Dispatcher:registerAction("browse_gemini", {category = "none", event = "BrowseGemini", title = _("Browse Gemini"), general = true, separator = true })
26 Dispatcher:registerAction("gemini_back", {category = "none", event = "GeminiBack", title = _("Gemini: Back"), reader = true })
27 Dispatcher:registerAction("gemini_unback", {category = "none", event = "GeminiUnback", title = _("Gemini: Unback"), reader = true })
28 Dispatcher:registerAction("gemini_history", {category = "none", event = "GeminiHistory", title = _("Gemini: History"), reader = true })
29 Dispatcher:registerAction("gemini_bookmarks", {category = "none", event = "GeminiBookmarks", title = _("Gemini: Bookmarks"), reader = true })
30 Dispatcher:registerAction("gemini_mark", {category = "none", event = "GeminiMark", title = _("Gemini: Mark"), reader = true })
31 Dispatcher:registerAction("gemini_next", {category = "none", event = "GeminiNext", title = _("Gemini: Next"), reader = true })
32 Dispatcher:registerAction("gemini_add", {category = "none", event = "GeminiAdd", title = _("Gemini: Add"), reader = true })
33 Dispatcher:registerAction("gemini_nav", {category = "none", event = "GeminiNav", title = _("Gemini: Open nav"), reader = true })
34 Dispatcher:registerAction("gemini_input", {category = "none", event = "GeminiInput", title = _("Gemini: Input"), reader = true })
35 Dispatcher:registerAction("gemini_reload", {category = "none", event = "GeminiReload", title = _("Gemini: Reload"), reader = true })
36 Dispatcher:registerAction("gemini_up", {category = "none", event = "GeminiUp", title = _("Gemini: Up"), reader = true })
37 Dispatcher:registerAction("gemini_goNew", {category = "none", event = "GeminiGoNew", title = _("Gemini: Enter URL"), reader = true, separator = true })
38 end
40 function GeminiPlugin:init()
41 self:setup()
43 -- A persistent Client instance handles events.
44 Client:init(self.ui)
45 table.insert(self, Client)
46 end
48 return GeminiPlugin