summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-02-06 22:17:54 +0100
committerAnthon van der Neut <anthon@mnt.org>2017-02-06 22:17:54 +0100
commitbbd2e8ac8fb9ba2aee8b8f95cc5e9c05d46b79cd (patch)
tree13bf8cf7eeb40ea2a20c23a07ee0004369a775da
parent95071a0d8a92c1ed482bdf06bbde92cdd9967c09 (diff)
downloadruamel.yaml-bbd2e8ac8fb9ba2aee8b8f95cc5e9c05d46b79cd.tar.gz
doc clarification
-rw-r--r--__init__.py2
-rw-r--r--_doc/detail.rst19
-rw-r--r--error.py4
3 files changed, 14 insertions, 11 deletions
diff --git a/__init__.py b/__init__.py
index 43d8683..b9b8d06 100644
--- a/__init__.py
+++ b/__init__.py
@@ -8,7 +8,7 @@ from __future__ import print_function, absolute_import, division, unicode_litera
_package_data = dict(
full_package_name="ruamel.yaml",
- version_info=(0, 13, 13),
+ version_info=(0, 13, 14, "dev"),
author="Anthon van der Neut",
author_email="a.van.der.neut@ruamel.eu",
description="ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order", # NOQA
diff --git a/_doc/detail.rst b/_doc/detail.rst
index 1449023..3df8fff 100644
--- a/_doc/detail.rst
+++ b/_doc/detail.rst
@@ -69,23 +69,27 @@ element itself would normally be pushed to the next line (and older versions
of ruamel.yaml did so). But this is
prevented from happening. However the ``indent`` level is what is used
for calculating the cumulative indent for deeper levels and specifying
-``indent=3`` resp. ``block_seq_indent=2``, gives correct, but counter
+``indent=3`` resp. ``block_seq_indent=2``, migth give correct, but counter
intuitive results.
+**It is best to always have** `indent >= block_seq_indent + 2` **but
+ this is not enforced**. Depending on your structure, not following
+ this advice **might lead to invalid output**.
+
Positioning ':' in top level mappings, prefix in ':'
----------------------------------------------------
If you want your toplevel mappings to look like::
- library version: 1
+ library version: 1
comment : |
this is just a first try
then call ``round_trip_dump()`` with ``top_level_colon_align=True``
-(and ``indent=4``). ``True`` causes calculation based on the longest key,
+(and ``indent=4``). ``True`` causes calculation based on the longest key,
but you can also explicitly set a number.
-If you want an extra space between a mapping key and the colon specify
+If you want an extra space between a mapping key and the colon specify
``prefix_colon=' '``::
- https://myurl/abc.tar.xz : 23445
@@ -96,7 +100,7 @@ If you combine ``prefix_colon`` with ``top_level_colon_align``, the
top level mapping doesn't get the extra prefix. If you want that
anyway, specify ``top_level_colon_align=12`` where ``12`` has to be an
integer that is one more than length of the widest key.
-
+
Document version support.
-------------------------
@@ -126,7 +130,7 @@ or the equivalent (version can be a tuple, list or string):
ruamel.yaml.round_trip_load(some_str, version="1.1")
-this also works for ``load_all``/``round_trip_load_all``.
+this also works for ``load_all``/``round_trip_load_all``.
*If you cannot change your code, stick with ruamel.yaml==0.10.23 and let
me know if it would help to be able to set an environment variable.*
@@ -262,6 +266,3 @@ included and you can do::
data = yaml.load(yaml_str, Loader=yaml.RoundTripLoader)
assert data.mlget(['a', 1, 'd', 'f'], list_ok=True) == 196
-
-
-
diff --git a/error.py b/error.py
index 5015828..9055746 100644
--- a/error.py
+++ b/error.py
@@ -60,8 +60,10 @@ class StringMark(StreamMark):
end -= 5
break
snippet = utf8(self.buffer[start:end])
+ caret = '^'
+ caret = '^ (line: {})'.format(self.line+1)
return ' '*indent + head + snippet + tail + '\n' \
- + ' '*(indent+self.pointer-start+len(head)) + '^'
+ + ' '*(indent+self.pointer-start+len(head)) + caret
def __str__(self):
snippet = self.get_snippet()