Re: Kind of a patch for sgml importer

David Malcolm <[email protected]> Fri, 08 Apr 2005 12:11:43 -0400
Newsgroups gmane.editors.conglomerate.devel
Message-ID <[email protected]>
On Fri, 2005-04-08 at 16:57 +0200, Michèle Garoche wrote:
> I say kind of because it does not rely on sgml2x which is not ported on 
> Fink, but on osx (part of opensp4), which does the same thing, but 
> needs two options for it to work properly, I don't know if sgml2x needs 
> option too.

Thanks.  To be frank I haven't looked at this plugin in a long time
(maybe 2 years?), I've no idea if it works for me anymore.

osx seems to be part of the openjade package on Fedora; I'm wondering
how available this is on other distributions.  

I know people are using Conglomerate on Debian, Gentoo, Mandrake (as
well as Fedora and Fink); speak up!  Would this be OK?

Maybe we should have a configure.in test for this, and enable the plugin
accordingly?

> 
> Hence there are a few lines which does not apply (changes to the tool 
> and number and value of argv):
> 
> It is borrowed from bluefish, so I'll guess it should work on 
> conglomerate. It works on Mac.

That's reassuring; suggests this should work.  Does Bluefish have any
configure.in tests we could copy?  (assuming that's OK with them)

> 
> Basically it takes the gnomevfsuri, transforms it to a string hidding 
> some parts depending on whether it is local or not, then returns it to 
> the function casting it.
I think this already exists.  Does src/cong-vfs.h:
cong_vfs_get_local_path_from_uri work for you?

> 
> --- conglomerate/src/plugin-sgml.c	Thu Apr  7 17:59:14 2005
> +++ conglomerate/src/plugin-sgml-patched.c	Fri Apr  8 04:20:11 2005
> @@ -79,6 +79,22 @@
>   }
>   #endif
> 
> +gchar *uri_to_system_filename(GnomeVFSURI *uri) {
> +	if (gnome_vfs_uri_is_local(uri)) {
> +		return gnome_vfs_uri_to_string(uri, 
> GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD);
> +	} else {
> +		return gnome_vfs_uri_to_string(uri, GNOME_VFS_URI_HIDE_PASSWORD);
> +	}
> +}
> +
> +gchar *uri_to_system_filename2(gchar *uri) {
> +	gchar *ret;
> +	GnomeVFSURI *guri = gnome_vfs_uri_new(uri);
> +	ret = uri_to_system_filename(guri);
> +	gnome_vfs_uri_unref(guri);
> +	return ret;
> +}
> +
>   /**
>    * sgml_importer_action_callback:
>    * @importer:
> @@ -99,21 +115,22 @@
>   	xmlDocPtr xml_doc;
> 
>   #if 1
> -	gchar *argv[3];
> +	gchar *argv[5];
>   	gchar *standard_output;
>   	gchar *standard_error;
>   	gint exit_status;
>   	GError *error = NULL;
>   	gboolean result;
> 
> -/* 	gchar * posix_name = cong_util_get_local_path_from_uri(GnomeVFSURI 
> *uri); */
> -
> +  gchar * posix_name = uri_to_system_filename2((gchar*)uri);	
> 
>   	g_message("sgml_importer_action_callback");
> 
> -	argv[0] = "sgml2xml";
> -	argv[1] = (gchar*)uri; /* FIXME: this is GnomeVFS uri path string, 
> not a POSIX path */
> -	argv[2] = NULL;
> +	argv[0] = "osx";
> +	argv[1] = "-xno-nl-in-tag";
> +	argv[2] = "-xlower";
> +	argv[3] = (gchar*)posix_name; /* FIXME: this is GnomeVFS uri path 
> string, not a POSIX path */
> +	argv[4] = NULL;
> 
> 
>   	/* Spawn a subprocess that runs sgml2xml on the uri and grabs the 
> output: */