| 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 /// Simple script to generate a page summarizing all error messages produces by | 5 /// Simple script to generate a page summarizing all error messages produces by |
| 6 /// the polymer compiler code. The generated code will be placed directly under | 6 /// the polymer compiler code. The generated code will be placed directly under |
| 7 /// the `polymer/lib/src/generated` folder. This script should be invoked from | 7 /// the `polymer/lib/src/generated` folder. This script should be invoked from |
| 8 /// the root of the polymer package either by doing: | 8 /// the root of the polymer package either by doing: |
| 9 /// | 9 /// |
| 10 /// dart tool/create_message_details_page.dart | 10 /// dart tool/create_message_details_page.dart |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 var id = template.id; | 84 var id = template.id; |
| 85 var hashTag = '${id.package}_${id.id}'; | 85 var hashTag = '${id.package}_${id.id}'; |
| 86 var title = '### ${template.description} [#${id.id}](#$hashTag)'; | 86 var title = '### ${template.description} [#${id.id}](#$hashTag)'; |
| 87 var body = '\n$details\n\n----\n\n'; | 87 var body = '\n$details\n\n----\n\n'; |
| 88 // We add the anchor inside the <h3> title, otherwise the link doesn't work. | 88 // We add the anchor inside the <h3> title, otherwise the link doesn't work. |
| 89 if (forSite) { | 89 if (forSite) { |
| 90 sb..write(title) | 90 sb..write(title) |
| 91 ..write('\n{: #$hashTag}\n') | 91 ..write('\n{: #$hashTag}\n') |
| 92 ..write(body); | 92 ..write(body); |
| 93 } else { | 93 } else { |
| 94 var html = markdownToHtml('$title$body') | 94 var html = markdownToHtml('$title$body').replaceFirst('<hr', '</div><hr'); |
| 95 .replaceFirst('<h3>', '<h3 id="$hashTag">'); | 95 sb.write('\n\n<div id="$hashTag">$html'); |
| 96 sb.write('\n\n$html'); | |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 | 98 |
| 100 _parseOptions(args) { | 99 _parseOptions(args) { |
| 101 var parser = new ArgParser(allowTrailingOptions: true) | 100 var parser = new ArgParser(allowTrailingOptions: true) |
| 102 ..addOption('out', abbr: 'o', | 101 ..addOption('out', abbr: 'o', |
| 103 defaultsTo: 'lib/src/build/generated/messages.html', | 102 defaultsTo: 'lib/src/build/generated/messages.html', |
| 104 help: 'the output file path') | 103 help: 'the output file path') |
| 105 ..addFlag('site', abbr: 's', negatable: false, | 104 ..addFlag('site', abbr: 's', negatable: false, |
| 106 help: 'generate contents for the dartlang.org site') | 105 help: 'generate contents for the dartlang.org site') |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 font-family: 'Roboto'; | 182 font-family: 'Roboto'; |
| 184 font-style: normal; | 183 font-style: normal; |
| 185 font-weight: 400; | 184 font-weight: 400; |
| 186 src: url(https://themes.googleusercontent.com/static/fonts/roboto/v10/CrYjSnGj
rRCn0pd9VQsnFOvvDin1pK8aKteLpeZ5c0A.woff) format('woff'); | 185 src: url(https://themes.googleusercontent.com/static/fonts/roboto/v10/CrYjSnGj
rRCn0pd9VQsnFOvvDin1pK8aKteLpeZ5c0A.woff) format('woff'); |
| 187 } | 186 } |
| 188 | 187 |
| 189 body { | 188 body { |
| 190 width: 80vw; | 189 width: 80vw; |
| 191 margin: 20px; | 190 margin: 20px; |
| 192 font-family: Roboto, sans-serif; | 191 font-family: Roboto, sans-serif; |
| 192 background-color: #f0f0f0; |
| 193 } | 193 } |
| 194 | 194 |
| 195 h2 { | 195 h2 { |
| 196 font-family: Montserrat, sans-serif; | 196 font-family: Montserrat, sans-serif; |
| 197 box-sizing: border-box; | 197 box-sizing: border-box; |
| 198 color: rgb(72, 72, 72); | 198 color: rgb(72, 72, 72); |
| 199 display: block; | 199 display: block; |
| 200 font-style: normal; | 200 font-style: normal; |
| 201 font-variant: normal; | 201 font-variant: normal; |
| 202 font-weight: normal; | 202 font-weight: normal; |
| 203 } | 203 } |
| 204 | 204 |
| 205 div:target { |
| 206 background-color: #fff; |
| 207 border: 1px solid #888; |
| 208 border-radius: 5px; |
| 209 padding: 0px 10px 2px 10px; |
| 210 box-shadow: 7px 7px 5px #888888; |
| 211 margin-bottom: 15px; |
| 212 } |
| 213 |
| 214 |
| 205 h3 { | 215 h3 { |
| 206 font-family: Montserrat, sans-serif; | 216 font-family: Montserrat, sans-serif; |
| 207 box-sizing: border-box; | 217 box-sizing: border-box; |
| 208 color: rgb(72, 72, 72); | 218 color: rgb(72, 72, 72); |
| 209 display: block; | 219 display: block; |
| 210 font-style: normal; | 220 font-style: normal; |
| 211 font-variant: normal; | 221 font-variant: normal; |
| 212 font-weight: normal; | 222 font-weight: normal; |
| 213 } | 223 } |
| 214 | 224 |
| 225 div:target > h3 { |
| 226 font-weight: bold; |
| 227 } |
| 228 |
| 215 pre { | 229 pre { |
| 216 display: block; | 230 display: block; |
| 217 padding: 9.5px; | 231 padding: 9.5px; |
| 218 margin: 0 0 10px; | 232 margin: 0 0 10px; |
| 219 color: #333; | 233 color: #333; |
| 220 word-break: break-all; | 234 word-break: break-all; |
| 221 word-wrap: break-word; | 235 word-wrap: break-word; |
| 222 background-color: #f5f5f5; | 236 background-color: #f5f5f5; |
| 223 border: 1px solid #ccc; | 237 border: 1px solid #ccc; |
| 224 border-radius: 4px; | 238 border-radius: 4px; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 254 display: inline; | 268 display: inline; |
| 255 } | 269 } |
| 256 </style> | 270 </style> |
| 257 <body> | 271 <body> |
| 258 '''; | 272 '''; |
| 259 | 273 |
| 260 const _LOCAL_FOOTER = ''' | 274 const _LOCAL_FOOTER = ''' |
| 261 </body> | 275 </body> |
| 262 </html> | 276 </html> |
| 263 '''; | 277 '''; |
| OLD | NEW |