With only few lines of code modification, I am now using the Mardown geany plugin as a svg image viewer (adding any other file that a Webkit supports is possible too, I only added .svg and .html). This is really handy for me; I can now write my code, run them and plot the outpouts without leaving geany IDE :-). Any interest in merging these with the upsteram branch?
A side note: I have also changed the (internal) name of Tree Browser, the previous one kept appearing after Scope plugin tabs which was not ideal
You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/822
-- Commit Summary --
* markdown plugin extended: now it supports viewing .svg and .html files * Update viewer.c * Update README
-- File Changes --
M markdown/README (3) M markdown/src/plugin.c (18) M markdown/src/viewer.c (9) M treebrowser/src/treebrowser.c (2)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/822.patch https://github.com/geany/geany-plugins/pull/822.diff
codebrainz requested changes on this pull request.
I didn't review the code in-depth since there are so many simple things wrong.
It seems to me it might be better to use the WebHelper plugin or develop a new plugin for real-time editing of other formats. I could possibly be persuaded otherwise though.
@@ -122,7 +122,7 @@ PLUGIN_VERSION_CHECK(224)
PLUGIN_SET_TRANSLATABLE_INFO( LOCALEDIR, GETTEXT_PACKAGE, - _("TreeBrowser"), + _("FileTreeBrowser"),// affects the alphabetical sorting in sidebar, puts TreeBrowser just after "Documents"
This is unrelated to the pull request.
@@ -383,7 +389,8 @@ markdown_viewer_update_view(MarkdownViewer *self)
* substituting the file's basename for `index.html`. */ if (DOC_VALID(doc) && doc->real_path != NULL) { gchar *base_dir = g_path_get_dirname(doc->real_path); - base_path = g_build_filename(base_dir, "index.html", NULL); + //base_path = g_build_filename(base_dir, "index.html", NULL);
There's no need to comment out-lines, the old code can be found in Git history.
@@ -337,6 +337,12 @@ markdown_viewer_get_html(MarkdownViewer *self)
update_internal_text(self, ""); }
+ if((self->priv->text->len > 1) && (self->priv->text->str[0]=='<') ) + { + html = g_malloc(strlen(self->priv->text->str) + 1); + strcpy(html, self->priv->text->str); html[strlen(self->priv->text->str)]='\0'; + } + else
Weird code formatting and indentation and stuff. Please follow the same style and formatting as the other code.
@@ -166,12 +166,24 @@ update_markdown_viewer(MarkdownViewer *viewer)
{ GeanyDocument *doc = document_get_current();
- if (DOC_VALID(doc) && g_strcmp0(doc->file_type->name, "Markdown") == 0) { + if (DOC_VALID(doc) && g_strcmp0(doc->file_type->name, "Markdown") == 0) + {
Why move the brace down?
gchar *text;
text = (gchar*) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0); markdown_viewer_set_markdown(viewer, text, doc->encoding); gtk_widget_set_sensitive(g_export_html, TRUE); - } else { + } + else if (DOC_VALID(doc) && doc->file_name) + { if( strrchr(doc->file_name,'.') && ( (g_strcmp0(strrchr(doc->file_name,'.'), ".svg")==0) || (g_strcmp0(strrchr(doc->file_name,'.' ), ".html")==0) ) ) + { + gchar *text; + text = (gchar*) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0); + markdown_viewer_set_markdown(viewer, text, doc->encoding); + gtk_widget_set_sensitive(g_export_html, FALSE); + } + } + else + {
Weird formatting and indentation. Please follow the style and formatting of the other code.
@@ -43,7 +43,7 @@ PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE,
# define MARKDOWN_HELP_FILE MARKDOWN_DOC_DIR "/html/help.html" #endif
-#define MARKDOWN_PREVIEW_LABEL _("Markdown Preview") +#define MARKDOWN_PREVIEW_LABEL _("Markdown")
This doesn't have anything to do with the pull request.
@aliraeini pushed 2 commits.
ea079d2859be7f2eeb8deac9ec3f1586c613dd09 Merge branch 'master' of https://github.com/geany/geany-plugins a17f2c494e05e6949fc198b77a2bf0e5456cd2d9 clean up and merge with upstream
@aliraeini pushed 1 commit.
8930aebe8e5f9b6ac7158ffc24611e3a22af42bb Update README
@aliraeini pushed 1 commit.
c8d40542475e8658899a9dd8229def8ad4cdb294 Update README
@aliraeini pushed 1 commit.
d61e7184f5b78c9efaf3d98d2ca7573ff0d42a3b Update README
@aliraeini pushed 1 commit.
3bb8eda96f7b4021fb67d30218ef4569eac441b8 Update README
@aliraeini pushed 1 commit.
641a9b1039ae21d288e0d70d4706d13044b07d06 Update README
@aliraeini pushed 1 commit.
4e2772ad48d37a6a3c856726ebd36804b22a89d3 Update README
@aliraeini pushed 1 commit.
65badb55ebf55724db5051809b3be80cf068b41a Update README
@aliraeini pushed 1 commit.
89a5a4716cb102dda84e7c20dce65b2673375fd4 Update README
@aliraeini pushed 1 commit.
3bdcc60be6ef670f389b5b27b95c7c7cc44ca8d9 Update README
@aliraeini pushed 1 commit.
2aef90e38d0f01401948871a8c0667fd376926ca Update README
@aliraeini pushed 1 commit.
eef16596a57aab3a1bd4fce4ed46331a91fc5f88 Update README
@aliraeini pushed 1 commit.
db4d01b1747a7a3db4638a8c8c6bcad9b7104b01 Update README
@aliraeini pushed 1 commit.
0e0f11e61f3ae6f7131d27ffcc6b3d1120600012 Update README
github-comments@lists.geany.org