| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Code for converting HTML into text, for use in doc comments. | 6 * Code for converting HTML into text, for use in doc comments. |
| 7 */ | 7 */ |
| 8 library text.formatter; | 8 library text.formatter; |
| 9 | 9 |
| 10 import 'package:html5lib/dom.dart' as dom; | 10 import 'package:html5lib/dom.dart' as dom; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 case 'dt': | 112 case 'dt': |
| 113 case 'h1': | 113 case 'h1': |
| 114 case 'h2': | 114 case 'h2': |
| 115 case 'h3': | 115 case 'h3': |
| 116 case 'h4': | 116 case 'h4': |
| 117 case 'p': | 117 case 'p': |
| 118 lineBreak(true); | 118 lineBreak(true); |
| 119 addAll(node.nodes); | 119 addAll(node.nodes); |
| 120 lineBreak(true); | 120 lineBreak(true); |
| 121 break; | 121 break; |
| 122 case 'div': |
| 123 lineBreak(false); |
| 124 if (node.classes.contains('hangingIndent')) { |
| 125 resolveVerticalSpace(); |
| 126 indentSpecial('', ' ', () { |
| 127 addAll(node.nodes); |
| 128 lineBreak(false); |
| 129 }); |
| 130 } else { |
| 131 addAll(node.nodes); |
| 132 lineBreak(false); |
| 133 } |
| 134 break; |
| 122 case 'ul': | 135 case 'ul': |
| 123 lineBreak(false); | 136 lineBreak(false); |
| 124 addAll(node.nodes); | 137 addAll(node.nodes); |
| 125 lineBreak(false); | 138 lineBreak(false); |
| 126 break; | 139 break; |
| 127 case 'li': | 140 case 'li': |
| 128 lineBreak(false); | 141 lineBreak(false); |
| 129 resolveVerticalSpace(); | 142 resolveVerticalSpace(); |
| 130 indentSpecial('- ', ' ', () { | 143 indentSpecial('- ', ' ', () { |
| 131 addAll(node.nodes); | 144 addAll(node.nodes); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 237 |
| 225 /** | 238 /** |
| 226 * Process a list of HTML nodes. | 239 * Process a list of HTML nodes. |
| 227 */ | 240 */ |
| 228 void addAll(List<dom.Node> nodes) { | 241 void addAll(List<dom.Node> nodes) { |
| 229 for (dom.Node node in nodes) { | 242 for (dom.Node node in nodes) { |
| 230 add(node); | 243 add(node); |
| 231 } | 244 } |
| 232 } | 245 } |
| 233 } | 246 } |
| OLD | NEW |