@@ -198,6 +198,15 @@ const OS_RENAME =
198
198
'os.rename(from, to) <span class="hljs-comment"># Renames the file or directory.</span>\n' +
199
199
'os.replace(from, to) <span class="hljs-comment"># Same, but overwrites \'to\' if it exists.</span>\n' ;
200
200
201
+ const EVAL =
202
+ '<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> ast <span class="hljs-keyword">import</span> literal_eval\n' +
203
+ '<span class="hljs-meta">>>> </span>literal_eval(<span class="hljs-string">\'1 + 2\'</span>)\n' +
204
+ '<span class="hljs-number">3</span>\n' +
205
+ '<span class="hljs-meta">>>> </span>literal_eval(<span class="hljs-string">\'[1, 2, 3]\'</span>)\n' +
206
+ '[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]\n' +
207
+ '<span class="hljs-meta">>>> </span>literal_eval(<span class="hljs-string">\'abs(1)\'</span>)\n' +
208
+ 'ValueError: malformed node or string\n' ;
209
+
201
210
202
211
function main ( ) {
203
212
const html = getMd ( ) ;
@@ -278,7 +287,7 @@ function highlightCode() {
278
287
hljs . highlightBlock ( this ) ;
279
288
} ) ;
280
289
fixClasses ( ) ;
281
- fixFroms ( ) ;
290
+ fixHighlights ( ) ;
282
291
preventPageBreaks ( ) ;
283
292
insertPageBreak ( ) ;
284
293
}
@@ -294,8 +303,9 @@ function fixClasses() {
294
303
$ ( '.hljs-class' ) . filter ( ':contains(class \')' ) . find ( ':first-child' ) . removeClass ( 'hljs-keyword' ) . addClass ( 'hljs-title' )
295
304
}
296
305
297
- function fixFroms ( ) {
306
+ function fixHighlights ( ) {
298
307
$ ( `code:contains(os.rename)` ) . html ( OS_RENAME ) ;
308
+ $ ( `code:contains(ValueError: malformed node)` ) . html ( EVAL ) ;
299
309
}
300
310
301
311
function preventPageBreaks ( ) {
0 commit comments