[Gd-chatter] r11205 - in trunk/libraries: network/koala/sources/examples/code-browser network/koala/sources/koala network/koala/www/code-browser network/web-framework xml-parser

turbo24prg at gwydiondylan.org turbo24prg at gwydiondylan.org
Thu Feb 22 22:44:09 CET 2007


Author: turbo24prg
Date: Thu Feb 22 22:44:05 2007
New Revision: 11205

Modified:
   trunk/libraries/network/koala/sources/examples/code-browser/main.dylan
   trunk/libraries/network/koala/sources/koala/server.dylan
   trunk/libraries/network/koala/www/code-browser/project.dsp
   trunk/libraries/network/web-framework/changes.dylan
   trunk/libraries/network/web-framework/library.dylan
   trunk/libraries/xml-parser/productions.dylan
Log:
Job: minor
 - fixed bug in koala
 - fail-safe generate-atom for content
 - implemented some other features from environment into code-browser


Modified: trunk/libraries/network/koala/sources/examples/code-browser/main.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/examples/code-browser/main.dylan	(original)
+++ trunk/libraries/network/koala/sources/examples/code-browser/main.dylan	Thu Feb 22 22:44:05 2007
@@ -158,8 +158,36 @@
           library: project-library(*project*), module: first(library-modules(*project*, project-library(*project*))))))))));
 end;
 
-//environment-object-source-location  source-location-string
-//source-location-source-record
+
+define tag used-definitions in code-browser
+  (page :: <code-browser-page>, response :: <response>)
+  ()
+    format(response.output-stream, "<ul>\n");
+    for (used-definition in source-form-used-definitions(*project*, project-library(*project*)))
+      format(response.output-stream, "<li>%s</li>", markup-dylan-source(environment-object-display-name(*project*, used-definition, #f)))
+    end for;
+    format(response.output-stream, "</ul>\n");
+end;
+
+define tag clients in code-browser
+  (page :: <code-browser-page>, response :: <response>)
+  ()
+    format(response.output-stream, "<ul>\n");
+    for (used-definition in source-form-clients(*project*, project-library(*project*)))
+      format(response.output-stream, "<li>%s</li>", markup-dylan-source(environment-object-display-name(*project*, used-definition, #f)))
+    end for;
+    format(response.output-stream, "</ul>\n");
+end;
+
+define tag project-warnings in code-browser
+  (page :: <code-browser-page>, response :: <response>)
+  ()
+    format(response.output-stream, "<ul>\n");
+    for (warning in project-warnings(*project*))
+      format(response.output-stream, "<li>%s</li>", markup-dylan-source(environment-object-display-name(*project*, warning, #f)))
+    end for;
+    format(response.output-stream, "</ul>\n");
+end;
 
 /// Main
 

Modified: trunk/libraries/network/koala/sources/koala/server.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/server.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/server.dylan	Thu Feb 22 22:44:05 2007
@@ -702,7 +702,7 @@
     let n = kludge-read-into!(request-socket(request), content-length, buffer);
     assert(n == content-length, "Unexpected incomplete read");
     request-content(request)
-      := process-request-content(request-content-type(request), buffer, content-length);
+      := process-request-content(request-content-type(request), request, buffer, content-length);
   end
 end read-request-content;
 

Modified: trunk/libraries/network/koala/www/code-browser/project.dsp
==============================================================================
--- trunk/libraries/network/koala/www/code-browser/project.dsp	(original)
+++ trunk/libraries/network/koala/www/code-browser/project.dsp	Thu Feb 22 22:44:05 2007
@@ -12,6 +12,10 @@
 	<code-browser:project-modules/>	
 	<h2>Used libraries</h2>
 	<code-browser:project-used-libraries/>
+	<h2>Used definitions</h2>
+	<code-browser:used-definitions/>
+	<h2>Clients</h2>
+	<code-browser:clients/>
 	<h2>Superclasses of &lt;string&gt;</h2>
 	<code-browser:project-direct-superclasses/>
 	<h2>Subclasses of &lt;string&gt;</h2>
@@ -22,6 +26,8 @@
 	<code-browser:find-section-for-method/>
 	<h2>Definition of generic concatenate</h2>
 	<code-browser:find-section-for-definition/>
+	<h2>Warnings</h2>
+	<code-browser:project-warnings/>
 	<h2>Source Code</h2>
 	<code-browser:project-sources/>
 </body>

Modified: trunk/libraries/network/web-framework/changes.dylan
==============================================================================
--- trunk/libraries/network/web-framework/changes.dylan	(original)
+++ trunk/libraries/network/web-framework/changes.dylan	Thu Feb 22 22:44:05 2007
@@ -100,7 +100,7 @@
 
 define abstract class <content> (<object>)
   /* slot CommonAttributes */
-  slot type :: <string>, init-keyword: type:;
+  slot type :: <string> = "text", init-keyword: type:;
   slot content :: <text>, init-keyword: content:;
 end;
 
@@ -206,7 +206,7 @@
         title(feed.title),
         link(first(feed.links)),
         description(feed.description),
-        language(feed.language),
+//        language(feed.language),
         copyright(feed.rights),
         pubDate(as-rfc822-string(feed.published)),
         image {
@@ -333,8 +333,25 @@
 
 define method generate-atom (con :: <content>, #key)
   with-xml()
-    content {
+    content(type => con.type) {
       text(con.content)
     }
+  end
+end;
+
+define method generate-atom (con :: <xhtml-content>, #key)
+  let document = parse-document(concatenate("<div>", con.content, "</div>"));
+  if (document)
+    let atom-content = with-xml()
+      content(type => con.type) {
+        div (xmlns :: xhtml => "http://www.w3.org/1999/xhtml")
+      }
+    end;
+    atom-content.node-children[0].xml-name := "xhtml:div";
+    atom-content.node-children[0].node-children :=
+      root(document).node-children;
+    atom-content;
+  else
+    next-method();
   end;
 end;

Modified: trunk/libraries/network/web-framework/library.dylan
==============================================================================
--- trunk/libraries/network/web-framework/library.dylan	(original)
+++ trunk/libraries/network/web-framework/library.dylan	Thu Feb 22 22:44:05 2007
@@ -6,7 +6,7 @@
   use dylan;
   use io;
   use koala, import: { koala, dsp };
-  use xml-parser, import: { simple-xml };
+  use xml-parser;
   use system, import: { file-system, date, locators };
   use dood;
 
@@ -147,6 +147,10 @@
   use common-dylan;
   use dylan;
   use date;
+  use xml-parser,
+    import: { node-children, node-children-setter,
+              parse-document, root,
+              name-setter => xml-name-setter};
   use simple-xml;
 
   use object-table;

Modified: trunk/libraries/xml-parser/productions.dylan
==============================================================================
--- trunk/libraries/xml-parser/productions.dylan	(original)
+++ trunk/libraries/xml-parser/productions.dylan	Thu Feb 22 22:44:05 2007
@@ -54,7 +54,7 @@
 			        print-warnings? = #f,
 				dtd-paths = #f,
  			        ignore-instructions? = #f)
- => (stripped-tree :: <document>)
+ => (stripped-tree :: false-or(<document>))
   initialize-latin1-entities();
   *show-warnings?* := print-warnings?;
   *defining-entities?* := #f;
@@ -63,8 +63,10 @@
   *substitute-entities?* := substitute-entities?;
   if(dtd-paths) *dtd-paths* := dtd-paths; end if;
   let (index, document) = scan-document-helper(doc, start: start, end: stop);
-  transform-document(document, state: make(<add-parents>));
-  document;
+  if (document)
+    transform-document(document, state: make(<add-parents>));
+    document;
+  end if;
 end function parse-document;
 
 define thread variable *modify?* :: <boolean> = #t;



More information about the chatter mailing list