diff options
author | Jonathan Pryor <jpryor@novell.com> | 2010-03-01 03:14:48 +0300 |
---|---|---|
committer | Jonathan Pryor <jpryor@novell.com> | 2010-03-01 03:14:48 +0300 |
commit | 87f6eab1bc79af6ae0f23dd3eb0b4c5634debb1a (patch) | |
tree | 5c5132263d51a1981241511b53eec9a3b4a3c3bd /mcs/tools | |
parent | 2778fd63180903e87caade07d7eb975301273648 (diff) |
* Makefile: Add System.Xml.Linq.dll to the referenced assemblies.
* Mono.Documentation/webdoc.cs: Allow .source files to be provided to
'mdoc export-html-webdoc', which will cause the .source files to be
read and all referenced .tree/.zip files to be processed.
svn path=/branches/mono-2-6/mcs/; revision=152642
Diffstat (limited to 'mcs/tools')
-rw-r--r-- | mcs/tools/mdoc/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/tools/mdoc/Makefile | 1 | ||||
-rw-r--r-- | mcs/tools/mdoc/Mono.Documentation/webdoc.cs | 36 |
3 files changed, 42 insertions, 1 deletions
diff --git a/mcs/tools/mdoc/ChangeLog b/mcs/tools/mdoc/ChangeLog index a2597ede6f3..1fabf4aa6cf 100644 --- a/mcs/tools/mdoc/ChangeLog +++ b/mcs/tools/mdoc/ChangeLog @@ -1,5 +1,11 @@ 2010-02-28 Jonathan Pryor <jpryor@novell.com> + * Mono.Documentation/webdoc.cs: Allow .source files to be provided to + 'mdoc export-html-webdoc', which will cause the .source files to be + read and all referenced .tree/.zip files to be processed. + +2010-02-28 Jonathan Pryor <jpryor@novell.com> + * Mono.Documentation/webdoc.cs: Add --use-system-sources option so that 'mdoc export-html-webdoc' will use the system-installed sources in addition to any -r'd sources (which was the behavior 2 commits diff --git a/mcs/tools/mdoc/Makefile b/mcs/tools/mdoc/Makefile index e0ebe60c112..6b33b76e1df 100644 --- a/mcs/tools/mdoc/Makefile +++ b/mcs/tools/mdoc/Makefile @@ -12,6 +12,7 @@ LOCAL_MCS_FLAGS = \ /resource:Resources/overview.xsl,overview.xsl \ /resource:Resources/stylesheet.xsl,stylesheet.xsl \ /r:System.Web.dll \ + /r:System.Xml.Linq.dll \ /r:ICSharpCode.SharpZipLib.dll \ /r:$(topdir)/class/lib/net_1_1/monodoc.dll \ /r:$(topdir)/class/lib/net_1_1/Mono.Cecil.dll diff --git a/mcs/tools/mdoc/Mono.Documentation/webdoc.cs b/mcs/tools/mdoc/Mono.Documentation/webdoc.cs index 264fb42b798..045ab81341e 100644 --- a/mcs/tools/mdoc/Mono.Documentation/webdoc.cs +++ b/mcs/tools/mdoc/Mono.Documentation/webdoc.cs @@ -33,6 +33,7 @@ using System.IO; using System.Linq; using System.Text; using System.Web; +using System.Xml.Linq; using Monodoc; using Mono.Documentation; @@ -85,9 +86,12 @@ namespace Mono.Documentation Parse (options, args, "export-html-webdoc", "[OPTIONS]+ FILES", "Export mdoc documentation within FILES to HTML for use by ASP.NET webdoc.\n\n" + - "FILES are .tree or .zip files as produced by 'mdoc assemble'."); + "FILES are .tree or .zip files as produced by 'mdoc assemble', or .source files\n" + + "which reference .tree and .zip files produced by 'mdoc assemble'.\n\n" + + "See mdoc(5) or mdoc-assemble(1) for information about the .source file format."); if (opts.Formats.Values.All (files => files.Count == 0)) Error ("No files specified."); + ProcessSources (opts); HelpSource.use_css = true; HelpSource.FullHtml = false; SettingsHandler.Settings.EnableEditing = false; @@ -95,6 +99,36 @@ namespace Mono.Documentation ProcessFiles (opts, p.Key, p.Value); } + void ProcessSources (Options opts) + { + foreach (var p in opts.Formats) { + var files = p.Value; + foreach (var f in files.Where (f => f.EndsWith (".source")).ToList ()) { + files.Remove (f); + foreach (var tfi in GetTreeFilesFromSource (f)) { + List<string> treeFiles; + if (!opts.Formats.TryGetValue (tfi.Key, out treeFiles)) + opts.Formats.Add (tfi.Key, treeFiles = new List<string> ()); + treeFiles.Add (tfi.Value); + } + } + } + } + + IEnumerable<KeyValuePair<string, string>> GetTreeFilesFromSource (string sourceFile) + { + try { + var source = XElement.Load (sourceFile); + return source.Descendants ("source") + .Select (e => new KeyValuePair<string, string>(e.Attribute ("provider").Value, + Path.Combine (Path.GetDirectoryName (sourceFile), e.Attribute ("basefile").Value + ".tree"))); + } + catch (Exception e) { + Message (TraceLevel.Error, "mdoc: error parsing file {0}: {1}", sourceFile, e.Message); + return new KeyValuePair<string, string>[0]; + } + } + void ProcessFiles (Options opts, string format, List<string> files) { foreach (var basePath in |