summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matusiak <numerodix@gmail.com>2014-03-09 12:59:28 +0100
committerMartin Matusiak <numerodix@gmail.com>2014-03-09 12:59:28 +0100
commit861875d9ae62fece9b8865c496878b026f7ca8a1 (patch)
tree055eeb1e932fcd04783b7b6f46302e4cf2e92106
parent88f78d83279db6c3a471fea818744516d94a4381 (diff)
parent7ebde3680bfc71d3598b8fa37bfc27f16a51b433 (diff)
downloadansicolor-861875d9ae62fece9b8865c496878b026f7ca8a1.tar.gz
Merge branch 'release/0.1.6'0.1.6
-rw-r--r--README.rst58
-rw-r--r--ansicolor/__init__.py2
l---------docs/README.rst1
-rw-r--r--docs/index.rst12
-rw-r--r--docs/src/getting_started.rst56
5 files changed, 70 insertions, 59 deletions
diff --git a/README.rst b/README.rst
index a3d16a7..6be7ebc 100644
--- a/README.rst
+++ b/README.rst
@@ -31,59 +31,7 @@ Installation
Getting started
---------------
-To highlight using colors:
-
-.. literalinclude:: snippets/getting_started_1.py
-
-.. figure:: snippets/getting_started_1.png
-
-
-This will emit ansi escapes into the string: one when starting a color, another
-to reset the color back to the default:
-
-.. code:: python
-
- >>> from ansicolor import green
-
- >>> green("green")
- '\x1b[0;0;32mgreen\x1b[0;0m'
-
-
-If I want to be able to pass a color as an argument I can also use the
-``colorize`` function:
-
-.. code:: python
-
- from ansicolor import Colors
- from ansicolor import colorize
-
- print(colorize("I'm blue", Colors.Blue))
-
-
-I can also apply color on a portion of a string:
-
-.. code:: python
-
- from ansicolor import Colors
- from ansicolor import wrap_string
-
- print(wrap_string("I'm blue, said the policeman.", 8, Colors.Blue))
-
-
-Sometimes I may have a string that contains markup and I'll want to do something
-with it that concerns only the text, so I can strip the markup:
-
-.. code:: python
-
- >>> from ansicolor import red
- >>> from ansicolor import strip_escapes
- >>> from ansicolor import yellow
-
- >>> message = "My favorite colors are %s and %s" % (yellow("yellow"), red("red"))
- >>> print("The length of this string is not: %d" % len(message))
- The length of this string is not: 67
- >>> print("The length of this string is: %d" % len(strip_escapes(message)))
- The length of this string is: 37
+Read the `documentation`_ on Read the Docs!
Going further
@@ -97,7 +45,5 @@ Take a look at the ``demos`` to see what's possible.
$ python -m ansicolor.demos --highlight
$ python -m ansicolor.demos --diff
-Also see the `API documentation`_.
-
-.. _`API documentation`: https://ansicolor.readthedocs.org/
+.. _`documentation`: https://ansicolor.readthedocs.org/
diff --git a/ansicolor/__init__.py b/ansicolor/__init__.py
index bf6cd9f..9202ec5 100644
--- a/ansicolor/__init__.py
+++ b/ansicolor/__init__.py
@@ -32,5 +32,5 @@ __all__ = [
]
__major_version__ = "0.1"
-__release__ = "5"
+__release__ = "6"
__version__ = "%s.%s" % (__major_version__, __release__)
diff --git a/docs/README.rst b/docs/README.rst
deleted file mode 120000
index 89a0106..0000000
--- a/docs/README.rst
+++ /dev/null
@@ -1 +0,0 @@
-../README.rst \ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index e0e71d1..640b673 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -6,10 +6,20 @@
Welcome to ansicolor's documentation!
=====================================
+User guide
+----------
+
+.. toctree::
+ :maxdepth: 4
+
+ src/getting_started.rst
+
+API Documentation
+-----------------
+
.. toctree::
:maxdepth: 4
- README.rst
ansicolor
diff --git a/docs/src/getting_started.rst b/docs/src/getting_started.rst
new file mode 100644
index 0000000..28ad000
--- /dev/null
+++ b/docs/src/getting_started.rst
@@ -0,0 +1,56 @@
+Getting started
+===============
+
+To highlight using colors:
+
+.. literalinclude:: ../snippets/getting_started_1.py
+
+.. figure:: ../snippets/getting_started_1.png
+
+
+This will emit ansi escapes into the string: one when starting a color, another
+to reset the color back to the default:
+
+.. code:: python
+
+ >>> from ansicolor import green
+
+ >>> green("green")
+ '\x1b[0;0;32mgreen\x1b[0;0m'
+
+
+If I want to be able to pass a color as an argument I can also use the
+``colorize`` function:
+
+.. code:: python
+
+ from ansicolor import Colors
+ from ansicolor import colorize
+
+ print(colorize("I'm blue", Colors.Blue))
+
+
+I can also apply color on a portion of a string:
+
+.. code:: python
+
+ from ansicolor import Colors
+ from ansicolor import wrap_string
+
+ print(wrap_string("I'm blue, said the policeman.", 8, Colors.Blue))
+
+
+Sometimes I may have a string that contains markup and I'll want to do something
+with it that concerns only the text, so I can strip the markup:
+
+.. code:: python
+
+ >>> from ansicolor import red
+ >>> from ansicolor import strip_escapes
+ >>> from ansicolor import yellow
+
+ >>> message = "My favorite colors are %s and %s" % (yellow("yellow"), red("red"))
+ >>> print("The length of this string is not: %d" % len(message))
+ The length of this string is not: 67
+ >>> print("The length of this string is: %d" % len(strip_escapes(message)))
+ The length of this string is: 37