From 922e3b6631335d55f28c3d20b603750f161e3f06 Mon Sep 17 00:00:00 2001
From: bigbes <bigbes@gmail.com>
Date: Mon, 30 Mar 2015 20:26:08 +0300
Subject: [PATCH] Fix broken links in documentation

---
 doc/sphinx/book/app_c_lua_tutorial.rst        | 10 ++---
 doc/sphinx/book/app_d_plugins.rst             |  5 ++-
 doc/sphinx/book/box/admin.rst                 |  6 +--
 doc/sphinx/book/box/authentication.rst        | 11 +++--
 doc/sphinx/book/box/box_introspection.rst     |  4 +-
 doc/sphinx/book/box/box_schema.rst            |  5 +--
 doc/sphinx/book/box/box_session.rst           | 15 +++----
 doc/sphinx/book/box/box_space.rst             |  9 ++--
 doc/sphinx/book/box/index.rst                 |  5 +--
 doc/sphinx/book/box/limitations.rst           |  5 +--
 doc/sphinx/book/box/net_box.rst               | 12 ++----
 doc/sphinx/book/box/triggers.rst              |  2 +
 doc/sphinx/book/configuration.rst             |  3 ++
 doc/sphinx/book/connectors/index.rst          | 15 ++++---
 doc/sphinx/book/index.rst                     |  2 +-
 doc/sphinx/book/intro.rst                     |  2 +-
 .../index.rst}                                | 43 +++++++++----------
 doc/sphinx/conf.py                            |  3 +-
 doc/sphinx/dev_guide/box-protocol.rst         |  2 +
 doc/sphinx/dev_guide/building_from_source.rst |  2 +
 doc/sphinx/getting_started.rst                | 10 ++---
 doc/sphinx/reference/console.rst              | 10 ++---
 doc/sphinx/reference/expirationd.rst          |  1 +
 doc/sphinx/reference/log.rst                  | 10 ++---
 24 files changed, 89 insertions(+), 103 deletions(-)
 rename doc/sphinx/book/{replication.rst => replication/index.rst} (93%)

diff --git a/doc/sphinx/book/app_c_lua_tutorial.rst b/doc/sphinx/book/app_c_lua_tutorial.rst
index 2a3892bb96..9714dcdc25 100644
--- a/doc/sphinx/book/app_c_lua_tutorial.rst
+++ b/doc/sphinx/book/app_c_lua_tutorial.rst
@@ -36,8 +36,8 @@ and a running tarantool server which also serves as a client.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 We'll be making functions which go over one line. We don't want the client to
-send to the server after every line. So we `declare a delimiter`_. This means “Do
-not send to the server until you see an exclamation mark.”
+send to the server after every line. So we :ref:`declare a delimter <setting delimiter>`.
+This means “Do not send to the server until you see an exclamation mark.”
 
 .. code-block:: lua
 
@@ -46,8 +46,6 @@ not send to the server until you see an exclamation mark.”
 From now on it will be possible to use multiple-line statements, but it will be
 necessary to end all statements with exclamation marks.
 
-.. _declare a delimiter: :ref:`setting delimiter`
-
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Create a function that returns string
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -515,7 +513,8 @@ undeclared variable is "global". That's not desirable for any of the variables
 that are declared in line 1, because all of them are for use only within the function.
 
 LINE 3: WHY "PAIRS()". Our job is to go through all the rows and there are two
-ways to do it: with ``box.space.space-name:pairs()`` or with `index.iterator`_.
+ways to do it: with ``box.space.space-name:pairs()`` or with
+:func:`index.iterator <box.space.space-name.index[.index-name]:pairs>`.
 We preferred ``pairs()`` because it is simpler.
 
 LINE 4: WHY "PCALL". If we simply said "``lua_table = json.decode(t[2]))``", then
@@ -530,7 +529,6 @@ string, and the parameter is t[2] which is a reference to a JSON string. There's
 a bit of hard coding here, we're assuming that the second field in the tuple is
 where the JSON string was inserted. For example, we're assuming a tuple looks like
 
-.. _index.iterator: :func:`box.space.space-name.index[.index-name]:pairs`
 .. _protected call: http://www.lua.org/pil/8.4.html
 
 .. code-block:: json
diff --git a/doc/sphinx/book/app_d_plugins.rst b/doc/sphinx/book/app_d_plugins.rst
index 588fc2e7b3..8fc5f0ce52 100644
--- a/doc/sphinx/book/app_d_plugins.rst
+++ b/doc/sphinx/book/app_d_plugins.rst
@@ -1,6 +1,8 @@
 .. include:: ../directives.rst
 .. highlight:: lua
 
+.. _dbms-plugins:
+
 -------------------------------------------------------------------------------
                         Appendix D. Plugins
 -------------------------------------------------------------------------------
@@ -21,10 +23,9 @@ To call another DBMS from Tarantool, the essential requirements are: another
 DBMS, and Tarantool.
 
 It will be necessary to build Tarantool from source, as described in
-“ `Building from source`_ ”
+“ :ref:`building-from-source` ”
 
 .. _Tarantool Plugin API wiki page: https://github.com/tarantool/tarantool/wiki/Plugin-API
-.. _Building from source: :doc:`/dev_guide/building_from_source`
 
 The Tarantool plugins allow for connecting to an SQL server and executing SQL
 statements the same way that a MySQL or PostgreSQL client does. The SQL
diff --git a/doc/sphinx/book/box/admin.rst b/doc/sphinx/book/box/admin.rst
index 75e8e6c59e..f3f0ea30a5 100644
--- a/doc/sphinx/book/box/admin.rst
+++ b/doc/sphinx/book/box/admin.rst
@@ -10,7 +10,7 @@ A reference description also follows below:
 
 .. function:: box.snapshot()
 
-    Take a snapshot of all data and store it in `snap_dir`_/<latest-lsn>.snap.
+    Take a snapshot of all data and store it in :ref:`snap_dir <snap_dir>`/<latest-lsn>.snap.
     To take a snapshot, Tarantool first enters the delayed garbage collection
     mode for all data. In this mode, tuples which were allocated before the
     snapshot has started are not freed until the snapshot has finished. To
@@ -23,8 +23,8 @@ A reference description also follows below:
     saved in a matter of minutes. Note, that as long as there are any changes to
     the parent index memory through concurrent updates, there are going to be
     page splits, and therefore one needs to have some extra free memory to run
-    this command. 10% of `slab_alloc_arena`_ is, on average, sufficient. This
-    statement waits until a snapshot is taken and returns operation result.
+    this command. 10% of :ref:`slab_alloc_arena <slab_alloc_arena>` is, on average,
+    sufficient. This statement waits until a snapshot is taken and returns operation result.
 
     .. code-block:: lua
 
diff --git a/doc/sphinx/book/box/authentication.rst b/doc/sphinx/book/box/authentication.rst
index a6c5d48a3b..7919395d22 100644
--- a/doc/sphinx/book/box/authentication.rst
+++ b/doc/sphinx/book/box/authentication.rst
@@ -1,6 +1,8 @@
 .. include:: ../../directives.rst
 .. highlight:: lua
 
+.. _box-authentication:
+
 -------------------------------------------------------------------------------
                     Authentication and authorization
 -------------------------------------------------------------------------------
@@ -92,7 +94,7 @@ there are special functions which have appropriate error checking.
 To create a new user, say ``box.schema.user.create(user-name)`` or
 ``box.schema.user.create(user-name, {password=password})``. The form
 ``box.schema.user.create(user-name, {password=password})`` is better because
-in a `URI`_ (Uniform Resource Identifier) it is usually illegal to include a
+in a :ref:`URI` (Uniform Resource Identifier) it is usually illegal to include a
 user-name without a password.
 
 To change the current user's password, say ``box.schema.user.passwd(password)``.
@@ -127,8 +129,6 @@ selects a tuple in the ``_user`` space, and then drops the user.
 
     The maximum number of users is 32.
 
-.. _URI: :ref:`URI`
-
 ===========================================================
                Priveleges and _priv space
 ===========================================================
@@ -227,16 +227,15 @@ purposes are:
     box.session.su(user-name) -- allows changing current user to 'user-name'
 
 If a user types requests directly on the Tarantool server in its interactive
-mode, or if a user connects via telnet to the administrative port (using `admin`_
+mode, or if a user connects via telnet to the administrative port (using :ref:`admin <admin_port>`
 instead of listen), then the user by default is 'admin' and has many privileges.
-If a user connects from an application program via one of the `connectors`_, then
+If a user connects from an application program via one of the :ref:`connectors <box-connectors>`, then
 the user by default is 'guest' and has few privileges. Typically an admin user
 will set up and configure objects, then grant privileges to appropriate non-admin
 users. Typically a guest user will use ``box.session.su()`` to change into a non-generic
 user to whom admin has granted more than the default privileges. For example,
 admin might say:
 
-.. _admin: :ref:`admin_port
 .. _connectors: :doc:`../connectors/index`
 
 .. code-block:: lua
diff --git a/doc/sphinx/book/box/box_introspection.rst b/doc/sphinx/book/box/box_introspection.rst
index f5e248b39b..4f7c2e7b75 100644
--- a/doc/sphinx/book/box/box_introspection.rst
+++ b/doc/sphinx/book/box/box_introspection.rst
@@ -13,7 +13,7 @@
 
 The ``box.cfg`` package is for administrators to specify all the server
 configuration parameters; the full description of the parameters is in
-section Configuration_. Use ``box.cfg`` without braces to get read-only
+section :ref:`box-configuration`. Use ``box.cfg`` without braces to get read-only
 access to those parameters.
 
 .. data:: box.cfg
@@ -31,8 +31,6 @@ access to those parameters.
           ...
         ...
 
-.. _Configuration: :doc:`../configuration`
-
 =====================================================================
                          Package `box.info`
 =====================================================================
diff --git a/doc/sphinx/book/box/box_schema.rst b/doc/sphinx/book/box/box_schema.rst
index d603aefc25..cc608a226a 100644
--- a/doc/sphinx/book/box/box_schema.rst
+++ b/doc/sphinx/book/box/box_schema.rst
@@ -57,8 +57,7 @@ The ``box.schema`` package has one data-definition function: ``space.create()``.
     ---
     ...
 
-After a space is created, usually the next step is to `create an index`_ for it,
+After a space is created, usually the next step is to
+:func:`create an index <box.space.space-name.create_index>` for it,
 and then it is available for insert, select, and all the other :mod:`box.space`
 functions.
-
-.. _create an index: :func:`box.space.space-name:create_index`
diff --git a/doc/sphinx/book/box/box_session.rst b/doc/sphinx/book/box/box_session.rst
index b896e38e31..fc92f39da6 100644
--- a/doc/sphinx/book/box/box_session.rst
+++ b/doc/sphinx/book/box/box_session.rst
@@ -65,12 +65,9 @@ client connection.
     - 'radius_of_mars=3396 random_memorandum=Don''t forget the eggs. '
     ...
 
-See the section `Triggers on connect and disconnect`_ for instructions
-about defining triggers for connect and disconnect events with
-``box.session.on_connect()`` and ``box.session.on_disconnect()``. See
-the section `Authentication and access control`_ for instructions about
-``box.session`` functions that affect user identification and security.
-
-.. _Triggers on connect and disconnect: :doc:`triggers`
-.. _Authentication and access control:  :doc:`authentication`
-
+See the section :ref:`Triggers on connect and disconnect <box-triggers>`
+for instructions about defining triggers for connect and disconnect
+events with ``box.session.on_connect()`` and ``box.session.on_disconnect()``.
+See the section :ref:`Authentication and access control <box-authentication>`
+for instructions about ``box.session`` functions that affect user
+identification and security.
diff --git a/doc/sphinx/book/box/box_space.rst b/doc/sphinx/book/box/box_space.rst
index cb319294ca..6e4d4e9b38 100644
--- a/doc/sphinx/book/box/box_space.rst
+++ b/doc/sphinx/book/box/box_space.rst
@@ -711,20 +711,17 @@ A list of all ``box.space`` functions follows, then comes a list of all
 .. data::     _user
 
     ``_user`` is a new system tuple set for
-    support of the `authorization feature`_.
+    support of the :ref:`authorization feature <box-authentication>`.
 
 .. data::     _priv
 
     ``_priv`` is a new system tuple set for
-    support of the `authorization feature`_.
+    support of the :ref:`authorization feature <box-authentication>`.
 
 .. data::     _cluster
 
     ``_cluster`` is a new system tuple set
-    for support of the `replication feature`_.
-
-.. _authorization feature: :doc:`authentication`
-.. _replication feature: :doc:`replication`
+    for support of the :ref:`replication feature <box-replication>`.
 
 =================================================
                      Example
diff --git a/doc/sphinx/book/box/index.rst b/doc/sphinx/book/box/index.rst
index 79b5d79491..a096874172 100644
--- a/doc/sphinx/book/box/index.rst
+++ b/doc/sphinx/book/box/index.rst
@@ -62,15 +62,14 @@ introspection (inspecting contents of spaces, accessing server configuration).
     |                   | important than the others.                          |
     +-------------------+-----------------------------------------------------+
     | WAL settings      | The important setting for the write-ahead log is    |
-    |                   | `wal_mode`_. If the setting causes no writing or    |
+    |                   | :ref:`wal_mode <wal_mode>`. If the setting causes   |
+    |                   | no writing or                                       |
     |                   | delayed writing, this factor is unimportant. If the |
     |                   | settings causes every data-change request to wait   |
     |                   | for writing to finish on a slow device, this factor |
     |                   | is more important than all the others.              |
     +-------------------+-----------------------------------------------------+
 
-.. _wal_mode: :ref:`wal_mode`
-
 In the discussion of each data-manipulation function there will be a note about
 which Complexity Factors might affect the function's resource usage.
 
diff --git a/doc/sphinx/book/box/limitations.rst b/doc/sphinx/book/box/limitations.rst
index f4b6573571..b429c59940 100644
--- a/doc/sphinx/book/box/limitations.rst
+++ b/doc/sphinx/book/box/limitations.rst
@@ -27,7 +27,8 @@ Number of connections
 
 Space size
     The total maximum size for all spaces is in effect set by
-    `slab_alloc_arena`_, which in turn is limited by the total available memory.
+    :ref:`slab_alloc_arena <slab_alloc_arena>`, which in turn
+    is limited by the total available memory.
 
 Update operations count
     The maximum number of operations that can be in a single update
@@ -47,5 +48,3 @@ Limitations which are only applicable for the sophia storage engine
     not supported. Indexes must be unique, that is, the option unique=false
     is not supported. The ``alter()``, ``len()``, and ``count()`` functions
     are not supported.
-
-.. _slab_alloc_arena: :ref:`slab_alloc_arena`
diff --git a/doc/sphinx/book/box/net_box.rst b/doc/sphinx/book/box/net_box.rst
index 469674fef4..f0d6bb0ee8 100644
--- a/doc/sphinx/book/box/net_box.rst
+++ b/doc/sphinx/book/box/net_box.rst
@@ -7,17 +7,15 @@
 
 The ``net.box`` package contains connectors to remote database systems. One
 variant, ``box.net.sql``, is for connecting to MySQL or MariaDB or PostgreSQL —
-that variant is the subject of the `SQL DBMS plugins`_ appendix. In this section
-the subject is the built-in variant, ``box.net``. This is for connecting to
-tarantool servers via a network.
+that variant is the subject of the :ref:`SQL DBMS plugins <dbms-plugins>` appendix.
+In this section the subject is the built-in variant, ``box.net``. This is for
+connecting to tarantool servers via a network.
 
 Call ``require('net.box')`` to get a ``net.box`` object, which will be called
 ``net_box`` for examples in this section. Call ``net_box.new()`` to connect and
 get a connection object, which will be called conn for examples in this section.
 Call the other ``net.box()`` routines, passing ``conn:``, to execute requests on
-the remote box. Call `conn:close`_ to disconnect.
-
-.. _conn:close: :func:`connection_object:close`
+the remote box. Call :func:`conn:close <socket_object.close>` to disconnect.
 
 All `net.box`` methods are fiber-safe, that is, it is safe to share and use the
 same connection object across multiple concurrent fibers. In fact, it's perhaps
@@ -156,8 +154,6 @@ necessary to prioritize requests or to use different authentication ids.
         timeout expires: the timeout expiration only aborts the wait for the remote
         server response, not the request itself.
 
-.. _SQL DBMS plugins: :doc:`../app_d_plugins`
-
 ===========================================================
                         Example
 ===========================================================
diff --git a/doc/sphinx/book/box/triggers.rst b/doc/sphinx/book/box/triggers.rst
index 33b37e384c..da039f234f 100644
--- a/doc/sphinx/book/box/triggers.rst
+++ b/doc/sphinx/book/box/triggers.rst
@@ -1,6 +1,8 @@
 .. include:: ../../directives.rst
 .. highlight:: lua
 
+.. _box-triggers:
+
 -------------------------------------------------------------------------------
                             Triggers
 -------------------------------------------------------------------------------
diff --git a/doc/sphinx/book/configuration.rst b/doc/sphinx/book/configuration.rst
index 083d6e393e..279dead992 100644
--- a/doc/sphinx/book/configuration.rst
+++ b/doc/sphinx/book/configuration.rst
@@ -1,6 +1,8 @@
 .. include:: ../directives.rst
 .. highlight:: lua
 
+.. _box-configuration:
+
 -------------------------------------------------------------------------------
                         Configuration reference
 -------------------------------------------------------------------------------
@@ -64,6 +66,7 @@ Tarantool is started by entering the command:
 .. _git repository: git://github.com/tarantool/tarantool.git
 
 
+.. _URI:
 
 =====================================================================
                                 URI
diff --git a/doc/sphinx/book/connectors/index.rst b/doc/sphinx/book/connectors/index.rst
index d050e14360..111e6b211e 100644
--- a/doc/sphinx/book/connectors/index.rst
+++ b/doc/sphinx/book/connectors/index.rst
@@ -1,6 +1,8 @@
 .. include:: ../../directives.rst
 .. highlight:: lua
 
+.. _box-connectors:
+
 -------------------------------------------------------------------------------
                             Connectors
 -------------------------------------------------------------------------------
@@ -24,7 +26,7 @@ Unless implementing a client driver, one needn't concern oneself with the
 complications of the binary protocol. `Language-specific drivers`_ provide a
 friendly way to store domain language data structures in Tarantool. A complete
 description of the binary protocol is maintained in annotated Backus-Naur form
-in the source tree: please see `doc/box-protocol.html`_.
+in the source tree: please see :ref:`iproto protocol`.
 
 ====================================================================
                           Packet example
@@ -33,12 +35,15 @@ in the source tree: please see `doc/box-protocol.html`_.
 The Tarantool API exists so that a client program can send a request packet to
 the server, and receive a response. Here is an example of a what the client
 would send for ``box.space[513]:insert{'A', 'BB'}``. The BNF description of the
-components is in file `doc/box-protocol.html`_. A third-party contribution
-written in Lua for unpacking Tarantool messages is in file `Tnt-dissector`_.
+components is in :ref:`iproto protocol`.
+A third-party contribution written in Lua for unpacking Tarantool messages is in
+file `Tnt-dissector`_.
 
 .. _Tnt-dissector: https://github.com/negram/Tnt-dissector/blob/master/tarantool.dis.lua
+
 .. _Language-specific drivers: `Connectors`_
-.. _doc/box-protocol.html: :doc:`../../dev_guide/box-protocol.rst`
+
+.. _doc/box-protocol.html: :doc:`/dev_guide/box-protocol.rst`
 
 .. container:: table
 
@@ -61,7 +66,7 @@ written in Lua for unpacking Tarantool messages is in file `Tnt-dissector`_.
     +---------------------------------+---------+---------+---------+---------+
 
 Now, one could send that packet to the tarantool server, and interpret the response
-(`doc/box-protocol.html`_ has a description of the packet format for responses as
+(:ref:`iproto protocol` has a description of the packet format for responses as
 well as requests). But it would be easier, and less error-prone, if one could invoke
 a routine that formats the packet according to typed parameters. Something like
 ``response=tarantool_routine("insert",0,"A","B");``. And that is why APIs exist for
diff --git a/doc/sphinx/book/index.rst b/doc/sphinx/book/index.rst
index 832da98e8a..73e28acbb9 100644
--- a/doc/sphinx/book/index.rst
+++ b/doc/sphinx/book/index.rst
@@ -7,7 +7,7 @@
 
     intro
     box/index
-    replication
+    replication/index
     configuration
     administration
     connectors/index
diff --git a/doc/sphinx/book/intro.rst b/doc/sphinx/book/intro.rst
index c3569da548..64a093dda0 100644
--- a/doc/sphinx/book/intro.rst
+++ b/doc/sphinx/book/intro.rst
@@ -100,7 +100,7 @@ You can contact developers directly on the `#tarantool`_ IRC channel on freenode
 or via a mailing list, `Tarantool Google group`_.
 
 .. _#tarantool: irc://irc.freenode.net#tarantool
-.. _Tarantool Google group: https://googlegroups.com/group/tarantool
+.. _Tarantool Google group: https://groups.google.com/forum/#!forum/tarantool
 .. _Tarantool Russian-speaking list: https://googlegroups.com/group/tarantool-ru
 .. _Tarantool Gitter chat: https://gitter.im/tarantool/tarantool
 
diff --git a/doc/sphinx/book/replication.rst b/doc/sphinx/book/replication/index.rst
similarity index 93%
rename from doc/sphinx/book/replication.rst
rename to doc/sphinx/book/replication/index.rst
index d93fdc9869..5a02bef0e2 100644
--- a/doc/sphinx/book/replication.rst
+++ b/doc/sphinx/book/replication/index.rst
@@ -1,6 +1,8 @@
-.. include:: ../directives.rst
+.. include:: /directives.rst
 .. highlight:: lua
 
+.. _box-replication:
+
 -------------------------------------------------------------------------------
                     Replication
 -------------------------------------------------------------------------------
@@ -53,10 +55,10 @@ server is a master and starts its own new cluster with a new unique UUID.
 If this first ``box.cfg`` request occurs with a "replication_source" clause,
 then the server is a replica and its snapshot file, along with the cluster
 information, is constructed from the write-ahead logs of the master.
-Therefore, to start replication, specify `replication_source`_ in a ``box.cfg``
-request. When a replica contacts a master for the first time, it becomes part
-of a cluster. On subsequent occasions, it should always contact a master in
-the same cluster.
+Therefore, to start replication, specify :ref:`replication_source <replication_source>`
+in a ``box.cfg`` request. When a replica contacts a master for the first time,
+it becomes part of a cluster. On subsequent occasions, it should always contact
+a master in the same cluster.
 
 Once connected to the master, the replica requests all changes that happened
 after the latest local LSN. It is therefore necessary to keep WAL files on
@@ -74,7 +76,7 @@ Again, this procedure works only if the master's WAL files are present.
 .. NOTE::
 
     The replica does not inherit the master's configuration parameters, such
-    as the ones that cause the `snapshot daemon`_ to run on the master. To get
+    as the ones that cause the :ref:`snapshot daemon` to run on the master. To get
     the same behavior, one would have to set the relevant parameters explicitly
     so that they are the same on both master and replica.
 
@@ -111,7 +113,8 @@ Step 1. Start the first server thus:
 ... Now a new cluster exists.
 
 Step 2. Check where the second server's files will go by looking at its
-directories (`snap_dir`_ for snapshot files, `wal_dir`_ for .xlog files).
+directories (:ref:`snap_dir <snap_dir>` for snapshot files,
+:ref:`wal_dir <wal_dir>` for .xlog files).
 They must be empty - when the second server joins for the first time, it
 has to be working with a clean slate so that the initial copy of the first
 server's databases can happen without conflicts.
@@ -122,7 +125,7 @@ Step 3. Start the second server thus:
 
     box.cfg{listen=uri#2, replication_source=uri#1}
 
-... where ``uri#1`` = the `URI`_ that the first server is listening on.
+... where ``uri#1`` = the :ref:`URI` that the first server is listening on.
 
 That's all.
 
@@ -199,7 +202,7 @@ servers will end up with different contents.
 :Q: What if replication causes security concerns?
 :A: Prevent unauthorized replication sources by associating a password with
     every user that has access privileges for the relevant spaces. That way,
-    the `URI`_ for the replication_source parameter will always have to have
+    the :ref:`URI` for the replication_source parameter will always have to have
     the long form ``replication_source='username:password@host:port'``.
 
 .. _vector clock: https://en.wikipedia.org/wiki/Vector_clock
@@ -249,7 +252,7 @@ Now the screen looks like this: (except that UUID values are always different):
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/1-1.rst | .. include:: replication/1-2.rst |
+    | .. include:: 1-1.rst             | .. include:: 1-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -279,7 +282,7 @@ on Terminal #1, because both servers are in the same cluster.
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/2-1.rst | .. include:: replication/2-2.rst |
+    | .. include:: 2-1.rst             | .. include:: 2-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -299,7 +302,7 @@ Now the screen looks like this:
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/3-1.rst | .. include:: replication/3-2.rst |
+    | .. include:: 3-1.rst             | .. include:: 3-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -322,7 +325,7 @@ Now the screen looks like this:
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/4-1.rst | .. include:: replication/4-2.rst |
+    | .. include:: 4-1.rst             | .. include:: 4-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -347,7 +350,7 @@ same size because they both contain the same tuples.
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/5-1.rst | .. include:: replication/5-2.rst |
+    | .. include:: 5-1.rst             | .. include:: 5-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -368,7 +371,7 @@ Now the screen looks like this (ignoring the repeated messages saying
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/6-1.rst | .. include:: replication/6-2.rst |
+    | .. include:: 6-1.rst             | .. include:: 6-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -391,7 +394,7 @@ Now the screen looks like this (ignoring the repeated messages on terminal
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/7-1.rst | .. include:: replication/7-2.rst |
+    | .. include:: 7-1.rst             | .. include:: 7-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -414,7 +417,7 @@ The screen now looks like this:
     |          Terminal #1             |          Terminal #2             |
     +==================================+==================================+
     |                                  |                                  |
-    | .. include:: replication/8-1.rst | .. include:: replication/8-2.rst |
+    | .. include:: 8-1.rst             | .. include:: 8-2.rst             |
     |                                  |                                  |
     +----------------------------------+----------------------------------+
 
@@ -429,9 +432,3 @@ on either terminal say:
     cd ~
     rm -R ~/tarantool_test_node_1
     rm -R ~/tarantool_test_node_2
-
-.. _replication_source: :ref:`replication_source`
-.. _snap_dir: :ref:`snap_dir`
-.. _wal_dir:  :ref:`wal_dir`
-.. _snapshot daemon: :ref:`snapshot daemon`
-.. _uri: :ref:`URI`
diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
index ae75b99786..617ae442c8 100644
--- a/doc/sphinx/conf.py
+++ b/doc/sphinx/conf.py
@@ -76,7 +76,8 @@ version = '.'.join(release.split('.')[0:2])
 # directories to ignore when looking for source files.
 exclude_patterns = ['_build', 'directives.rst', 'book/connectors/__*']
 exclude_patterns += [
-    'book/replication'
+    'book/replication/*-1.rst',
+    'book/replication/*-2.rst'
 ]
 # The reST default role (used for this markup: `text`) to use for all
 # documents.
diff --git a/doc/sphinx/dev_guide/box-protocol.rst b/doc/sphinx/dev_guide/box-protocol.rst
index d559b9fc01..067a320d7a 100644
--- a/doc/sphinx/dev_guide/box-protocol.rst
+++ b/doc/sphinx/dev_guide/box-protocol.rst
@@ -4,6 +4,8 @@
 :url: doc/box-protocol.html
 :template: documentation_rst
 
+.. _iproto protocol:
+
 --------------------------------------------------------------------------------
                                IProto Protocol
 --------------------------------------------------------------------------------
diff --git a/doc/sphinx/dev_guide/building_from_source.rst b/doc/sphinx/dev_guide/building_from_source.rst
index 588f540911..38f65176e2 100644
--- a/doc/sphinx/dev_guide/building_from_source.rst
+++ b/doc/sphinx/dev_guide/building_from_source.rst
@@ -1,5 +1,7 @@
 .. include:: ../directives.rst
 
+.. _building-from-source:
+
 -------------------------------------------------------------------------------
                              Building from source
 -------------------------------------------------------------------------------
diff --git a/doc/sphinx/getting_started.rst b/doc/sphinx/getting_started.rst
index 9f53e7c621..47c3ade6ea 100644
--- a/doc/sphinx/getting_started.rst
+++ b/doc/sphinx/getting_started.rst
@@ -16,7 +16,7 @@ different parameters when building from source. The section about binaries is
 For development, you will want to download a source package and make the binary
 by yourself using a C/C++ compiler and common tools. Although this is a bit harder,
 it gives more control. And the source packages include additional files, for example
-the Tarantool test suite. The section about source is “`Building from source`_”
+the Tarantool test suite. The section about source is “:ref:`building-from-source` ”
 
 If the installation has already been done, then you should try it out. So we've
 provided some instructions that you can use to make a temporary “sandbox”. In a
@@ -223,7 +223,7 @@ Here is how to create a simple test database after installing.
        ~/tarantool/src/tarantool
 
    The server starts in interactive mode and outputs a command prompt.
-   To turn on the database, `configure`_ it:
+   To turn on the database, :mod:`configure <box.cfg>` it:
 
    .. code-block:: lua
 
@@ -261,7 +261,7 @@ Here is how to create a simple test database after installing.
    convenient for learning it will be used for most examples in
    this manual. Tarantool is waiting for the user to type instructions.
 
-   To create the first space and the first index_, try this:
+   To create the first space and the first :mod:`box.index`, try this:
 
    .. code-block:: lua
 
@@ -314,7 +314,3 @@ Here is how to create a simple test database after installing.
    .. code-block:: lua
 
        tarantool> box.schema.user.grant('guest','read,write,execute','universe')
-
-.. _Building from source: :dev:`/dev_guide/building_from_source`
-.. _configure: :mod:`box.cfg`
-.. _index: :mod:`box.index`
diff --git a/doc/sphinx/reference/console.rst b/doc/sphinx/reference/console.rst
index 111eb710f9..224d5e1ed2 100644
--- a/doc/sphinx/reference/console.rst
+++ b/doc/sphinx/reference/console.rst
@@ -13,7 +13,7 @@ host/port.
 
 .. function:: connect(uri [, options])
 
-    Connect to the server at URI_, change the prompt from 'tarantool' to
+    Connect to the server at :ref:`URI`, change the prompt from 'tarantool' to
     'host:port', and act henceforth as a client until the user ends the
     session or types ``control-D``.
 
@@ -56,7 +56,7 @@ host/port.
 .. function:: listen(host, port)
 
     Listen on host:port. The primary way of listening for incoming requests
-    is via the host and port, or URI_, specified in ``box.cfg{listen=...}``.
+    is via the host and port, or :ref:`URI`, specified in ``box.cfg{listen=...}``.
     The alternative way of listening is via the host and port, or URI,
     specified in ``console.listen(...)``. This alternative way is called
     "administrative" or simply "admin port".
@@ -66,12 +66,10 @@ host/port.
     :param string host:
     :param number port:
 
-    The "admin" address is the port or URI_ to listen on for administrative
+    The "admin" address is the port or :ref:`URI` to listen on for administrative
     connections. It has no default value, so it must be specified if
     connections will occur via telnet. It is not used unless assigned a
-    value. The parameters may be expressed with URI_ = Universal Resource
+    value. The parameters may be expressed with :ref:`URI` = Universal Resource
     Identifier format, for example "unix://unix_domain_socket", or as a
     numeric TCP port. Connections are often made with telnet.
     A typical port value is 3313.
-
-.. _URI: :ref:`URI`
diff --git a/doc/sphinx/reference/expirationd.rst b/doc/sphinx/reference/expirationd.rst
index 7f8975aac0..dfd077319c 100644
--- a/doc/sphinx/reference/expirationd.rst
+++ b/doc/sphinx/reference/expirationd.rst
@@ -103,5 +103,6 @@ some statistics. Of course, expirationd can be customized to do different things
 by passing different parameters, which will be evident after looking in more detail
 at the source code.
 
+.. _rock: http://rocks.tarantool.org/
 .. _expirationd.lua: https://github.com/tarantool/expirationd/blob/master/expirationd.lua
 .. _GitHub: https://github.com/tarantool/expirationd/blob/master/expirationd.lua
diff --git a/doc/sphinx/reference/log.rst b/doc/sphinx/reference/log.rst
index cc86058d7f..835982e136 100644
--- a/doc/sphinx/reference/log.rst
+++ b/doc/sphinx/reference/log.rst
@@ -8,7 +8,7 @@
 .. module:: log
 
 The Tarantool server puts all diagnostic messages in a log file specified by
-the `logger`_ configuration parameter. Diagnostic messages may be either
+the :ref:`logger <logger>` configuration parameter. Diagnostic messages may be either
 system-generated by the server's internal code, or user-generated with the
 ``log.log_level_function_name`` function.
 
@@ -17,7 +17,7 @@ system-generated by the server's internal code, or user-generated with the
               info(message)
               debug(message)
 
-    Output a user-generated message to the `log file`_, given
+    Output a user-generated message to the :ref:`log file <logger>`, given
     log_level_function_name = ``error`` or ``warn`` or ``info`` or ``debug``.
 
     :param string message: The actual output will be a line containing the
@@ -25,7 +25,7 @@ system-generated by the server's internal code, or user-generated with the
                            'I' or 'D' or 'R' depending on
                            ``log_level_function_name``, and ``message``.
                            Output will not occur if ``log_level_function_name``
-                           is for a type greater than `log_level`_.
+                           is for a type greater than :ref:`log_level <logger>`.
     :return: nil
 
 .. function:: logger_pid()
@@ -59,7 +59,3 @@ The output from the less command will look approximately like this:
 
 The 'Error' line is visible in tarantool.txt preceded by the letter E.
 The 'Info' line is not present because the log_level is 3.
-
-.. _logger: :ref:`logger`
-.. _log file: :ref:`logger`
-.. _log_level: :ref:`logger`
-- 
GitLab