[gnome-builder] wip: start on html/markdown plugin
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] wip: start on html/markdown plugin
- Date: Fri, 4 Sep 2015 05:59:27 +0000 (UTC)
commit 54bf676fa560a9c8f194a71049b198072633a92e
Author: Christian Hergert <christian hergert me>
Date: Thu Sep 3 16:49:47 2015 -0700
wip: start on html/markdown plugin
We need to break this out into a plugin.
configure.ac | 11 ++++++-
plugins/Makefile.am | 1 +
plugins/html-preview/Makefile.am | 14 +++++++++
plugins/html-preview/html-preview.plugin | 9 ++++++
plugins/html-preview/html_preview_plugin.py | 40 +++++++++++++++++++++++++++
src/Makefile.am | 7 -----
src/editor/gb-editor-view-actions.c | 4 ++-
7 files changed, 76 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0cb63bc..5f62b86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,8 +164,7 @@ PKG_CHECK_MODULES(BUILDER, [gtk+-3.0 >= gtk_required_version
gio-2.0 >= glib_required_version
gtksourceview-3.0 >= gtksourceview_required_version
libgit2-glib-1.0 >= ggit_required_version
- libpeas-1.0 >= peas_required_version
- webkit2gtk-4.0 >= webkit_required_version])
+ libpeas-1.0 >= peas_required_version])
PKG_CHECK_MODULES(VTE, [vte-2.91 >= vte_required_version],
[have_vte=yes],
[have_vte=no])
@@ -201,6 +200,11 @@ PKG_CHECK_MODULES(GJS, [gjs-1.0 >= gjs_required_version
[enable_gjs_scripting=yes],
[enable_gjs_scripting=no])
+PKG_CHECK_MODULES(HTML_PREVIEW_PLUGIN, [webkit2gtk-4.0 >= webkit_required_version],
+ [enable_html_preview_plugin=yes],
+ [enable_html_preview_plugin=no])
+
+
dnl ***********************************************************************
dnl Be extra careful about libgit2-glib requirements
@@ -290,6 +294,7 @@ AM_CONDITIONAL(ENABLE_GJS_SCRIPTING, test x$enable_gjs_scripting != xno)
AM_CONDITIONAL(ENABLE_TERMINAL_PLUGIN, test x$enable_terminal_plugin != xno)
AM_CONDITIONAL(ENABLE_DEVHELP_PLUGIN, test x$enable_devhelp_plugin != xno)
+AM_CONDITIONAL(ENABLE_HTML_PREVIEW_PLUGIN, test x$enable_html_preview_plugin != xno)
AM_CONDITIONAL(ENABLE_CLANG_PLUGIN, test x$enable_clang_plugin != xno)
@@ -481,6 +486,7 @@ AC_CONFIG_FILES([
plugins/file-search/Makefile
plugins/gnome-code-assistance/Makefile
plugins/html-completion/Makefile
+ plugins/html-preview/Makefile
plugins/jedi/Makefile
plugins/python-gi-imports-completion/Makefile
plugins/mingw/Makefile
@@ -553,6 +559,7 @@ echo " Device Manager ....................... : yes"
echo " GNOME Code Assistance ................ : yes"
echo " Global File Search ................... : yes"
echo " HTML Language Pack ................... : yes"
+echo " HTML and Markdown Preview ............ : ${enable_html_preview_plugin}"
echo " MinGW ................................ : yes"
echo " Python GObject Introspection ......... : yes"
echo " Python Jedi Autocompletion ........... : yes"
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index dcbea82..e643a2c 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -10,6 +10,7 @@ SUBDIRS = \
file-search \
gnome-code-assistance \
html-completion \
+ html-preview \
jedi \
python-gi-imports-completion \
mingw \
diff --git a/plugins/html-preview/Makefile.am b/plugins/html-preview/Makefile.am
new file mode 100644
index 0000000..6a09b76
--- /dev/null
+++ b/plugins/html-preview/Makefile.am
@@ -0,0 +1,14 @@
+if ENABLE_HTML_PREVIEW_PLUGIN
+
+EXTRA_DIST = $(plugin_DATA)
+
+plugindir = $(libdir)/gnome-builder/plugins
+plugin_DATA = \
+ html-preview.plugin \
+ html_preview.py
+
+endif
+
+GITIGNOREFILES = __pycache__
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/html-preview/html-preview.plugin b/plugins/html-preview/html-preview.plugin
new file mode 100644
index 0000000..adeb103
--- /dev/null
+++ b/plugins/html-preview/html-preview.plugin
@@ -0,0 +1,9 @@
+[Plugin]
+Module=html_preview_plugin
+Loader=python3
+Name=HTML and Markdown Preview
+Description=Live preview of HTML and Markdown documents.
+Authors=Christian Hergert <christian hergert me>
+Copyright=Copyright © 2015 Christian Hergert
+Builtin=true
+Hidden=true
diff --git a/plugins/html-preview/html_preview_plugin.py b/plugins/html-preview/html_preview_plugin.py
new file mode 100644
index 0000000..0f0cfe0
--- /dev/null
+++ b/plugins/html-preview/html_preview_plugin.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+
+#
+# html_preview_plugin.py
+#
+# Copyright (C) 2015 Christian Hergert <chris dronelabs com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+from gettext import gettext as _
+
+from gi.repository import Builder
+from gi.repository import Gio
+from gi.repository import GObject
+from gi.repository import Ide
+
+class HtmlPreviewAddin(GObject.Object, Builder.EditorView):
+ def do_load(self, editor):
+ self.menu_extension = Builder.MenuExtension(editor.get_menu())
+
+ menu_item = Gio.MenuItem()
+ menu_item.set_label(_("Preview as HTML"))
+ menu_item.set_detailed_action('view.preview-as-html')
+ self.menu_extension.append_menu_item(menu_item)
+
+ def do_unload(self, editor):
+ self.menu_extension.remove_items()
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 08e288d..81166e7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,10 +62,6 @@ libgnome_builder_la_SOURCES = \
greeter/gb-greeter-project-row.h \
greeter/gb-greeter-window.c \
greeter/gb-greeter-window.h \
- html/gb-html-document.c \
- html/gb-html-document.h \
- html/gb-html-view.c \
- html/gb-html-view.h \
keybindings/gb-keybindings.c \
keybindings/gb-keybindings.h \
preferences/gb-preferences-page-editor.c \
@@ -157,8 +153,6 @@ libgnome_builder_la_SOURCES = \
util/gb-rgba.h \
util/gb-string.c \
util/gb-string.h \
- util/gb-webkit.c \
- util/gb-webkit.h \
util/gb-widget.c \
util/gb-widget.h \
views/gb-view-grid.c \
@@ -230,7 +224,6 @@ libgnome_builder_la_CFLAGS = \
-I$(srcdir)/documents \
-I$(srcdir)/editor \
-I$(srcdir)/greeter \
- -I$(srcdir)/html \
-I$(srcdir)/keybindings \
-I$(srcdir)/preferences \
-I$(srcdir)/project-tree \
diff --git a/src/editor/gb-editor-view-actions.c b/src/editor/gb-editor-view-actions.c
index 3575d3f..3cfd11a 100644
--- a/src/editor/gb-editor-view-actions.c
+++ b/src/editor/gb-editor-view-actions.c
@@ -26,7 +26,7 @@
#include "gb-editor-print-operation.h"
#include "gb-editor-view-actions.h"
#include "gb-editor-view-private.h"
-#include "gb-html-document.h"
+//#include "gb-html-document.h"
#include "gb-view-grid.h"
#include "gb-widget.h"
#include "gb-workbench.h"
@@ -619,6 +619,7 @@ gb_editor_view_actions_preview (GSimpleAction *action,
if (!lang_id)
return;
+#if 0
if (g_str_equal (lang_id, "html"))
{
document = g_object_new (GB_TYPE_HTML_DOCUMENT,
@@ -633,6 +634,7 @@ gb_editor_view_actions_preview (GSimpleAction *action,
gb_html_document_set_transform_func (GB_HTML_DOCUMENT (document),
gb_html_markdown_transform);
}
+#endif
if (document)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]