Index: dart/utils/dartdoc/dartdoc.dart |
=================================================================== |
--- dart/utils/dartdoc/dartdoc.dart (revision 2559) |
+++ dart/utils/dartdoc/dartdoc.dart (working copy) |
@@ -570,7 +570,7 @@ |
if (includeSource && showCode) { |
writeln('<pre class="source">'); |
- write(formatCode(span)); |
+ writeln(md.escapeHtml('${unindentCode(span)}')); |
Bob Nystrom
2011/12/19 23:17:34
You don't need to interpolate here.
michael.haubenwallner
2011/12/20 08:54:54
Small problem on the client side: when the code st
Bob Nystrom
2011/12/20 18:46:36
Right, sorry if I wasn't clear. Escaping is defini
|
writeln('</pre>'); |
} |
@@ -699,9 +699,9 @@ |
} |
/** |
- * Takes a string of Dart code and turns it into sanitized HTML. |
+ * Unindents a bunch of Dart code lines |
Bob Nystrom
2011/12/19 23:17:34
This needs a better comment. Just take the "Remove
michael.haubenwallner
2011/12/20 08:54:54
Done.
Bob Nystrom
2011/12/20 18:46:36
When you've made changes during a review, you have
|
*/ |
- formatCode(SourceSpan span) { |
+ unindentCode(SourceSpan span) { |
// Remove leading indentation to line up with first line. |
final column = getSpanColumn(span); |
final lines = span.text.split('\n'); |
@@ -711,7 +711,15 @@ |
} |
final code = Strings.join(lines, '\n'); |
+ return code; |
+ } |
+ /** |
+ * Takes a string of Dart code and turns it into sanitized HTML. |
+ */ |
+ formatCode(SourceSpan span) { |
+ final code = unindentCode(span); |
+ |
// Syntax highlight. |
return classifySource(new SourceFile('', code)); |
} |