-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into check_contents_mgr_type
- Loading branch information
Showing
19 changed files
with
809 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
tests/data/notebooks/inputs/ipynb_go/hello_world_gonb.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8795db3a-af9a-4f03-a68d-019330861b54", | ||
"metadata": {}, | ||
"source": [ | ||
"A notebook that use [GoNB](https://github.com/janpfeifer/gonb)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "50a2fb21-01b3-46d0-9951-f9a1301a85ca", | ||
"metadata": {}, | ||
"source": [ | ||
"the code below comes from [tutorial.ipynb](https://github.com/janpfeifer/gonb/blob/main/examples/tutorial.ipynb)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "75d8418d-a918-4cc8-b42e-384db01f21ae", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"func main() {\n", | ||
" fmt.Printf(\"Hello World!\")\n", | ||
"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3620f46f-efd5-4454-bc29-418297012ce9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%\n", | ||
"fmt.Printf(\"Hello World!\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "7fed4a43", | ||
"metadata": {}, | ||
"source": [ | ||
"%% --who=world can pass flags to main func" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "473e2d02", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import (\n", | ||
" \"flag\"\n", | ||
" \"fmt\"\n", | ||
")\n", | ||
"\n", | ||
"var flagWho = flag.String(\"who\", \"\", \"Your name!\")\n", | ||
"\n", | ||
"%% --who=world\n", | ||
"fmt.Printf(\"Hello %s!\\n\", *flagWho)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b8e8b4ae", | ||
"metadata": {}, | ||
"source": [ | ||
"%args also can pass flags" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "348efbe1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%args --who=Wally\n", | ||
"\n", | ||
"func main() {\n", | ||
" flag.Parse()\n", | ||
" fmt.Printf(\"Where is %s?\", *flagWho)\n", | ||
"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "82f4bb1f-3311-4fca-8025-c54c0305dc64", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import \"github.com/janpfeifer/gonb/gonbui\"\n", | ||
"\n", | ||
"%%\n", | ||
"gonbui.DisplayHtml(`<span style=\"background:pink; color:#111; border-radius: 3px; border: 3px solid orange; font-size: 18px;\">I 🧡 GoNB!</span>`)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1a5584ff-f346-45cf-95c1-a3e3b7146c6c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%%\n", | ||
"gonbui.DisplayMarkdown(\"#### Objective\\n\\n1. Have fun coding **Go**;\\n1. Profit...\\n\"+\n", | ||
" `$$f(x) = \\int_{-\\infty}^{\\infty} e^{-x^2} dx$$`)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "de996381-d92c-4ce6-a135-50cf39288aa1", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"func init_a() {\n", | ||
" fmt.Println(\"init_a\")\n", | ||
"}\n", | ||
"%%\n", | ||
"fmt.Println(\"main\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Go (gonb)", | ||
"language": "go", | ||
"name": "gonb" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "", | ||
"file_extension": ".go", | ||
"mimetype": "", | ||
"name": "go", | ||
"nbconvert_exporter": "", | ||
"pygments_lexer": "", | ||
"version": "go1.21.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
69 changes: 69 additions & 0 deletions
69
tests/data/notebooks/outputs/ipynb_to_Rmd/hello_world_gonb.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
jupyter: | ||
kernelspec: | ||
display_name: Go (gonb) | ||
language: go | ||
name: gonb | ||
--- | ||
|
||
A notebook that use [GoNB](https://github.com/janpfeifer/gonb) | ||
|
||
|
||
the code below comes from [tutorial.ipynb](https://github.com/janpfeifer/gonb/blob/main/examples/tutorial.ipynb) | ||
|
||
```{go} | ||
func main() { | ||
fmt.Printf("Hello World!") | ||
} | ||
``` | ||
|
||
```{go} | ||
%% | ||
fmt.Printf("Hello World!") | ||
``` | ||
|
||
%% --who=world can pass flags to main func | ||
|
||
```{go} | ||
import ( | ||
"flag" | ||
"fmt" | ||
) | ||
var flagWho = flag.String("who", "", "Your name!") | ||
%% --who=world | ||
fmt.Printf("Hello %s!\n", *flagWho) | ||
``` | ||
|
||
%args also can pass flags | ||
|
||
```{go} | ||
// %args --who=Wally | ||
func main() { | ||
flag.Parse() | ||
fmt.Printf("Where is %s?", *flagWho) | ||
} | ||
``` | ||
|
||
```{go} | ||
import "github.com/janpfeifer/gonb/gonbui" | ||
%% | ||
gonbui.DisplayHtml(`<span style="background:pink; color:#111; border-radius: 3px; border: 3px solid orange; font-size: 18px;">I 🧡 GoNB!</span>`) | ||
``` | ||
|
||
```{go} | ||
%% | ||
gonbui.DisplayMarkdown("#### Objective\n\n1. Have fun coding **Go**;\n1. Profit...\n"+ | ||
`$$f(x) = \int_{-\infty}^{\infty} e^{-x^2} dx$$`) | ||
``` | ||
|
||
```{go} | ||
func init_a() { | ||
fmt.Println("init_a") | ||
} | ||
%% | ||
fmt.Println("main") | ||
``` |
Oops, something went wrong.