Repository: napjon/krisk

Issue:
Not support nbconvert
**Reproduce:**
1. Use Intro.ipynb
2. Remove `from krisk import init_notebook; init_notebook()` since it's not gonna publish to nbviewer.
3. Use nbconvert to export current page as html

**Output:**
Javascript part failed to print out. 
Console error: 
`require.min.js:8 Uncaught Error: Script error for: dark`
`require.min.js:8 Failed to load resource: net::ERR_FILE_NOT_FOUND`
...

**Expected Output:**
Charts should be shown as it run in notebook after exporting.

**Possible solution:**
It seems like after exporting, it still tries to retrieve source js files from local server and current folder. Is that possible we can define the source files' location as commands in python?

**ENV:**
Python3.5
Jupyter Notebook 4.2.1
Echarts 3.2.1 (built-in)

Discussion:
codecov-io: ## [Current coverage](https://codecov.io/gh/napjon/krisk/pull/63?src=pr) is 91.89% (diff: 100%)
> Merging [#63](https://codecov.io/gh/napjon/krisk/pull/63?src=pr) into [master](https://codecov.io/gh/napjon/krisk/branch/master?src=pr) will not change coverage

```diff
@@             master        #63   diff @@
==========================================
  Files             8          8          
  Lines           370        370          
  Methods           0          0          
  Messages          0          0          
  Branches         55         55          
==========================================
  Hits            340        340          
  Misses           19         19          
  Partials         11         11          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [5d5980a...7edcaa6](https://codecov.io/gh/napjon/krisk/compare/5d5980a518bb36fd7b1624fc36c2fbaa5c247e9b...7edcaa6f63be22e7feca7c0a1d06f3962bccfe71?src=pr)

Patch:
diff --git a/krisk/util.py b/krisk/util.py
index db8bcb3..f798d93 100644
--- a/krisk/util.py
+++ b/krisk/util.py
@@ -25,9 +25,9 @@ def init_notebook():
     from IPython.display import Javascript
     return Javascript("""
     require.config({
-                 baseUrl : "//cdn.rawgit.com/napjon/krisk/master/krisk/static",
+                 baseUrl : "https://cdn.rawgit.com/napjon/krisk/master/krisk/static",
                  paths: {
-                      echarts: "//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min"
+                      echarts: "https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min"
                   }
     });
     """)
\ No newline at end of file
diff --git a/notebooks/Intro.ipynb b/notebooks/Intro.ipynb
index fba28c7..792c2b8 100644
--- a/notebooks/Intro.ipynb
+++ b/notebooks/Intro.ipynb
@@ -9,7 +9,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "metadata": {
     "collapsed": false
    },
@@ -19,9 +19,9 @@
       "application/javascript": [
        "\n",
        "    require.config({\n",
-       "                 baseUrl : \"//cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
+       "                 baseUrl : \"https://cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
        "                 paths: {\n",
-       "                      echarts: \"//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
+       "                      echarts: \"https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
        "                  }\n",
        "    });\n",
        "    "
@@ -30,7 +30,7 @@
        "<IPython.core.display.Javascript object>"
       ]
      },
-     "execution_count": 2,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -38,7 +38,7 @@
    "source": [
     "import pandas as pd\n",
     "import krisk.plot as kk\n",
-    "# Only used this for nbviewer purposes (online js fetch). Don't use it.\n",
+    "# Use this when you want to nbconvert the notebook (used by nbviewer)\n",
     "from krisk import init_notebook; init_notebook()"
    ]
   },
@@ -2944,8 +2944,9 @@
   }
  ],
  "metadata": {
+  "anaconda-cloud": {},
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python [default]",
    "language": "python",
    "name": "python3"
   },
@@ -2959,7 +2960,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.5.1"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/declarative-visualization.ipynb b/notebooks/declarative-visualization.ipynb
index d59fa2f..d4bc7fb 100644
--- a/notebooks/declarative-visualization.ipynb
+++ b/notebooks/declarative-visualization.ipynb
@@ -9,7 +9,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 1,
    "metadata": {
     "collapsed": false
    },
@@ -19,9 +19,9 @@
       "application/javascript": [
        "\n",
        "    require.config({\n",
-       "                 baseUrl : \"//cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
+       "                 baseUrl : \"https://cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
        "                 paths: {\n",
-       "                      echarts: \"//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
+       "                      echarts: \"https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
        "                  }\n",
        "    });\n",
        "    "
@@ -30,13 +30,13 @@
        "<IPython.core.display.Javascript object>"
       ]
      },
-     "execution_count": 3,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "# Only used this for nbviewer purposes (online js fetch). Don't use it.\n",
+    "# Use this when you want to nbconvert the notebook (used by nbviewer)\n",
     "from krisk import init_notebook; init_notebook()"
    ]
   },
diff --git a/notebooks/legend-title-toolbox.ipynb b/notebooks/legend-title-toolbox.ipynb
index 26df8c2..a12b0c4 100644
--- a/notebooks/legend-title-toolbox.ipynb
+++ b/notebooks/legend-title-toolbox.ipynb
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "metadata": {
     "collapsed": false
    },
@@ -12,9 +12,9 @@
       "application/javascript": [
        "\n",
        "    require.config({\n",
-       "                 baseUrl : \"//cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
+       "                 baseUrl : \"https://cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
        "                 paths: {\n",
-       "                      echarts: \"//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
+       "                      echarts: \"https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
        "                  }\n",
        "    });\n",
        "    "
@@ -23,7 +23,7 @@
        "<IPython.core.display.Javascript object>"
       ]
      },
-     "execution_count": 2,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -31,7 +31,7 @@
    "source": [
     "import pandas as pd\n",
     "import krisk.plot as kk\n",
-    "# Only used this for nbviewer purposes (online js fetch). Don't use it.\n",
+    "# Use this when you want to nbconvert the notebook (used by nbviewer)\n",
     "from krisk import init_notebook; init_notebook()"
    ]
   },
@@ -1456,8 +1456,9 @@
   }
  ],
  "metadata": {
+  "anaconda-cloud": {},
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python [default]",
    "language": "python",
    "name": "python3"
   },
@@ -1471,7 +1472,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.5.1"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/resync-reproducible.ipynb b/notebooks/resync-reproducible.ipynb
index c52c887..61a760a 100644
--- a/notebooks/resync-reproducible.ipynb
+++ b/notebooks/resync-reproducible.ipynb
@@ -2,7 +2,7 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "metadata": {
     "collapsed": false
    },
@@ -12,9 +12,9 @@
       "application/javascript": [
        "\n",
        "    require.config({\n",
-       "                 baseUrl : \"//cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
+       "                 baseUrl : \"https://cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
        "                 paths: {\n",
-       "                      echarts: \"//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
+       "                      echarts: \"https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
        "                  }\n",
        "    });\n",
        "    "
@@ -23,7 +23,7 @@
        "<IPython.core.display.Javascript object>"
       ]
      },
-     "execution_count": 2,
+     "execution_count": 1,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -34,7 +34,7 @@
     "\n",
     "import pandas as pd\n",
     "import krisk.plot as kk\n",
-    "# Only used this for nbviewer purposes (online js fetch). Don't use it.\n",
+    "# Use this when you want to nbconvert the notebook (used by nbviewer)\n",
     "from krisk import init_notebook; init_notebook()"
    ]
   },
@@ -484,8 +484,9 @@
   }
  ],
  "metadata": {
+  "anaconda-cloud": {},
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python [default]",
    "language": "python",
    "name": "python3"
   },
@@ -499,7 +500,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.5.1"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/themes-colors.ipynb b/notebooks/themes-colors.ipynb
index d73dcfa..269afc5 100644
--- a/notebooks/themes-colors.ipynb
+++ b/notebooks/themes-colors.ipynb
@@ -19,9 +19,9 @@
       "application/javascript": [
        "\n",
        "    require.config({\n",
-       "                 baseUrl : \"//cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
+       "                 baseUrl : \"https://cdn.rawgit.com/napjon/krisk/master/krisk/static\",\n",
        "                 paths: {\n",
-       "                      echarts: \"//cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
+       "                      echarts: \"https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.1/echarts.min\"\n",
        "                  }\n",
        "    });\n",
        "    "
@@ -38,7 +38,7 @@
    "source": [
     "import krisk.plot as kk\n",
     "import pandas as pd\n",
-    "# Only used this for nbviewer purposes (online js fetch). Don't use it.\n",
+    "# Use this when you want to nbconvert the notebook (used by nbviewer)\n",
     "from krisk import init_notebook; init_notebook()"
    ]
   },
@@ -2394,8 +2394,9 @@
   }
  ],
  "metadata": {
+  "anaconda-cloud": {},
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python [default]",
    "language": "python",
    "name": "python3"
   },
@@ -2409,7 +2410,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.5.1"
   }
  },
  "nbformat": 4,


Test patch:
diff --git a/krisk/tests/test_template.py b/krisk/tests/test_template.py
index e5ef7e5..c25097f 100644
--- a/krisk/tests/test_template.py
+++ b/krisk/tests/test_template.py
@@ -21,9 +21,9 @@ def test_init_nb():
     js_data = init_notebook().data
     js_init_template = """
     require.config({{
-                 baseUrl : "//cdn.rawgit.com/napjon/krisk/master/krisk/static",
+                 baseUrl : "https://cdn.rawgit.com/napjon/krisk/master/krisk/static",
                  paths: {{
-                      echarts: "//cdnjs.cloudflare.com/ajax/libs/echarts/{VER}/echarts.min"
+                      echarts: "https://cdnjs.cloudflare.com/ajax/libs/echarts/{VER}/echarts.min"
                   }}
     }});
     """