Browse Source

Match statement

pull/135/merge
Jure Šorn 2 months ago
parent
commit
480f6db809
2 changed files with 2 additions and 9 deletions
  1. 2
      README.md
  2. 9
      parse.js

2
README.md

@ -2167,7 +2167,7 @@ match <object/expression>:
... parts=['/', 'home', user, *_]
... ) as p if p.name.lower().startswith('readme') and p.is_file():
... print(f'{p.name} is a readme file that belongs to user {user}.')
'README.md is a readme file that belongs to user gto.'
README.md is a readme file that belongs to user gto.
```

9
parse.js

@ -110,7 +110,7 @@ const MATCH_EXAMPLE =
'<span class="hljs-meta">... </span> parts=[<span class="hljs-string">\'/\'</span>, <span class="hljs-string">\'home\'</span>, user, *_]\n' +
'<span class="hljs-meta">... </span> ) <span class="hljs-keyword">as</span> p <span class="hljs-keyword">if</span> p.name.lower().startswith(<span class="hljs-string">\'readme\'</span>) <span class="hljs-keyword">and</span> p.is_file():\n' +
'<span class="hljs-meta">... </span> print(<span class="hljs-string">f\'<span class="hljs-subst">{p.name}</span> is a readme file that belongs to user <span class="hljs-subst">{user}</span>.\'</span>)\n' +
'<span class="hljs-string">\'README.md is a readme file that belongs to user gto.\'</span>\n';
'README.md is a readme file that belongs to user gto.\n';
const COROUTINES =
'<span class="hljs-keyword">import</span> asyncio, collections, curses, curses.textpad, enum, random\n' +
@ -733,7 +733,6 @@ function modifyPage() {
unindentBanner();
updateDiagrams();
highlightCode();
fixMatchHighlights();
fixPandasDiagram();
removePlotImages();
fixABCSequenceDiv();
@ -898,12 +897,6 @@ function insertPageBreakBefore(an_id) {
$('<div class="pagebreak"></div>').insertBefore($(an_id).parent())
}
function fixMatchHighlights() {
const line = $(`span:contains(README.md is a readme file that belongs to user gto.)`);
line.after('README.md is a readme file that belongs to user gto.');
line.remove();
}
function fixPandasDiagram() {
const diagram_15 = '┏━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━┓';
$(`code:contains(${diagram_15})`).find(".hljs-keyword:contains(and)").after("and");

Loading…
Cancel
Save