Skip to content

Commit fdf7a8a

Browse files
committed
Eval
1 parent 8a19a1e commit fdf7a8a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@
18361836
<span class="hljs-meta">&gt;&gt;&gt; </span>literal_eval(<span class="hljs-string">'[1, 2, 3]'</span>)
18371837
[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
18381838
<span class="hljs-meta">&gt;&gt;&gt; </span>literal_eval(<span class="hljs-string">'abs(1)'</span>)
1839-
ValueError: malformed node <span class="hljs-keyword">or</span> string
1839+
ValueError: malformed node or string
18401840
</code></pre></div>
18411841

18421842
<div><h2 id="coroutine"><a href="#coroutine" name="coroutine">#</a>Coroutine</h2><ul>

parse.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ const OS_RENAME =
198198
'os.rename(from, to) <span class="hljs-comment"># Renames the file or directory.</span>\n' +
199199
'os.replace(from, to) <span class="hljs-comment"># Same, but overwrites \'to\' if it exists.</span>\n';
200200

201+
const EVAL =
202+
'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> ast <span class="hljs-keyword">import</span> literal_eval\n' +
203+
'<span class="hljs-meta">&gt;&gt;&gt; </span>literal_eval(<span class="hljs-string">\'1 + 2\'</span>)\n' +
204+
'<span class="hljs-number">3</span>\n' +
205+
'<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>literal_eval(<span class="hljs-string">\'abs(1)\'</span>)\n' +
208+
'ValueError: malformed node or string\n';
209+
201210

202211
function main() {
203212
const html = getMd();
@@ -278,7 +287,7 @@ function highlightCode() {
278287
hljs.highlightBlock(this);
279288
});
280289
fixClasses();
281-
fixFroms();
290+
fixHighlights();
282291
preventPageBreaks();
283292
insertPageBreak();
284293
}
@@ -294,8 +303,9 @@ function fixClasses() {
294303
$('.hljs-class').filter(':contains(class \')').find(':first-child').removeClass('hljs-keyword').addClass('hljs-title')
295304
}
296305

297-
function fixFroms() {
306+
function fixHighlights() {
298307
$(`code:contains(os.rename)`).html(OS_RENAME);
308+
$(`code:contains(ValueError: malformed node)`).html(EVAL);
299309
}
300310

301311
function preventPageBreaks() {

0 commit comments

Comments
 (0)