[Github-comments] [geany/geany-plugins] Extending markdown preview (#822)

Matthew Brush notifications at xxxxx
Sun Mar 31 23:06:27 UTC 2019


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.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/822#pullrequestreview-220888943
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190331/113ffa93/attachment-0001.html>


More information about the Github-comments mailing list