rem: var str = "<html>\n" + "<head>\n" + "<title>HTMLTitle</title>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" + "</head>\n"+ "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n"; aStream.write(str, str.length);  
add: var dateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"] .getService(Components.interfaces.calIDateTimeFormatter);  var html = <html> <head> <title>HTMLTitle</title> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/> <style type='text/css'/> </head> <body> <!-- Note on the use of the summarykey class: this is a special class, because in the default style, it is hidden. The div is still included for those that want a different style, where the key is visible --> </body> </html>;      html.head.style = ".vevent {border: 1px solid black; padding: 0px; margin-bottom: 10px;}\n"; html.head.style += "div.key {font-style: italic; margin-left: 3px;}\n"; html.head.style += "div.value {margin-left: 20px;}\n"; html.head.style += "abbr {border: none;}\n"; html.head.style += ".summarykey {display: none;}\n"; html.head.style += "div.summary {background: lightgray; font-weight: bold; margin: 0px; padding: 3px;}\n";   aItems.sort(function (a,b) { return a.startDate.compare(b.startDate); });  
context: function html_exportToStream(aStream, aCount, aItems) {    var str =         "<html>\n" +        "<head>\n" +         "<title>HTMLTitle</title>\n" +        "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" +        "</head>\n"+ "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n";    aStream.write(str, str.length);       for each (item in aItems) {        try {            item = item.QueryInterface(Components.interfaces.calIEvent);        } catch(e) {            continue;        }        var start = item.startDate.jsDate;        var end = item.endDate.jsDate;        //var when = dateFormat.formatInterval(start, end, calendarEvent.allDay);        var when = item.startDate + " -- " + item.endDate;        dump(when+"\n");        var desc = item.description;        if (desc == null)          desc = "";        if (desc.length > 0) {           if (desc.indexOf("\n ") >= 0 || desc.indexOf("\n\t") >= 0 ||              desc.indexOf(" ") == 0 || desc.indexOf("\t") == 0)            // (RegExp /^[ \t]/ doesn't work.)            // contains indented preformatted text after beginning or newline            // so preserve indentation with PRE.            desc = "<PRE>"+desc+"</PRE>\n";          else            // no indentation, so preserve text line breaks in html with BR            desc = "<P>"+desc.replace(/\n/g, "<BR>\n")+"</P>\n";        }        // use div around each event so events are navigable via DOM.        str  = "<div><p>";        str += "<B>Title: </B>\t" + item.title + "<BR>\n";        str += "<B>When: </B>\t" + when.replace("--", "&ndash;") + "<BR>\n";        str += "<B>Where: </B>\t" + item.location + "<BR>\n";        // str += "<B>Organiser: </B>\t" + Event.???        str += "</p>\n";        str += desc; // may be empty        str += "</div>\n";        aStream.write(str, str.length);    }    str = "\n</body>\n</html>\n";    aStream.write(str, str.length);    return;};
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/bf0f4fc97ec7819dc65001fde0ea84e43b76c191/calHtmlExport.js/buggy/calendar/import-export/calHtmlExport.js