{
static void Main (string[] args)
{
- if (args.Length != 1)
+ if (args.Length < 1)
{
Console.WriteLine ("Usage: mod.exe Url");
return;
}
+ bool index = (args.Length == 2);
+
RootTree help_tree = RootTree.LoadTree ();
+ if (index){
+ Console.WriteLine ("Building index");
+ RootTree.MakeIndex ();
+ return;
+ }
Node n;
Console.WriteLine (help_tree.RenderUrl (args[0], out n));
}
LIB_MCS_FLAGS = \
/codepage:utf8 \
- /nowarn:169,164,162,168,219 \
+ /nowarn:169,164,162,168,219,618,612 \
/r:Commons.Xml.Relaxng \
/resource:../../docs/monodoc.xml,monodoc.xml \
/resource:Resources/base.css,base.css \
}
//
- // Populates the index.
+ // Populates the searchable index.
+ //
+ // The idea of this index is to capture the most common search terms, the UI for this
+ // usually updates automatically as the user types.
//
public override void PopulateIndex (IndexMaker index_maker)
{
string doc_tag = GetKindFromCaption (type_node.Caption);
string url = "T:" + full;
-
+
+
+ //
+ // Add MonoMac/MonoTouch [Export] attributes, those live only in classes
+ //
+ if (doc_tag == "Class" && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"))){
+ try {
+ string rest;
+ var xdoc = GetXmlFromUrl (type_node.URL, out rest);
+ if (xdoc != null){
+ var nodesWithExports = xdoc.SelectNodes ("/Type/Members/Member[contains (Attributes/Attribute/AttributeName, 'Foundation.Export') and (MemberType='Property' or MemberType='Method' or MemberType='Constructor')]");
+
+ foreach (XmlNode n in nodesWithExports){
+ string cref = EcmaDoc.GetCref ((XmlElement) n);
+
+ var exports = n.SelectNodes ("Attributes/Attribute/AttributeName");
+ foreach (XmlNode exportNode in exports){
+ var inner = exportNode.InnerText;
+ int p = inner.IndexOf ("Foundation.Export(\"");
+ if (p == -1){
+ Console.WriteLine ("Not found the Export attribute in {0}", inner);
+ continue;
+ }
+ var pa = inner.IndexOf ("\"", p);
+ if (pa == -1){
+ Console.WriteLine ("Export has no target in {0}", inner);
+ continue;
+ }
+ var end = inner.IndexOf ("\"", pa+1);
+
+ var export = end == -1 ? inner.Substring (pa+1) : inner.Substring (pa+1, end-(pa+1));
+
+ Console.WriteLine ("{0} to {1}", export, cref);
+ index_maker.Add (export + " selector", export, cref);
+ }
+ }
+ }
+ } catch (Exception e){
+ Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
+ }
+ }
+
if (doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"){
index_maker.Add (type_node.Caption, typename, url);
// index.cs: Handling of the index files
//
// Author:
-// Miguel de Icaza (miguel@ximian.com)
+// Miguel de Icaza (miguel@xamarin.com)
//
// (C) 2003 Ximian, Inc.
+// Copyright 2003-2011 Novell Inc
+// Copyright 2011 Xamarin Inc.
//
// Possible file format optimizations:
// * Do not use 4 bytes for each index entry, use 3 bytes
}
}
}
- Console.WriteLine ("Basedir={0}", basedir);
//
// Load the layout
//
// Load the sources
//
- foreach (var sourceFile in sourceFiles){
+ foreach (var sourceFile in sourceFiles)
root.AddSourceFile (sourceFile);
- }
foreach (string path in UncompiledHelpSources) {
EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
// No octal in C#, how lame is that
chmod (path, 0x1a4);
}
- Console.WriteLine ("Documentation index updated");
+ Console.WriteLine ("Documentation index at {0} updated", path);
}
static bool IsUnix {