Skip to content

Commit 882f182

Browse files
authored
Merge pull request #3503 from lonvia/mkdocs-without-cmake
Build documentation without CMake
2 parents 738e99c + d1e7b85 commit 882f182

18 files changed

+256
-150
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.swp
44

55
docs/develop/*.png
6+
site-html
67

78
build
89
dist

CMakeLists.txt

-18
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ set(BUILD_IMPORTER on CACHE BOOL "Build everything for importing/updating the da
4646
set(BUILD_API on CACHE BOOL "Build everything for the API server")
4747
set(BUILD_MODULE off CACHE BOOL "Build PostgreSQL module for legacy tokenizer")
4848
set(BUILD_TESTS on CACHE BOOL "Build test suite")
49-
set(BUILD_DOCS on CACHE BOOL "Build documentation")
50-
set(BUILD_MANPAGE on CACHE BOOL "Build Manual Page")
5149
set(BUILD_OSM2PGSQL on CACHE BOOL "Build osm2pgsql (expert only)")
5250
set(INSTALL_MUNIN_PLUGINS on CACHE BOOL "Install Munin plugins for supervising Nominatim")
5351

@@ -188,22 +186,6 @@ if (BUILD_MODULE)
188186
add_subdirectory(module)
189187
endif()
190188

191-
#-----------------------------------------------------------------------------
192-
# Documentation
193-
#-----------------------------------------------------------------------------
194-
195-
if (BUILD_DOCS)
196-
add_subdirectory(docs)
197-
endif()
198-
199-
#-----------------------------------------------------------------------------
200-
# Manual page
201-
#-----------------------------------------------------------------------------
202-
203-
if (BUILD_MANPAGE)
204-
add_subdirectory(man)
205-
endif()
206-
207189
#-----------------------------------------------------------------------------
208190
# Installation
209191
#-----------------------------------------------------------------------------

Makefile

+13-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,16 @@ lint:
2929
bdd:
3030
cd test/bdd; behave -DREMOVE_TEMPLATE=1
3131

32-
.PHONY: tests mypy pytest lint bdd build clean-build build-db build-api
32+
# Documentation
33+
34+
doc:
35+
mkdocs build
36+
37+
serve-doc:
38+
mkdocs serve
39+
40+
manpage:
41+
argparse-manpage --pyfile man/create-manpage.py --function get_parser --project-name Nominatim --url https://nominatim.org > man/nominatim.1 --author 'the Nominatim developer community' --author-email [email protected]
42+
43+
44+
.PHONY: tests mypy pytest lint bdd build clean-build build-db build-api doc serve-doc manpage

docs/CMakeLists.txt

-35
This file was deleted.

docs/admin/Deployment-Python.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ to configure it.
1919
### Installing the required packages
2020

2121
The Nominatim frontend is best run from its own virtual environment. If
22-
you have already created one for the database backend during
23-
[installation](Installation.md#Building-Nominatim), you can use that. Otherwise
22+
you have already created one for the database backend during the
23+
[installation](Installation.md#building-nominatim), you can use that. Otherwise
2424
create one now with:
2525

2626
```sh

docs/admin/Installation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This page contains generic installation instructions for Nominatim and its
44
prerequisites. There are also step-by-step instructions available for
55
the following operating systems:
66

7-
* [Ubuntu 24.04](../appendix/Install-on-Ubuntu-24.md)
8-
* [Ubuntu 22.04](../appendix/Install-on-Ubuntu-22.md)
7+
* [Ubuntu 24.04](Install-on-Ubuntu-24.md)
8+
* [Ubuntu 22.04](Install-on-Ubuntu-22.md)
99

1010
These OS-specific instructions can also be found in executable form
1111
in the `vagrant/` directory.

docs/bash2md.sh

-7
This file was deleted.

docs/customize/Tokenizers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ NOMINATIM_DATABASE_MODULE_PATH=<path to directory where nominatim.so resides>
5252
```
5353

5454
This is in particular useful when the database runs on a different server.
55-
See [Advanced installations](../admin/Advanced-Installations.md#importing-nominatim-to-an-external-postgresql-database) for details.
55+
See [Advanced installations](../admin/Advanced-Installations.md#using-an-external-postgresql-database) for details.
5656

5757
There are no other configuration options for the legacy tokenizer. All
5858
normalization functions are hard-coded.

docs/develop/Development-Environment.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The documentation is built with mkdocs:
4949
* [mkdocs](https://www.mkdocs.org/) >= 1.1.2
5050
* [mkdocstrings](https://mkdocstrings.github.io/) >= 0.25
5151
* [mkdocs-material](https://squidfunk.github.io/mkdocs-material/)
52+
* [mkdocs-gen-files](https://oprypin.github.io/mkdocs-gen-files/)
5253

5354
Please be aware that tests always run against the globally installed
5455
osm2pgsql, so you need to have this set up. If you want to test against
@@ -66,9 +67,9 @@ To set up the virtual environment with all necessary packages run:
6667
```sh
6768
virtualenv ~/nominatim-dev-venv
6869
~/nominatim-dev-venv/bin/pip install\
69-
psycopg2-binary psutil psycopg[binary] PyICU SQLAlchemy \
70-
python-dotenv jinja2 pyYAML datrie \
71-
behave mkdocs mkdocstrings pytest pytest-asyncio pylint \
70+
psutil psycopg[binary] PyICU SQLAlchemy \
71+
python-dotenv jinja2 pyYAML datrie behave \
72+
mkdocs mkdocstrings mkdocs-gen-files pytest pytest-asyncio pylint \
7273
types-jinja2 types-markupsafe types-psutil types-psycopg2 \
7374
types-pygments types-pyyaml types-requests types-ujson \
7475
types-urllib3 typing-extensions unicorn falcon
@@ -147,18 +148,14 @@ built using the [MkDocs](https://www.mkdocs.org/) static site generation
147148
framework. The master branch is automatically deployed every night on
148149
[https://nominatim.org/release-docs/develop/](https://nominatim.org/release-docs/develop/)
149150

150-
To build the documentation, go to the build directory and run
151+
To build the documentation run
151152

152153
```
153154
make doc
154-
INFO - Cleaning site directory
155-
INFO - Building documentation to directory: /home/vagrant/build/site-html
156155
```
157156

158-
This runs `mkdocs build` plus extra transformation of some files and adds
159-
symlinks (see `CMakeLists.txt` for the exact steps).
160157

161-
Now you can start webserver for local testing
158+
For local testing, you can start webserver:
162159

163160
```
164161
build> make serve-doc
@@ -170,7 +167,7 @@ If you develop inside a Vagrant virtual machine, use a port that is forwarded
170167
to your host:
171168

172169
```
173-
build> PYTHONPATH=$SRCDIR mkdocs serve --dev-addr 0.0.0.0:8088
170+
build> mkdocs serve --dev-addr 0.0.0.0:8088
174171
[server:296] Serving on http://0.0.0.0:8088
175172
[handlers:62] Start watching changes
176173
```

docs/library/Input-Parameter-Types.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ in the query functions of the API object.
55

66
## Place identification
77

8-
The [details](NominatimAPI.md#nominatim_api.core.NominatimAPI.details) and
9-
[lookup](NominatimAPI.md#nominatim_api.core.NominatimAPI.lookup) functions
8+
The [details](NominatimAPI.md#nominatim_api.NominatimAPI.details) and
9+
[lookup](NominatimAPI.md#nominatim_api.NominatimAPI.lookup) functions
1010
require references to places in the database. Below the possible
1111
types for place identification are listed. All types are dataclasses.
1212

docs/mk_install_instructions.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SPDX-License-Identifier: GPL-3.0-or-later
2+
#
3+
# This file is part of Nominatim. (https://nominatim.org)
4+
#
5+
# Copyright (C) 2024 by the Nominatim developer community.
6+
from pathlib import Path
7+
8+
import mkdocs_gen_files
9+
10+
VAGRANT_PATH = Path(__file__, '..', '..', 'vagrant').resolve()
11+
12+
for infile in VAGRANT_PATH.glob('Install-on-*.sh'):
13+
outfile = f"admin/{infile.stem}.md"
14+
title = infile.stem.replace('-', ' ')
15+
16+
with mkdocs_gen_files.open(outfile, "w") as outfd, infile.open() as infd:
17+
print("#", title, file=outfd)
18+
has_empty = False
19+
for line in infd:
20+
line = line.rstrip()
21+
docpos = line.find('#DOCS:')
22+
if docpos >= 0:
23+
line = line[docpos + 6:]
24+
elif line == '#' or line.startswith('#!'):
25+
line = ''
26+
elif line.startswith('# '):
27+
line = line[2:]
28+
if line or not has_empty:
29+
print(line, file=outfd)
30+
has_empty = not bool(line)
31+
32+
mkdocs_gen_files.set_edit_path(outfile, "docs/mk_install_instructions.py")

man/CMakeLists.txt

-15
This file was deleted.

man/create-manpage.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import sys
2+
import os
3+
from pathlib import Path
4+
5+
sys.path.append(str(Path(__file__, '..', '..', 'src').resolve()))
6+
7+
from nominatim_db.cli import get_set_parser
8+
9+
def get_parser():
10+
parser = get_set_parser()
11+
12+
return parser.parser

man/create-manpage.tmpl

-12
This file was deleted.

0 commit comments

Comments
 (0)