<commit_before>ipy2wp
======

Publish an IPython notebook on a wordpress site using xmlrpc

This tool is far from being perfect but it allows you to publish an IPython notebook on a wordpress site using xmlrpc from the command line or from the notebook itself.

Usage
=====

There are two ways to use this tool:

From the command line
---------------------

    python /path/to/ipy2wp.py [options]

You have the following options:

* --xmlrpc-url: The url to xmlrpc.php on your site
* --user: The user who will publish the post
* --password: The password of the user who will publish the post
* --nb: the path to the IPython notebook
* --title: The title of the post
* --categories: The categories for the post (the categories should be defined previously in the blog)
* --tags: tags for the post
* --template: The template to be used. If no template is provided then the basic IPython notebook html template is used. [See the templates section for more info](https://github.com/Pybonacci/ipy2wp#templates).

A complete example would be:

    python ipy2wp.py --xmlrpc-url http://pybonacci.org/xmlrpc.php --user kiko --password <PASSWORD>!!! --nb 'dummy.ipynb' --title 'The best post ever' --categories articles tutorials --tags strawberry lucy ipython --template basic

*It works on IPython/Jupiter 2.0+  and Python 2.7+ and 3.3+*

From the notebook
-----------------

You should load the nbextension (the js file) as [explained in the users extensions repo](https://github.com/ipython-contrib/IPython-notebook-extensions/wiki#general-installation-instruction).

Once is loaded you would see a new button in the toolbar with the wordpress logo:

![image](https://raw.githubusercontent.com/Pybonacci/ipy2wp/master/images/wordpress_button.png)

If the button is pressed the following dialog will appear:

![image](https://raw.githubusercontent.com/Pybonacci/ipy2wp/master/images/dialog.png)

*It works only on Jupyter and Linux :-(*

Notebook inline images
======================

If there are inline images in your notebook, them will be converted and uploaded yo your wordpress blog ('wp-content/uploads') and the html code will be changed to link to the uploaded images.

Result<commit_msg>Update js extension installation instructions<commit_after>ipy2wp
======

Publish an IPython notebook on a wordpress site using xmlrpc

This tool is far from being perfect but it allows you to publish an IPython notebook on a wordpress site using xmlrpc from the command line or from the notebook itself.

Usage
=====

There are two ways to use this tool:

From the command line
---------------------

    python /path/to/ipy2wp.py [options]

You have the following options:

* --xmlrpc-url: The url to xmlrpc.php on your site
* --user: The user who will publish the post
* --password: <PASSWORD> the <PASSWORD> will publish the post
* --nb: the path to the IPython notebook
* --title: The title of the post
* --categories: The categories for the post (the categories should be defined previously in the blog)
* --tags: tags for the post
* --template: The template to be used. If no template is provided then the basic IPython notebook html template is used. [See the templates section for more info](https://github.com/Pybonacci/ipy2wp#templates).

A complete example would be:

    python ipy2wp.py --xmlrpc-url http://pybonacci.org/xmlrpc.php --user kiko --password <PASSWORD>!!! --nb 'dummy.ipynb' --title 'The best post ever' --categories articles tutorials --tags strawberry lucy ipython --template basic

*It works on IPython/Jupiter 2.0+  and Python 2.7+ and 3.3+*

From the notebook
-----------------

You should load the nbextension (the js file) in the following way:

* Donload the repo and copy the `ipy2wp/` folder in your local `ipython_dir/nbextensions/` folder. To get your `ipython_dir` you could use the following code:

```python
import IPython
ip=IPython.get_ipython()
ip.ipython_dir
```

* Now you should have the following folder (in my case `ipython_dir = '/home/kiko/ipython/'`):

`/home/kiko/.ipython/nbextensions/ipy2wp/`

* In that folder you should have the following file structure:

```
ipy2wp/
  |
  |--ipy2wp.py
  |--ipy2wp.js
  |--templates/
       |
       |--basicx.tpl
```

To load the extension you can do the following in an IPython/Jupyter notebook:

```
%%javascript
IPython.load_extensions('ipy2wp/ipy2wp')
```

Once is loaded you would see a new button in the toolbar with the wordpress logo:

![image](https://raw.githubusercontent.com/Pybonacci/ipy2wp/master/images/wordpress_button.png)

If the button is pressed the following dialog will appear:

![image](https://raw.githubusercontent.com/Pybonacci/ipy2wp/master/images/dialog.png)

*It works only on Jupyter and Linux :-(*

Notebook inline images
======================

If there are inline images in your notebook, them will be converted and uploaded yo your wordpress blog ('wp-content/uploads') and the html code will be changed to link to the uploaded images.

Result
{'fraction_non_alphanumeric': 0.11346231358323257, 'fraction_numerical': 0.006247480854494156, 'mean_word_length': 3.7721153846153848, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1930884', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1448, 'n_words': 624}