Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: pkg/polymer/tool/create_message_details_page.dart

Issue 780813003: generate new message details page and fix logic for injecting {%raw} tags only when making messages… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/src/build/generated/messages.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 'Currently set for both `$name` and `${seen[id]}`.'); 74 'Currently set for both `$name` and `${seen[id]}`.');
75 } 75 }
76 seen[id] = name; 76 seen[id] = name;
77 templates.add(template); 77 templates.add(template);
78 }); 78 });
79 } 79 }
80 80
81 _generateMessage(MessageTemplate template, bool forSite, StringBuffer sb) { 81 _generateMessage(MessageTemplate template, bool forSite, StringBuffer sb) {
82 var details = template.details == null 82 var details = template.details == null
83 ? 'No details available' : template.details; 83 ? 'No details available' : template.details;
84 if (forSite) details = '{% raw %}$details{% endraw %}';
84 var id = template.id; 85 var id = template.id;
85 var hashTag = '${id.package}_${id.id}'; 86 var hashTag = '${id.package}_${id.id}';
86 var title = '### ${template.description} [#${id.id}](#$hashTag)'; 87 var title = '### ${template.description} [#${id.id}](#$hashTag)';
87 var body = '\n{% raw %}$details{% endraw %}\n\n----\n\n'; 88 var body = '\n$details\n\n----\n\n';
88 // We add the anchor inside the <h3> title, otherwise the link doesn't work. 89 // We add the anchor inside the <h3> title, otherwise the link doesn't work.
89 if (forSite) { 90 if (forSite) {
90 sb..write(title) 91 sb..write(title)
91 ..write('\n{: #$hashTag}\n') 92 ..write('\n{: #$hashTag}\n')
92 ..write(body); 93 ..write(body);
93 } else { 94 } else {
94 var html = markdownToHtml('$title$body').replaceFirst('<hr', '</div><hr'); 95 var html = markdownToHtml('$title$body').replaceFirst('<hr', '</div><hr');
95 sb.write('\n\n<div id="$hashTag">$html'); 96 sb.write('\n\n<div id="$hashTag">$html');
96 } 97 }
97 } 98 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 display: inline; 271 display: inline;
271 } 272 }
272 </style> 273 </style>
273 <body> 274 <body>
274 '''; 275 ''';
275 276
276 const _LOCAL_FOOTER = ''' 277 const _LOCAL_FOOTER = '''
277 </body> 278 </body>
278 </html> 279 </html>
279 '''; 280 ''';
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/build/generated/messages.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698