[Nice-commit] Nice/src/nice/tools/doc htmlwriter.nice,1.15,1.16
Brought to you by:
bonniot
From: Francis B. <fb...@us...> - 2004-09-02 13:52:52
|
Update of /cvsroot/nice/Nice/src/nice/tools/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6564/src/nice/tools/doc Modified Files: htmlwriter.nice Log Message: Method names, etc, should now be properly html encoded (eg, < -> <) Index: htmlwriter.nice =================================================================== RCS file: /cvsroot/nice/Nice/src/nice/tools/doc/htmlwriter.nice,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** htmlwriter.nice 2 Sep 2004 12:48:45 -0000 1.15 --- htmlwriter.nice 2 Sep 2004 13:52:41 -0000 1.16 *************** *** 63,67 **** writer.write(getHeader(c.getName().toString())); ! writer.write("<h1>Class " + c.getName() + "</h1>\n"); //Print hierarchy --- 63,67 ---- writer.write(getHeader(c.getName().toString())); ! writer.write("<h1>Class " + htmlEncode(c.getName()) + "</h1>\n"); //Print hierarchy *************** *** 87,91 **** } writer.write("<pre>\n"); ! writer.write(hierarchy); writer.write("</pre>\n"); --- 87,91 ---- } writer.write("<pre>\n"); ! writer.write(htmlEncode(hierarchy)); writer.write("</pre>\n"); *************** *** 96,100 **** writer.write("<ul>\n"); interfaces.foreach(ClassDefinition.Interface i => ! writer.write("<li>" + i.getName() + "</li>\n")); writer.write("</ul>\n"); } --- 96,100 ---- writer.write("<ul>\n"); interfaces.foreach(ClassDefinition.Interface i => ! writer.write("<li>" + htmlEncode(i.getName()) + "</li>\n")); writer.write("</ul>\n"); } *************** *** 105,108 **** --- 105,110 ---- comments = notNull(c.docString()); + //Note: the comments is deliberately not htmlEncoded because I want people + //to be able to put their own html in the comment. Comment c = new Comment(commentStr: comments); List<(?String, String)> tags = c.tags; *************** *** 142,149 **** writer.write(getHeader(gv.getName().toString())); ! writer.write("<h1>Global Variable " + gv.getName() + "</h1>\n"); ! writer.write(htmlSafe(gv.toString())); writer.write("<p>\n"); String comments; --- 144,153 ---- writer.write(getHeader(gv.getName().toString())); ! writer.write("<h1>Global Variable " + htmlEncode(gv.getName()) + "</h1>\n"); ! writer.write(htmlEncode(gv.toString())); + //Note: the comments is deliberately not htmlEncoded because I want people + //to be able to put their own html in the comment. writer.write("<p>\n"); String comments; *************** *** 173,182 **** writer.write(getHeader(m.getName().toString())); ! writer.write("<h1>Method " + m.getName() + "</h1>\n"); ! ! writer.write(htmlSafe(m.toString())); writer.write("<p>\n"); - writer.write("<p>"); String comments; if(m.docString() != null) --- 177,187 ---- writer.write(getHeader(m.getName().toString())); ! writer.write("<h1>Method " + htmlEncode(m.getName()) + "</h1>\n"); + writer.write(htmlEncode(m.toString())); + + //Note: the comments is deliberately not htmlEncoded because I want people + //to be able to put their own html in the comment. writer.write("<p>\n"); String comments; if(m.docString() != null) *************** *** 236,240 **** if(index != s.length()-1) s = s.substring(index+1); ! writer.write("<li><a href='" + escapeFilename(s) + ".html'>" + s + "</a></li>\n"); } writer.write("</ul>\n"); --- 241,245 ---- if(index != s.length()-1) s = s.substring(index+1); ! writer.write("<li><a href='" escapeFilename(s) ".html'>" htmlEncode(s) "</a></li>\n"); } writer.write("</ul>\n"); *************** *** 246,250 **** writer.write("<ul>\n"); for(MethodDeclaration m : methods) { ! writer.write("<li><a href='" escapeFilename(getMethodFilename(m)) ".html'>" m.getName() "</a>" + ": " m.getType() "</li>\n"); } --- 251,255 ---- writer.write("<ul>\n"); for(MethodDeclaration m : methods) { ! writer.write("<li><a href='" escapeFilename(getMethodFilename(m)) ".html'>" htmlEncode(m.getName()) "</a>" + ": " m.getType() "</li>\n"); } *************** *** 257,261 **** writer.write("<ul>\n"); for(GlobalVarDeclaration gv : globalVars) { ! writer.write("<li><a href='gv_" escapeFilename("" gv.getName()) ".html'>" gv.getName() "</a></li>\n"); } writer.write("</ul>\n"); --- 262,266 ---- writer.write("<ul>\n"); for(GlobalVarDeclaration gv : globalVars) { ! writer.write("<li><a href='gv_" escapeFilename("" gv.getName()) ".html'>" htmlEncode(gv.getName()) "</a></li>\n"); } writer.write("</ul>\n"); *************** *** 280,284 **** writer.write("<ul>\n"); for(bossa.modules.Package p : packages) { ! writer.write("<li><a href='" + p.getName().replace('.', "/") + "/index.html'>" + p.getName() + "</a></li>\n"); } writer.write("</ul>\n"); --- 285,289 ---- writer.write("<ul>\n"); for(bossa.modules.Package p : packages) { ! writer.write("<li><a href='" p.getName().replace('.', "/") "/index.html'>" htmlEncode(p.getName()) "</a></li>\n"); } writer.write("</ul>\n"); *************** *** 295,299 **** * although I've made some changes. */ ! String htmlSafe(String s) { StringBuffer sb = new StringBuffer(s.length()); //true if last char was blank - this is for handling non-breaking spaces --- 300,304 ---- * although I've made some changes. */ ! String htmlEncode(String s) { StringBuffer sb = new StringBuffer(s.length()); //true if last char was blank - this is for handling non-breaking spaces *************** *** 352,355 **** --- 357,367 ---- } + /** Convenience method that converts a LocatedString to a String and then htmlEncodes it. + * @param s the string to encode + */ + String htmlEncode(LocatedString s) { + return htmlEncode(s.toString()); + } + /** Returns a string containing everything required up to and including the <body> tag * @param title a String to be displayed in the browser's title bar |