[Mono-docs-list] aspx monodoc beginnings

John Luke jluke@cfl.rr.com
08 Jul 2003 23:28:05 -0400


--=-RPCSCrcoKh3osjpPZL2i
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,

Here is the start of an aspx monodoc for those that have xsp to try out.

It just uses monodoc --html and some javascript for the links.
It likely has the same problems as the cgi one, but is only meant for
local testing with xsp.

A couple of known problems:
no checking for non-monodoc urls
maybe insecure so please only run locally
uses Process.Start instead of its own provider/output

what works:
displays the docs at a url like monodocs.aspx?link=T:System.String
internal links work

just plop the two attached file to where you have xsp installed.

Thanks to BenM and tberman for helping out.

--=-RPCSCrcoKh3osjpPZL2i
Content-Disposition: attachment; filename=monodoc.js
Content-Type: text/plain; name=monodoc.js; charset=UTF-8
Content-Transfer-Encoding: 7bit

	function load ()
    {
    	objs = document.getElementsByTagName("a");
    	for (i = 0; i < objs.length; i++)
    	{
    		objs[i].href = "monodoc.aspx?link=" + objs[i].href;
    	}
    }
    
    navLink(obj)
    {
        window.location= "monodoc.aspx?link=" + obj.href;
    }
        

--=-RPCSCrcoKh3osjpPZL2i
Content-Disposition: attachment; filename=monodoc.aspx
Content-Type: application/x-asp; name=monodoc.aspx
Content-Transfer-Encoding: 7bit

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<html>
<head>
<script runat="server">

	public void Page_Load (object sender, EventArgs e)
	{
		string link = (string) Request.Params["link"];
		if (link == null)
			link = "N:System";
			
		LoadDocs (link);
	}
	
	void LoadDocs (string path)
	{
		string args = "--html " + path;
		ProcessStartInfo psi = new ProcessStartInfo ();
		psi.RedirectStandardOutput = true;
		psi.FileName = "monodoc";
		psi.Arguments = args;
		Process p = Process.Start (psi);
		string html = Transform (p.StandardOutput.ReadToEnd () );
		mySpan.InnerText = html;
	}
	
	string Transform (string input)
	{
		// add xslt stuff here
		string output = input;

		return output;
	}
</script>
<script src="monodoc.js" />

<title>Mono Documentation</title>
</head>
<body onLoad="load()">
<span id="mySpan" runat="server" />
</body>
</html>

--=-RPCSCrcoKh3osjpPZL2i--