Skip to content

Commit

Permalink
Merge pull request #594 from conjure-cp/docbits
Browse files Browse the repository at this point in the history
Adding the "bits" in the documentation to sphinx
  • Loading branch information
ozgurakgun committed Oct 24, 2023
2 parents f6adf91 + e0aeb58 commit e1e1625
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ docs/_build
docs/BNFLexer.pyc
docs/EssenceLexer.pyc
docs/__pycache__
docs/myenv

# to be used during development
conjure-output
Expand Down
25 changes: 25 additions & 0 deletions docs/bits.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

.. _bits:

Bits
====

These *bits* of documentation are used in the Visual Studio Code extension for Conjure.
Search for `conjure-vs-code` inside VS Code to install this extension.
The extension is open source as well, and it is hosted at https://github.com/conjure-cp/conjure-vs-code.

We include them here for reference and convenience, but this part of the documentation is intended to be useful primarily through the VS Code extension.

.. toctree::

bits/attribute/L_regular.md
bits/function/min.md
bits/function/and.md
bits/function/max.md
bits/function/allDiff.md
bits/keyword/find.md
bits/keyword/expr_projection.md
bits/keyword/new_type_enum.md
bits/operator/L_Div.md
bits/operator/L_in.md
bits/operator/L_Mod.md
4 changes: 3 additions & 1 deletion docs/bits/attribute/L_regular.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## `regular` : partition attribute
# regular

Regular is an attribute for partitions that takes no arguments.

It enforces that the sizes of the parts are equal.
3 changes: 2 additions & 1 deletion docs/bits/function/allDiff.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AllDifferent
# allDiff

```essence
allDiff(_)
```
Expand Down
2 changes: 2 additions & 0 deletions docs/bits/function/and.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# and

Conjunction (logical and) operator.

Can be applied on a list of Booleans and produces a single Boolean as the result.
3 changes: 2 additions & 1 deletion docs/bits/function/max.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Max
# max

```essence
max(expr) $or
max(`domain`)
Expand Down
3 changes: 2 additions & 1 deletion docs/bits/function/min.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Min
# min

```essence
min(expr) $or
min(`domain`)
Expand Down
3 changes: 2 additions & 1 deletion docs/bits/keyword/expr_projection.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Expression Projection `<-`
# <- (expression projection)

The expression projection syntax is used in comprehensions to create a generator from a container data type.
The left side can either be a single variable which
will have the type of a member of the expression or an abstract pattern used to destructure the member type.
Expand Down
2 changes: 1 addition & 1 deletion docs/bits/keyword/find.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Find
# find

The `find` keyword is used to declare decision variables.
3 changes: 2 additions & 1 deletion docs/bits/keyword/new_type_enum.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Enum Domains
# new type enum

Enumerated types can be declared in two ways: using a given-enum syntax or using a letting-enum syntax.

The given-enum syntax defers the specification of actual values of the enumerated type until instantiation. With this syntax, an enumerated type can be declared by only giving its name in the problem specification file. In a parameter file, values for the actual members of this type can be given. This allows Conjure to produce a model independent of the values of the enumerated type and only substitute the actual values during parameter instantiation.
Expand Down
1 change: 1 addition & 0 deletions docs/bits/operator/L_Div.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# / (integer division)

This is the integer division operator.

Expand Down
3 changes: 2 additions & 1 deletion docs/bits/operator/L_Mod.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**Mod operator**
# % (modulo)

```
%
```
Expand Down
3 changes: 2 additions & 1 deletion docs/bits/operator/L_in.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Operator in
# in (membership check)

```essence
in
```
Expand Down
8 changes: 6 additions & 2 deletions docs/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
python3 -m pip install -r requirements.txt
python3 -m sphinx . _build
rm -rf myenv
python3 -m venv myenv
source myenv/bin/activate
pip install -r requirements.txt
make html
deactivate
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
'sphinx.ext.todo',
'sphinxcontrib.bibtex',
'sphinxcontrib.jquery',
'nbsphinx'
'nbsphinx',
'sphinx_mdinclude'
]
bibtex_bibfiles = ['refs.bib']

Expand All @@ -43,8 +44,7 @@

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ['.rst', '.md']

# The encoding of source files.
#source_encoding = 'utf-8-sig'
Expand Down Expand Up @@ -92,7 +92,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ['_build', 'myenv']

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down
2 changes: 1 addition & 1 deletion docs/contact.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Contact
=======

Conjure's main developer is `Özgür Akgün <http://ozgur.host.cs.st-andrews.ac.uk>`_.
Conjure's main developer is `Özgür Akgün <ozgurakgun.github.io>`_.
Please get in touch via `email <ozgur.akgun@st-andrews.ac.uk>`_ if you have comments, suggestions, or if you encounter any problems.

You can also use the `issue tracker <https://github.com/conjure-cp/conjure/issues>`_ to report bugs.
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Conjure: The Automated Constraint Modelling Tool
essence
tutorials
tutorials-notebook
bits
zreferences
contact

Expand Down
8 changes: 5 additions & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
nbsphinx==0.9.3
sphinx-mdinclude==0.5.3
sphinx==7.2.6
sphinx_rtd_theme==1.3.0
sphinxcontrib-bibtex==2.5.0
sphinxcontrib-inlinesyntaxhighlight==0.2
sphinx_rtd_theme==1.2.0
sphinx==6.1.3
nbsphinx==0.9.1
sphinxcontrib-jquery==4.1

0 comments on commit e1e1625

Please sign in to comment.