Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
# Pre-commit hooks for QGIS Documentation
# Install: pre-commit install
# Run manually: pre-commit run --all-files
# Update hooks: pre-commit autoupdate

repos:

- repo: local
# RST linting with rstcheck
- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.0
hooks:
- id: find_set_subst
name: find_set_subst
entry: ./scripts/find_set_subst.py
language: system
always_run: true
pass_filenames: false
- id: rstcheck
args:
- --report-level=warning
- --ignore-directives=toctree,include,only,ifconfig,literalinclude,index,glossary,substitution-definitions,highlight,todo,todolist,deprecated,versionadded,versionchanged,seealso,productionlist,centered,testcleanup,testcode,testoutput,testsetup,tabs,tab,code-block,toggle
- --ignore-roles=menuselection,guilabel,file,kbd,ref,doc,term,command,program,option,envvar,index,abbr,dfn,numref,eq,download,py:mod,py:obj,py:class,py:meth,py:attr,py:func,py:exc,pyqgis,api,source,sup,sub,raw,math
- --ignore-languages=python,bash,sql,json,xml,yaml
- --ignore-substitutions=version,rarr,srtmFileName
exclude: ^(locale/|_dummy/|build/)
additional_dependencies:
- sphinx

# - repo: local
# hooks:
# - id: find_set_subst
# name: find_set_subst
# entry: ./scripts/find_set_subst.py
# language: system
# always_run: true
# pass_filenames: false

ci:
autofix_prs: true
Expand Down
2 changes: 1 addition & 1 deletion docs/pyqgis_developer_cookbook/loadlayer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ providers:

* for ESRI Shapefile:

.. code::
.. code-block:: python

uri = "testdata/airports.shp"
vlayer = QgsVectorLayer(uri, "layer_name_you_like", "ogr")
Expand Down
2 changes: 1 addition & 1 deletion docs/pyqgis_developer_cookbook/plugins/snippets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ For example, to reuse the |fileOpen|
:source:`mActionFileOpen.svg <images/themes/default/mActionFileOpen.svg>` icon available
in the QGIS code repository:

.. code:: py
.. code-block:: python

# e.g. somewhere in the initGui
self.file_open_action = QAction(
Expand Down
14 changes: 7 additions & 7 deletions docs/user_manual/print_layout/create_output.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,14 @@ include expressions. Make sure that you place the expression part
For example, for a city layer with fields ``CITY_NAME`` and ``ZIPCODE``,
you could insert this:

.. code::
.. code-block:: text

The area of [% concat( upper(CITY_NAME), ',', ZIPCODE, ' is ',
format_number($area/1000000, 2) ) %] km2

or, another combination:

.. code::
.. code-block:: text

The area of [% upper(CITY_NAME)%],[%ZIPCODE%] is
[%format_number($area/1000000,2) %] km2
Expand Down Expand Up @@ -440,7 +440,7 @@ field :guilabel:`Orientation`, select :guilabel:`Edit...` to open the
:guilabel:`Expression string builder` dialog and enter the following
expression:

.. code::
.. code-block:: text

CASE WHEN bounds_width(@atlas_geometry) > bounds_height(@atlas_geometry)
THEN 'Landscape' ELSE 'Portrait' END
Expand All @@ -451,14 +451,14 @@ reposition the location of the layout items as well. For the map item you can
use the |dataDefine| button of its :guilabel:`Width` property to set it
dynamic using the following expression:

.. code::
.. code-block:: text

@layout_pagewidth - 20

Likewise, use the |dataDefine| button of the :guilabel:`Height` property to
provide the following expression to constrain map item size:

.. code::
.. code-block:: text

@layout_pageheight - 20

Expand All @@ -472,7 +472,7 @@ Next move the label to the right position, choose the middle button for
the :guilabel:`Reference point`, and provide the following expression for
field :guilabel:`X`:

.. code::
.. code-block:: text

@layout_pagewidth / 2

Expand Down Expand Up @@ -593,7 +593,7 @@ Using the JavaScript ``setFeature`` function it allows you to make flexible HTML
which represents relations in whatever format you like (lists, tables, etc).
In the code sample, we create a dynamic bullet list of the related child features.

.. code:: html
.. code-block:: html

// Declare the two HTML div elements we will use for the parent feature id
// and information about the children
Expand Down
2 changes: 1 addition & 1 deletion docs/user_manual/processing_algs/qgis/rasteranalysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4650,6 +4650,7 @@ Python code
:end-before: **end_algorithm_code_section**


.. |344| replace:: ``NEW in 3.44``
.. |gaussian_formula| image:: img/fuzzy_gaussian_formula.png
:height: 1.5em
.. |fuzzy_large_formula| image:: img/fuzzy_large_formula.png
Expand All @@ -4670,5 +4671,4 @@ Python code
please add it also to the substitutions.txt file in the
source folder.

.. |344| replace:: ``NEW in 3.44``
.. |400| replace:: ``NEW in 4.0``
Original file line number Diff line number Diff line change
Expand Up @@ -1182,11 +1182,14 @@ Python code
:start-after: **algorithm_code_section**
:end-before: **end_algorithm_code_section**


.. |344| replace:: ``NEW in 3.44``


.. Substitutions definitions - AVOID EDITING PAST THIS LINE
This will be automatically updated by the find_set_subst.py script.
If you need to create a new substitution manually,
please add it also to the substitutions.txt file in the
source folder.

.. |344| replace:: ``NEW in 3.44``
.. |400| replace:: ``NEW in 4.0``
6 changes: 3 additions & 3 deletions docs/user_manual/working_with_vector/vector_properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,7 @@ In all cases you must enter the name of the function that will be called

An example is (in module MyForms.py):

::
.. code-block:: python

def open(dialog,layer,feature):
geom = feature.geometry()
Expand Down Expand Up @@ -3381,15 +3381,15 @@ able to make a spatial selection of localities and export these field values
to a text file for the selected record (shown in yellow in the QGIS map area).
Here is the action to achieve this:

::
.. code-block:: bash

bash -c "echo \"%taxon_name %lat %long\" >> /tmp/species_localities.txt"


After selecting a few localities and running the action on each one, opening
the output file will show something like this:

::
.. code-block:: text

Acacia mearnsii -34.0800000000 150.0800000000
Acacia mearnsii -34.9000000000 150.1200000000
Expand Down
Loading