diff options
author | chriseth <c@ethdev.com> | 2016-05-31 00:43:40 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-05-31 00:43:40 +0800 |
commit | 4be92c0c39b62547b67ebf75e617abab1ea8b454 (patch) | |
tree | e723698a595d6f4f2f07bb0150ea8fef00825dc9 /docs/layout-of-source-files.rst | |
parent | eb57a0c397748fd7fe4f899d5bf8a79290501405 (diff) | |
parent | d0a0e4f3d2f70e7957254987261c10807ed963e4 (diff) | |
download | dexon-solidity-4be92c0c39b62547b67ebf75e617abab1ea8b454.tar.gz dexon-solidity-4be92c0c39b62547b67ebf75e617abab1ea8b454.tar.zst dexon-solidity-4be92c0c39b62547b67ebf75e617abab1ea8b454.zip |
Merge pull request #596 from Denton-L/docs-inline-syntax
Corrected inline syntax in documentation
Diffstat (limited to 'docs/layout-of-source-files.rst')
-rw-r--r-- | docs/layout-of-source-files.rst | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 07f796da..c21e7280 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -28,13 +28,13 @@ current global scope (different than in ES6 but backwards-compatible for Solidit import * as symbolName from "filename"; -...creates a new global symbol `symbolName` whose members are all the global symbols from `"filename"`. +...creates a new global symbol ``symbolName`` whose members are all the global symbols from ``"filename"``. :: import {symbol1 as alias, symbol2} from "filename"; -...creates new global symbols `alias` and `symbol2` which reference `symbol1` and `symbol2` from `"filename"`, respectively. +...creates new global symbols ``alias`` and ``symbol2`` which reference ``symbol1`` and ``symbol2`` from ``"filename"``, respectively. Another syntax is not part of ES6, but probably convenient: @@ -42,17 +42,17 @@ Another syntax is not part of ES6, but probably convenient: import "filename" as symbolName; -...is equivalent to `import * as symbolName from "filename";`. +...is equivalent to ``import * as symbolName from "filename";``. Paths ----- -In the above, `filename` is always treated as a path with `/` as directory separator, -`.` as the current and `..` as the parent directory. Path names that do not start -with `.` are treated as absolute paths. +In the above, ``filename`` is always treated as a path with ``/`` as directory separator, +``.`` as the current and ``..`` as the parent directory. Path names that do not start +with ``.`` are treated as absolute paths. -To import a file `x` from the same directory as the current file, use `import "./x" as x;`. -If you use `import "x" as x;` instead, a different file could be referenced +To import a file ``x`` from the same directory as the current file, use ``import "./x" as x;``. +If you use ``import "x" as x;`` instead, a different file could be referenced (in a global "include directory"). It depends on the compiler (see below) how to actually resolve the paths. @@ -64,22 +64,22 @@ Use in actual Compilers When the compiler is invoked, it is not only possible to specify how to discover the first element of a path, but it is possible to specify path prefix -remappings so that e.g. `github.com/ethereum/dapp-bin/library` is remapped to -`/usr/local/dapp-bin/library` and the compiler will read the files from there. If +remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to +``/usr/local/dapp-bin/library`` and the compiler will read the files from there. If remapping keys are prefixes of each other, the longest is tried first. This -allows for a "fallback-remapping" with e.g. `""` maps to -`"/usr/local/include/solidity"`. +allows for a "fallback-remapping" with e.g. ``""`` maps to +``"/usr/local/include/solidity"``. **solc**: -For solc (the commandline compiler), these remappings are provided as `key=value` -arguments, where the `=value` part is optional (and defaults to key in that +For solc (the commandline compiler), these remappings are provided as ``key=value`` +arguments, where the ``=value`` part is optional (and defaults to key in that case). All remapping values that are regular files are compiled (including their dependencies). This mechanism is completely backwards-compatible (as long as no filename contains a =) and thus not a breaking change. So as an example, if you clone -`github.com/ethereum/dapp-bin/` locally to `/usr/local/dapp-bin`, you can use +``github.com/ethereum/dapp-bin/`` locally to ``/usr/local/dapp-bin``, you can use the following in your source file: :: @@ -96,7 +96,7 @@ Note that solc only allows you to include files from certain directories: They have to be in the directory (or subdirectory) of one of the explicitly specified source files or in the directory (or subdirectory) of a remapping target. If you want to allow direct absolute includes, just add the -remapping `=/`. +remapping ``=/``. If there are multiple remappings that lead to a valid file, the remapping with the longest common prefix is chosen. @@ -107,7 +107,7 @@ The `browser-based compiler <https://ethereum.github.io/browser-solidity>`_ provides an automatic remapping for github and will also automatically retrieve the file over the network: You can import the iterable mapping by e.g. -`import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;`. +``import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;``. Other source code providers may be added in the future. @@ -117,7 +117,7 @@ Other source code providers may be added in the future. Comments ======== -Single-line comments (`//`) and multi-line comments (`/*...*/`) are possible. +Single-line comments (``//``) and multi-line comments (``/*...*/``) are possible. :: @@ -131,7 +131,7 @@ Single-line comments (`//`) and multi-line comments (`/*...*/`) are possible. Additionally, there is another type of comment called a natspec comment, for which the documentation is not yet written. They are written with a -triple slash (`///`) or a double asterisk block(`/** ... */`) and +triple slash (``///``) or a double asterisk block(``/** ... */``) and they should be used directly above function declarations or statements. You can use Doxygen-style tags inside these comments to document functions, annotate conditions for formal verification, and provide a |