Skip to content

Commit

Permalink
fix: remove py snippets from js docs (microsoft#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman authored Jan 28, 2021
1 parent fe7dcd9 commit 1cb9141
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 90 deletions.
24 changes: 0 additions & 24 deletions nodejs/docs/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ This example logs a message for a single page `load` event:
page.once('load', () => console.log('Page loaded!'));
```

```py
page.once("load", lambda: print("page loaded!"))
```

To unsubscribe from events use the `removeListener` method:

```js
Expand All @@ -47,14 +43,6 @@ page.on('request', logRequest);
page.removeListener('request', logRequest);
```

```py
def log_request(intercepted_request):
print("a request was made:", intercepted_request.url)
page.on("request", log_request)
# sometime later...
page.remove_listener("request", log_request)
```


- [page.on('close')](./api/class-page.mdx#pageonclose)
- [page.on('console')](./api/class-page.mdx#pageonconsole)
Expand Down Expand Up @@ -221,10 +209,6 @@ page.on('filechooser', async (fileChooser) => {
});
```

```py
page.on("filechooser", lambda file_chooser: file_chooser.set_files("/tmp/myfile.pdf"))
```

## page.on('frameattached')
- type: <[Frame]>

Expand Down Expand Up @@ -765,18 +749,10 @@ Returns frame matching the specified criteria. Either `name` or `url` must be sp
const frame = page.frame('frame-name');
```

```py
frame = page.frame(name="frame-name")
```

```js
const frame = page.frame({ url: /.*domain.*/ });
```

```py
frame = page.frame(url=r".*domain.*")
```

## page.frames()
- returns: <[Array]<[Frame]>>

Expand Down
8 changes: 0 additions & 8 deletions nodejs/docs/api/class-request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ page.on('requestfailed', request => {
});
```

```py
page.on("requestfailed", lambda request: print(request.url + " " + request.failure))
```

## request.frame()
- returns: <[Frame]>

Expand Down Expand Up @@ -121,10 +117,6 @@ This method is the opposite of [request.redirectedFrom()](./api/class-request.md
console.log(request.redirectedFrom().redirectedTo() === request); // true
```

```py
assert request.redirected_from.redirected_to == request
```

## request.resourceType()
- returns: <[string]>

Expand Down
12 changes: 0 additions & 12 deletions nodejs/docs/api/class-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ for (const worker of page.workers())
console.log(' ' + worker.url());
```

```py
def handle_worker(worker):
print("worker created: " + worker.url)
worker.on("close", lambda: print("worker destroyed: " + worker.url))

page.on('worker', handle_worker)

print("current workers:")
for worker in page.workers:
print(" " + worker.url)
```


- [worker.on('close')](./api/class-worker.mdx#workeronclose)
- [worker.evaluate(pageFunction[, arg])](./api/class-worker.mdx#workerevaluatepagefunction-arg)
Expand Down
24 changes: 0 additions & 24 deletions nodejs/versioned_docs/version-1.8.0/api/class-page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ This example logs a message for a single page `load` event:
page.once('load', () => console.log('Page loaded!'));
```

```py
page.once("load", lambda: print("page loaded!"))
```

To unsubscribe from events use the `removeListener` method:

```js
Expand All @@ -47,14 +43,6 @@ page.on('request', logRequest);
page.removeListener('request', logRequest);
```

```py
def log_request(intercepted_request):
print("a request was made:", intercepted_request.url)
page.on("request", log_request)
# sometime later...
page.remove_listener("request", log_request)
```


- [page.on('close')](./api/class-page.mdx#pageonclose)
- [page.on('console')](./api/class-page.mdx#pageonconsole)
Expand Down Expand Up @@ -218,10 +206,6 @@ page.on('filechooser', async (fileChooser) => {
});
```

```py
page.on("filechooser", lambda file_chooser: file_chooser.set_files("/tmp/myfile.pdf"))
```

## page.on('frameattached')
- type: <[Frame]>

Expand Down Expand Up @@ -761,18 +745,10 @@ Returns frame matching the specified criteria. Either `name` or `url` must be sp
const frame = page.frame('frame-name');
```

```py
frame = page.frame(name="frame-name")
```

```js
const frame = page.frame({ url: /.*domain.*/ });
```

```py
frame = page.frame(url=r".*domain.*")
```

## page.frames()
- returns: <[Array]<[Frame]>>

Expand Down
8 changes: 0 additions & 8 deletions nodejs/versioned_docs/version-1.8.0/api/class-request.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ page.on('requestfailed', request => {
});
```

```py
page.on("requestfailed", lambda request: print(request.url + " " + request.failure))
```

## request.frame()
- returns: <[Frame]>

Expand Down Expand Up @@ -121,10 +117,6 @@ This method is the opposite of [request.redirectedFrom()](./api/class-request.md
console.log(request.redirectedFrom().redirectedTo() === request); // true
```

```py
assert request.redirected_from.redirected_to == request
```

## request.resourceType()
- returns: <[string]>

Expand Down
12 changes: 0 additions & 12 deletions nodejs/versioned_docs/version-1.8.0/api/class-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ for (const worker of page.workers())
console.log(' ' + worker.url());
```

```py
def handle_worker(worker):
print("worker created: " + worker.url)
worker.on("close", lambda: print("worker destroyed: " + worker.url))

page.on('worker', handle_worker)

print("current workers:")
for worker in page.workers:
print(" " + worker.url)
```


- [worker.on('close')](./api/class-worker.mdx#workeronclose)
- [worker.evaluate(pageFunction[, arg])](./api/class-worker.mdx#workerevaluatepagefunction-arg)
Expand Down
4 changes: 2 additions & 2 deletions src/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Documentation = require('./documentation');
/** @typedef {import('./markdown').MarkdownNode} MarkdownNode */

const DIR_SRC = path.join(process.env.SRC_DIR, 'docs', 'src');
const commonSnippets = new Set(['html', 'yml', 'yaml', 'json', 'groovy', 'html', 'sh', 'py']);
const commonSnippets = new Set(['html', 'yml', 'yaml', 'json', 'groovy', 'html', 'sh']);

class Generator {
links = new Map();
Expand Down Expand Up @@ -202,7 +202,7 @@ ${md.render([spec[i]])}
return true;

// Our lang - Ok.
if (c.codeLang === this.lang) {
if (c.codeLang === this.lang || c.codeLang === highlighterName(this.lang)) {
c.codeLang = highlighterName(this.lang);
return true;
}
Expand Down

0 comments on commit 1cb9141

Please sign in to comment.