Importante

A tradução é um esforço comunitário você pode contribuir. Esta página está atualmente traduzida em 75.74%.

2. Orientações para Escrita

Em geral, ao criar a documentação do reST para o projeto QGIS, siga as `diretrizes de estilo de documentação do Python <https://devguide.python.org/documenting/> _. Por conveniência, fornecemos um conjunto de regras gerais nas quais confiamos para escrever a documentação do QGIS abaixo.

2.1. Escrevendo Documentação

2.1.1. Cabeçalhos

Cada página da web da documentação corresponde a um arquivo .rst.

Sections used to structure the text are identified through their title which is underlined (and overlined for the first level). Same level titles must use same character for underline adornment. Precede section titles with a blank line. In QGIS Documentation, you should use following styles for chapter, section, subsection and minisec.

********
Chapter
********

Section
=======

Subsection
----------

Minisec
.......

Subminisec
^^^^^^^^^^

2.1.2. Listas

Lists are useful for structuring the text. Here are some simple rules common to all lists:

  • Comece todos os itens da lista com uma letra maiúscula

  • Não utilize pontuação após itens em lista que contém apenas uma sentença

  • Use period ( . ) as punctuation for list items that consist of several sentences or a single compound sentence

2.1.3. Indentação

Indentation in reStructuredText should be aligned with the list or markup marker. It is also possible to create block quotes with indentation. See the Specification

#. In a numbered list, there should be
   three spaces when you break lines
#. And next items directly follow

   * Nested lists
   * Are also possible
   * And when they also have
     a line that is too long,
     the text should be naturally
     aligned
   * and be in their own paragraph

However, if there is an unindented paragraph, this will reset the numbering:

#. This item starts at 1 again

2.1.4. Etiquetas na linha

Você pode usar etiquetas para enfatizar itens.

  • Menu da GUI: para marcar uma sequência completa de seleções de menu, incluindo a seleção de submenus e a escolha de uma operação específica ou qualquer subsequência dessa sequência.

    :menuselection:`menu --> submenu`
    
  • Dialogs and Tab titles: Labels presented as part of an interactive user interface including window titles, tab titles, button and option labels.

    :guilabel:`title`
    
  • Nomes de arquivos e diretórios

    :file:`README.rst`
    
  • Ícones com texto popup

    |icon| :sup:`popup_text`
    

    (veja image abaixo).

  • Atalhos do Teclado

    :kbd:`Ctrl+B`
    

    irá mostrar Ctrl+B

    Ao descrever os atalhos de teclado, as seguintes convenções devem ser usadas:

    • As teclas de letras são exibidas em maiúsculas: S

    • As teclas especiais são exibidas com uma primeira letra maiúscula: Esc

    • Key combinations are displayed with a + sign between keys, without spaces: Shift+R

  • Texto do usuário

    ``label``
    
  • Layers, databases, tables or columns names

    When referring to layers, databases, tables or columns, format as inline code:

    ``layer name``
    ``database_name``
    ``table_name``
    ``column_name``
    

2.1.5. Rótulos/referências

As âncoras dentro do texto podem ser usadas para criar hiperlinks para seções ou páginas.

O exemplo abaixo cria a âncora de uma seção (por exemplo, Rótulo/título de referência)

.. _my_anchor:

Label/reference
---------------

Para chamar a referência na mesma página, use

see my_anchor_ for more information.

o qual irá retornar:

veja my_anchor para mais informação.

Observe que ele vai pular para a linha/coisa seguindo a ‘âncora’. Você não precisa usar apóstrofes, mas precisa ter linhas vazias após a âncora.

Um outro modo para pular para o mesmo lugar de qualquer lugar na documentação é usar a regra “:ref:”.

see :ref:`my_anchor` for more information.

que criará um link com a legenda (neste caso, o título desta seção!):

veja :ref:’my_anchor’ para mais informação.

Portanto, a referência 1 (my_anchor) e a referência 2 (Rótulos/referências). Como a referência geralmente exibe uma legenda completa, não é realmente necessário usar a palavra seção. Observe que você também pode usar uma legenda personalizada para descrever a referência:

see :ref:`Label and reference <my_anchor>` for more information.

que retorna:

veja Rótulo e referência para mais informação.

2.1.6. Figuras e Imagens

Fotos

Para inserir uma imagem, use

.. figure:: /static/common/logo.png
   :width: 10 em

o qual retorna

../../_images/logo.png

Icon substitution

You can add an image inside a text paragraph (e.g., as a tool icon). To do so, you first need to create an alias (also named substitution), which is a reference name used to display the icon. To ensure consistency across the documents and help in the use of the icons, we maintain a list in the substitutions.txt file at the root of this repository. Find more details in the Substituições chapter.

Using an icon substitution is usually achieved through these steps:

  1. Add the icon substitution in the substitutions.txt file as below. If a substitution already exists for the icon you want to use, then skip this step.

    .. |logo| image:: /static/common/logo.png
       :width: 1 em
    
  2. Call it in your paragraph:

    My paragraph begins here with |logo|.
    
  3. Add (again) the icon substitution at the end of the file you are modifying. This helps connecting the replacement text with the actual image, and can be done by copy-pasting it from substitutions.txt or by executing the scripts/find_set_subst.py script.

    This is how the example will be displayed:

    My paragraph begins here with logo.

Figura

.. _figure_logo:

.. figure:: /static/common/logo.png
   :width: 20 em
   :align: center

   A caption: A logo I like

O resultado se parece com isso:

../../_images/logo.png

Fig. 2.24 Uma legenda: Um logo de que eu gosto

To avoid conflicts with other references, always begin figure anchors with _figure_ and use terms that easily connect to the figure caption. While only the centered alignment is mandatory for the image, feel free to use any other options for figures (such as width, height, scale…) if needed.

Os scripts irão inserir um número gerado automaticamente antes da legenda da figura nas versões HTML e PDF geradas da documentação.

Para usar uma legenda (veja Minha legenda), basta inserir o texto recuado após uma linha em branco no bloco de figuras.

A figure can be referenced using the reference label like this:

see :numref:`figure_logo`

renderiza assim:

veja logotipo_figura

Esta é a forma preferida de referenciar figuras.

Nota

Para que :numref: funcione, a figura deve ter uma legenda

É possível usar :ref: em vez de :numref: para referência, mas isso retorna a legenda completa da imagem.

see :ref:`figure_logo`

renderiza assim:

veja Uma legenda: Um logo de que eu gosto

2.1.7. Tabelas

You can make a simple table like this:

=======  =======  =======
x        y        z
=======  =======  =======
1        2        3
4                 5
=======  =======  =======

Vai renderizar assim:

x

y

z

1

2

3

4

5

Tables should have a caption. You can use an explicit reST “table” directive to add a caption to simple tables or grid tables. Add the caption on the same line as the directive and indent the table at least one space.

You can also add a hyperlink target before a table in order to reference it elsewhere. To avoid conflicts with other references, always begin hyperlink targets with _table_ and use terms relevant to the table caption.

Here is an example of a more complicated grid table with a caption and a hyperlink target:

.. _table-grid-caption:

.. table:: Grid table with caption

   +---------------+--------------------+
   | Windows       | macOS              |
   +---------------+--------------------+
   | |win|         | |osx|              |
   +---------------+--------------------+
   | and of course not to forget |nix|  |
   +------------------------------------+

O resultado:

Tabela 2.2 Grid table with caption

Windows

macOS

win

osx

e, é claro, não se esqueça nix

You may find it easier to use list tables or CSV tables to make complex tables. Add the caption after the list-table or csv-table directive.

Here is an example of a list table with a caption and a hyperlink target:

.. _table-list-caption:

.. list-table:: List table with caption
   :header-rows: 1
   :widths: 20 20 20 40

   * - What
     - Purpose
     - Key word
     - Description
   * - **Test**
     - ``Useful test``
     - complexity
     - Geometry.  One of:

       * Point
       * Line

O resultado:

Tabela 2.3 List table with caption

O Que

Finalidade

Palavra chave

Descrição

Teste

Teste Útil

complexidade

Geometria. Uma de:

  • Ponto

  • Linha

Use :numref: roles to reference tables like this:

see :numref:`table-grid-caption` or :numref:`table-list-caption`

O resultado:

Nota

You must add a caption to your table in order to create a cross reference with the :numref: role.

2.1.8. Index

Um índice é uma maneira útil de ajudar o leitor a encontrar informações em um documento. A documentação do QGIS fornece alguns índices essenciais. Existem algumas regras que nos ajudam a fornecer um conjunto de índices que são realmente úteis (coerentes, consistentes e realmente conectados entre si):

  • Um índice deve ser legível por humanos, compreensível e traduzível; um índice pode ser criado com muitas palavras, mas você deve evitar caracteres _, - … desnecessários para vinculá-los, ou seja, Carregando camadas em vez de carregando_camadas ou carregandoCamadas.

  • Coloque letra maiúscula apenas a primeira letra do índice, a menos que a palavra tenha uma ortografia específica. Por exemplo, Carregamento de camadas, Geração do atlas, WMS, pgsql2shp.

  • Fique de olho na Lista de índices para reutilizar a expressão mais conveniente com a ortografia correta e evitar duplicatas desnecessárias.

Several index tags exist in reST. You can use the inline :index: tag within normal text:

QGIS can load several :index:`Vector formats` supported by GDAL ...

Or you can use the .. index:: block-level markup which links to the beginning of the next paragraph. Because of the rules mentioned above, it is recommended to use the block-level tag:

.. index:: WMS, WFS, Loading layers

Também é recomendável usar parâmetros de índice como single, pair e see, a fim de criar uma tabela de índice mais estruturada e interconectada. Consulte Geração de índice para obter mais informações sobre a criação de índices.

2.1.9. Comentários especiais

Sometimes, you may want to emphasize some points of the description, either to warn, remind or give some hints to the user. In QGIS Documentation, we use reST special directives such as .. warning::, .. seealso::, .. note:: and .. tip::. These directives generate frames that highlight your comments. See Paragraph Level markup for more information. A clear and appropriate title is required for both warnings and tips.

.. tip:: **Always use a meaningful title for tips**

   Begin tips with a title that summarizes what it is about. This helps
   users to quickly overview the message you want to give them, and
   decide on its relevance.

2.1.10. Partes de código

You may also want to give examples and insert code snippets. In this case, write the comment below a line with the :: directive inserted. For a better rendering, especially to apply color highlighting to code according to its language, use the code-block directive, e.g. .. code-block:: xml. More details at Showing code.

Nota

Text in special comments will be translated, but text in code-block frames will not be translated. So keep comments in code blocks as short as possible and avoid comments unrelated to code.

2.1.11. Notas de rodapé

This is for creating a footnote (showing as example [1])

blabla [1]_

Que irá apontar para:

2.2. Gerenciando Capturas de Tela

2.2.1. Adicionar novas Capturas de Tela

Aqui estão algumas dicas para criar novas capturas de tela com boa aparência. As imagens devem ser colocadas em uma pasta de imagem (img /) localizada na mesma pasta que o arquivo referenciando .rst.

  • You can find some prepared QGIS projects that are used to create screenshots in the ./qgis-projects folder of this repository. This makes it easier to reproduce screenshots for the next version of QGIS. These projects use the QGIS Sample Data (aka Alaska Dataset), which should be unzipped and placed in the same folder as the QGIS-Documentation Repository.

  • Reduza a janela para o espaço mínimo necessário para mostrar o recurso (usar a tela inteira para uma pequena janela modal > exagero)

  • Quanto menos bagunça, melhor (não é necessário ativar todas as barras de ferramentas)

  • Don’t resize them in an image editor; the size will be set into the .rst files if necessary (downscaling the dimensions without properly upping the resolution > ugly)

  • Recorta o fundo

  • Tornar os cantos superiores transparentes se o fundo não for branco

  • Set print size resolution to 135 dpi (e.g., in GIMP scale down the image using Image ► Scale Image and setting “X/Y” to 135 pixels/in, and export it through File ► Export…). This way, images will be at original size in HTML and at a good print resolution in the PDF.

    You can also use ImageMagick convert command to do a batch of images:

    convert -units PixelsPerInch input.png -density 135 output.png
    
  • Salve-os como .png (para evitar artefatos file:.jpeg)

  • The screenshot should show the content according to what is described in the text

Dica

Se você estiver usando o Ubuntu, pode usar o seguinte comando para remover a função de menu global e criar telas menores de aplicativos com menus:

sudo apt autoremove appmenu-gtk appmenu-gtk3 appmenu-qt

2.2.2. Capturas de Tela Traduzidas

Aqui estão algumas dicas adicionais para quem deseja criar capturas de tela para um guia do usuário traduzido:

Translated images should be placed in a img/<your_language>/ folder. Use the same filename as the ‘original’ English screenshot.

2.3. Documentando os Algoritmos de Processamento

Se você deseja escrever a documentação para os Algoritmos de processamento, considere estas diretrizes:

  • Processing algorithm help files are part of QGIS User Guide, so use the same formatting as the User Guide and other documentation.

  • Each algorithm documentation should be placed in the corresponding provider folder and group file, e.g. the algorithm Voronoi polygon belongs to the QGIS provider and to the group vectorgeometry. So the correct file to add the description is: source/docs/user_manual/processing_algs/qgis/vectorgeometry.rst.

    Nota

    Antes de começar a escrever o guia, verifique se o algoritmo já está descrito. Nesse caso, você pode melhorar a descrição existente.

  • It is extremely important that each algorithm has an anchor that corresponds to the provider name + the unique name of the algorithm itself. This allows the Help button to open the Help page of the correct section. The anchor should be placed above the title, e.g. (see also the Rótulos/referências section):

    .. _qgisvoronoipolygons:
    
    Voronoi polygons
    ----------------
    

    Para descobrir o nome do algoritmo, basta passar o mouse sobre o algoritmo na caixa de ferramentas Processamento.

  • Avoid using “This algorithm does this and that…” as the first sentence in the algorithm description. Try to use more general expressions like:

    Takes a point layer and generates a polygon layer containing the...
    
  • Avoid describing what the algorithm does by replicating its name and please don’t replicate the name of the parameter in the description of the parameter itself. For example if the algorithm is Voronoi polygon consider to describe the Input layer as Layer to calculate the polygon from.

  • Indique na descrição se o algoritmo possui um atalho padrão no QGIS ou suporta a edição no local.

  • Inclua imagens! Uma imagem vale mais do que mil palavras! Use o formato .png e siga as orientações gerais para documentação (veja a seção Figuras e Imagens para mais informações). Coloque o arquivo de imagem na pasta correta, i.e. a pasta img próxima do arquivo .rst que você está editando.

  • Se necessário, adicione links na seção “Veja também” que fornecem informações adicionais sobre o algoritmo (por exemplo, publicações ou páginas da web). Adicione apenas a seção “Veja também” se realmente houver algo para ver. Como boa prática, a seção “Veja também” pode ser preenchida com links para algoritmos semelhantes.

  • Give clear explanation for algorithm parameters and outputs: take inspiration from existing algorithms.

  • Evite duplicar a descrição detalhada das opções do algoritmo. Adicione essas informações na descrição do parâmetro.

  • Avoid adding information about the vector geometry type in the algorithm or parameter description, as this information is already available in the parameter descriptions.

  • Add the default value of the parameter, e.g.:

    * - **Number of points**
      - ``NUMBER_OF_POINTS``
      - [numeric: integer]
    
        Default: 1
      - Number of points to create
    
  • Descreva o tipo de entrada suportado pelos parâmetros. Existem vários tipos disponíveis, você pode escolher um:

    Parâmetro/Tipo de saída

    Descrição

    Indicador visual

    Camada de vetor de ponto

    vetor: ponto

    pointLayer

    Camada vetor linha

    vetor: linha

    lineLayer

    Camada de vetor de polígono

    vetor: polígono

    polygonLayer

    All spatial vector layers

    vector: geometry

    Geometryless vector layer

    vector: table

    tableLayer

    Camada vetorial genérica

    vetor: qualquer

    Vector field numeric

    campo de tabela: numérico

    fieldFloat

    String de campo vetorial

    campo de tabela: string

    fieldText

    Campo vetorial genérico

    campo de tabela: qualquer

    Camada raster

    raster

    rasterLayer

    Banda raster

    banda raster

    arquivo HTML

    html

    Expressão

    expressão

    expression

    Line geometry

    geometry: line

    Geometria de pontos

    coordenadas

    Extensão

    extensão

    SRC

    crs

    setProjection

    Enumeração

    enumeração

    selectString

    Lista

    lista

    Integer value

    numeric: integer

    selectNumber

    Decimal value

    numeric: double

    selectNumber

    String

    string

    inputText

    Booleano

    boolean

    checkbox

    Caminho da pasta

    pasta

    Arquivo

    arquivo

    Matriz

    matrix

    Camada

    camada

    Mesmo tipo de saída que o tipo de entrada

    mesmo da entrada

    Definição

    definition

    Map layers

    layer list

    Intervalo

    range

    AuthConfig

    authconfig

    Malha

    mesh

    Layout

    layout

    LayoutItem

    layoutitem

    Cor

    color

    Escala

    scale

    Map theme

    map theme

  • Estude um algoritmo bem documentado existente e copie todos os layouts úteis.

  • Quando você tiver terminado, basta seguir as diretrizes descritas em Uma Contribuição Passo a Passo para confirmar suas alterações e fazer uma Pull Request

Here is an example of an existing algorithm to help you with the layout and the description:

.. _qgiscountpointsinpolygon:

Count points in polygon
-----------------------
Takes a point and a polygon layer and counts the number of points from the
point layer in each of the polygons of the polygon layer.
A new polygon layer is generated, with the exact same content as the input
polygon layer, but containing an additional field with the points count
corresponding to each polygon.

.. figure:: img/count_points_polygon.png
  :align: center

  The labels in the polygons show the point count

An optional weight field can be used to assign weights to each point.
Alternatively, a unique class field can be specified. If both options
are used, the weight field will take precedence and the unique class field
will be ignored.

``Default menu``: :menuselection:`Vector --> Analysis Tools`

Parameters
..........

.. list-table::
   :header-rows: 1
   :widths: 20 20 20 40
   :class: longtable

   * - Label
     - Name
     - Type
     - Description
   * - **Polygons**
     - ``POLYGONS``
     - [vector: polygon]
     - Polygon layer whose features are associated with the count of
       points they contain
   * - **Points**
     - ``POINTS``
     - [vector: point]
     - Point layer with features to count
   * - **Weight field**

       Optional
     - ``WEIGHT``
     - [tablefield: numeric]
     - A field from the point layer.
       The count generated will be the sum of the weight field of the
       points contained by the polygon.
   * - **Class field**

       Optional
     - ``CLASSFIELD``
     - [tablefield: any]
     - Points are classified based on the selected attribute and if
       several points with the same attribute value are within the
       polygon, only one of them is counted.
       The final count of the points in a polygon is, therefore, the
       count of different classes that are found in it.
   * - **Count field name**
     - ``FIELD``
     - [string]

       Default: 'NUMPOINTS'
     - The name of the field to store the count of points
   * - **Count**
     - ``OUTPUT``
     - [vector: polygon]

       Default: [Create temporary layer]
     - Specification of the output layer type (temporary, file,
       GeoPackage or PostGIS table).
       Encoding can also be specified.

Outputs
.......

.. list-table::
   :header-rows: 1
   :widths: 20 20 20 40

   * - Label
     - Name
     - Type
     - Description
   * - **Count**
     - ``OUTPUT``
     - [vector: polygon]
     - Resulting layer with the attribute table containing the
       new column with the points count