Ejemplo n.º 1
0
class AttachmentPlugin(BasePlugin):
    slug = settings.SLUG
    urlpatterns = {
        "article": [re_path("", include("wiki.plugins.attachments.urls"))]
    }

    article_tab = (_("Attachments"), "fa fa-file")
    article_view = views.AttachmentView().dispatch

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [{
        "model":
        models.AttachmentRevision,
        "message":
        lambda obj: (_("A file was changed: %s") if not obj.deleted else _(
            "A file was deleted: %s")) % truncate_title(obj.get_filename()),
        "key":
        ARTICLE_EDIT,
        "created":
        True,
        "get_article":
        lambda obj: obj.attachment.article,
    }]

    markdown_extensions = [AttachmentExtension()]


registry.register(AttachmentPlugin)
Ejemplo n.º 2
0
                name="images_delete",
            ),
            re_path(
                "^restore/(?P<image_id>[0-9]+)/$",
                views.DeleteView.as_view(),
                name="images_restore",
                kwargs={"restore": True},
            ),
            re_path(
                "^purge/(?P<image_id>[0-9]+)/$",
                views.PurgeView.as_view(),
                name="images_purge",
            ),
            re_path(
                "^(?P<image_id>[0-9]+)/revision/change/(?P<rev_id>[0-9]+)/$",
                views.RevisionChangeView.as_view(),
                name="images_set_revision",
            ),
            re_path(
                "^(?P<image_id>[0-9]+)/revision/add/$",
                views.RevisionAddView.as_view(),
                name="images_add_revision",
            ),
        ]
    }

    markdown_extensions = [ImageExtension()]


registry.register(ImagePlugin)
Ejemplo n.º 3
0
from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin


class Plugin(BasePlugin):
    markdown_extensions = [
        "wiki.plugins.redlinks.mdx.redlinks",
    ]


registry.register(Plugin)
Ejemplo n.º 4
0
from django.urls import re_path

from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin
from . import settings, views


class NotifyPlugin(BasePlugin):
    slug = settings.SLUG
    urlpatterns = {
        "root": [
            re_path(
                r"^$",
                views.NotificationSettings.as_view(),
                name="notification_settings",
            ),
        ]
    }

    article_view = views.NotificationSettings().dispatch

    settings_form = "wiki.plugins.notifications.forms.SubscriptionForm"


registry.register(NotifyPlugin)
Ejemplo n.º 5
0
from django.utils.translation import gettext as _

from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin
from detimakerlab.wiki.plugins.macros import settings


class MacroPlugin(BasePlugin):
    slug = settings.SLUG

    sidebar = {
        "headline": _("Macros"),
        "icon_class": "fa-play",
        "template": "wiki/plugins/macros/sidebar.html",
        "form_class": None,
        "get_form_kwargs": (lambda a: {}),
    }

    markdown_extensions = [
        "wiki.plugins.macros.mdx.macro",
        "wiki.plugins.macros.mdx.toc",
        "wiki.plugins.macros.mdx.wikilinks",
    ]


registry.register(MacroPlugin)
Ejemplo n.º 6
0
from django.conf.urls import url

from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin
from detimakerlab.wiki.plugins.editsection.markdown_extensions import EditSectionExtension
from . import settings, views


class EditSectionPlugin(BasePlugin):
    slug = settings.SLUG
    urlpatterns = {
        "article": [
            url(
                r"^(?P<location>[0-9-]+)/header/(?P<header>\w+)/$",
                views.EditSection.as_view(),
                name="editsection",
            ),
        ]
    }

    markdown_extensions = [EditSectionExtension()]


registry.register(EditSectionPlugin)
Ejemplo n.º 7
0
from django.urls import re_path

from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin
from . import settings, views


class GlobalHistoryPlugin(BasePlugin):
    slug = settings.SLUG
    urlpatterns = {
        "root": [
            re_path(r"^$", views.GlobalHistory.as_view(),
                    name="globalhistory"),
            re_path(
                "^(?P<only_last>[01])/$",
                views.GlobalHistory.as_view(),
                name="globalhistory",
            ),
        ]
    }


registry.register(GlobalHistoryPlugin)
Ejemplo n.º 8
0
    urlpatterns = {
        "article": [
            re_path(
                r"^json/query-urlpath/$",
                views.QueryUrlPath.as_view(),
                name="links_query_urlpath",
            ),
        ]
    }

    sidebar = {
        "headline": _("Links"),
        "icon_class": "fa-bookmark",
        "template": "wiki/plugins/links/sidebar.html",
        "form_class": None,
        "get_form_kwargs": (lambda a: {}),
    }

    wikipath_config = [
        ("base_url", reverse_lazy("wiki:get", kwargs={"path": ""})),
        ("default_level", settings.LOOKUP_LEVEL),
    ]

    markdown_extensions = [
        urlize_makeExtension(),
        WikiPathExtension(wikipath_config)
    ]


registry.register(LinkPlugin)
Ejemplo n.º 9
0
from detimakerlab.wiki.core.plugins import registry
from detimakerlab.wiki.core.plugins.base import BasePlugin
from detimakerlab.wiki.plugins.article_dependencies import forms, views


class ArticleDependenciesPlugin(BasePlugin):
    slug = "dependencies"
    urlpatterns = {
        "article": [
            re_path(
                r"^test/$",
                views.DependenciesView.as_view(),
                name="dependencies_view",
            ),
        ]
    }

    sidebar = {
        "headline": _("Equipment"),
        "icon_class": "fa-tools",
        "template": "wiki/plugins/article_dependencies/dependencies_form.html",
        "form_class": forms.CreateDependencieForm,
        "get_form_kwargs": (lambda a: {}),
    }

    markdown_extensions = []


registry.register(ArticleDependenciesPlugin)