Skip to content

Commit

Permalink
Merge branch '1.2-dev' into 1666-make-examples-minimal
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jul 10, 2024
2 parents 9dc2161 + be1e15b commit a3d0ec6
Show file tree
Hide file tree
Showing 41 changed files with 9,229 additions and 3,144 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm install standard [email protected]
- run: npx standard docs/_static/script.js
- uses: biomejs/setup-biome@v2
- run: biome ci --indent-style=space --line-width=119 docs/_static/script.js
7 changes: 3 additions & 4 deletions .github/workflows/shell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: |
- run: |
sudo apt update
sudo apt install shellcheck
- run: sudo snap install shfmt
sudo apt install devscripts shellcheck shfmt
- run: checkbashisms $(shfmt -f .)
- run: shellcheck $(shfmt -f .)
- run: shfmt -d -i 4 -sr $(shfmt -f .)
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
with:
python-version: '3.10'
- run: pip install codespell
- run: codespell -S .git,docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv -L fo,zar .
- run: codespell -S .git,docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv -L fo,sme,zar,SME .
12 changes: 6 additions & 6 deletions common-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ exceptiongroup==1.0.0
# pytest
h11==0.13.0
# via wsproto
idna==2.10
idna==3.7
# via
# requests
# trio
imagesize==1.4.1
# via sphinx
iniconfig==1.1.1
# via pytest
jinja2==3.1.3
jinja2==3.1.4
# via
# myst-parser
# sphinx
Expand Down Expand Up @@ -123,7 +123,7 @@ pytz==2021.1
# via babel
pyyaml==6.0.1
# via myst-parser
requests==2.31.0
requests==2.32.2
# via
# elasticsearch
# ocdsextensionregistry
Expand All @@ -133,7 +133,7 @@ requests-cache==1.1.0
# via ocdsextensionregistry
selenium==4.11.2
# via -r common-requirements.in
six==1.15.0
six==1.16.0
# via
# livereload
# url-normalize
Expand All @@ -151,7 +151,7 @@ sphinx==5.3.0
# sphinx-intl
sphinx-autobuild==2021.3.14
# via -r common-requirements.in
sphinx-intl==2.1.0
sphinx-intl==2.2.0
# via -r common-requirements.in
sphinxcontrib-applehelp==1.0.2
# via sphinx
Expand All @@ -171,7 +171,7 @@ tomli==2.0.1
# pip-tools
# pyproject-hooks
# pytest
tornado==6.3.3
tornado==6.4.1
# via livereload
trio==0.20.0
# via
Expand Down
Binary file removed docs/_static/png/framework_agreement/model.png
Binary file not shown.
138 changes: 72 additions & 66 deletions docs/_static/script.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
/* global XMLHttpRequest, location, renderjson */

const pathComponents = window.location.pathname.split('/')
if (pathComponents[pathComponents.length - 2] === 'codelists') {
document.querySelector('.wy-nav-content').style.maxWidth = 'none'
const pathComponents = window.location.pathname.split("/");
if (pathComponents[pathComponents.length - 2] === "codelists") {
document.querySelector(".wy-nav-content").style.maxWidth = "none";
}

// FYI: extensionlist appears many times on /schema/reference/
if (document.querySelector('.extension_list')) {
const language = location.pathname.split('/')[2]
if (document.querySelector(".extension_list")) {
const language = location.pathname.split("/")[2];

// Append an empty list for community extensions.
document.querySelectorAll('.extension_list .hide').forEach(element => {
const dl = document.createElement('dl')
dl.className = 'simple community-list hide'
element.insertAdjacentElement('afterend', dl)
element.innerHTML = `<small>${element.innerHTML}</small>`
})
for (const element of document.querySelectorAll(".extension_list .hide")) {
const dl = document.createElement("dl");
dl.className = "simple community-list hide";
element.insertAdjacentElement("afterend", dl);
element.innerHTML = `<small>${element.innerHTML}</small>`;
}

// Get the community extensions to add to the documentation.
const request = new XMLHttpRequest()
request.open('GET', 'https://raw.githubusercontent.com/open-contracting/extension_registry/main/build/extensions.json')
request.responseType = 'json'
const request = new XMLHttpRequest();
request.open(
"GET",
"https://raw.githubusercontent.com/open-contracting/extension_registry/main/build/extensions.json",
);
request.responseType = "json";

request.onload = () => {
if (request.status >= 200 && request.status < 400) {
// Add community extensions.
request.response.extensions.forEach(extension => {
for (const extension of request.response.extensions) {
if (!extension.core) {
const div = document.getElementById(`extensionlist-${extension.category}`)
const div = document.getElementById(`extensionlist-${extension.category}`);
if (div) {
div.querySelector('.community-list').insertAdjacentHTML('beforeend', `
div.querySelector(".community-list").insertAdjacentHTML(
"beforeend",
`
<dt>
<a class="reference external" href="${extension.documentation_url}">
${extension.name[language] || extension.name.en}
Expand All @@ -38,79 +43,80 @@ if (document.querySelector('.extension_list')) {
<dd>
${extension.description[language] || extension.description.en}
</dd>
`)
div.querySelectorAll('.hide').forEach(element => {
element.classList.remove('hide')
})
`,
);
for (const element of div.querySelectorAll(".hide")) {
element.classList.remove("hide");
}
}
}
})
}

// Remove empty extension lists.
document.querySelectorAll('.extension_list').forEach(element => {
if (!element.querySelector('a')) {
element.remove()
for (const element of document.querySelectorAll(".extension_list")) {
if (!element.querySelector("a")) {
element.remove();
}
})
}
}
}
};

request.send()
request.send();
}

document.querySelectorAll('.expandjson').forEach(element => {
const defaultOpen = []
let fileClassName
element.classList.forEach(className => {
if (className.substring(0, 7) === 'expand-' && className.length > 7) {
defaultOpen.push(className.substring(7))
for (const element of document.querySelectorAll(".expandjson")) {
const defaultOpen = [];
let fileClassName;
for (const className of element.classList) {
if (className.substring(0, 7) === "expand-" && className.length > 7) {
defaultOpen.push(className.substring(7));
}
if (className.substring(0, 5) === 'file-') {
fileClassName = className
if (className.substring(0, 5) === "file-") {
fileClassName = className;
}
})
}

let data = JSON.parse(element.textContent)
let data = JSON.parse(element.textContent);
// If the jsoninclude directive indexed to a JSON array (a common mistake), only display the first entry.
if (data.length) {
data = data[0]
data = data[0];
}

const replacement = renderjson.set_show_to_level(1).set_max_string_length(100).set_default_open(defaultOpen)(data)
const replacement = renderjson.set_show_to_level(1).set_max_string_length(100).set_default_open(defaultOpen)(data);
// element.firstElementChild.replaceWith(replacement) // https://caniuse.com/mdn-api_parentnode_firstelementchild
element.replaceChild(replacement, element.querySelector('.highlight-json'))
element.replaceChild(replacement, element.querySelector(".highlight-json"));

const container = element.previousElementSibling
let select
if (container && container.classList.contains('selection-container')) {
const container = element.previousElementSibling;
let select;
if (container?.classList.contains("selection-container")) {
// Hide additional examples.
element.style.display = 'none'
container.appendChild(element)
element.style.display = "none";
container.appendChild(element);

// Display the select element if there are multiple options.
select = container.querySelector('select')
select.style.display = ''
select = container.querySelector("select");
select.style.display = "";
} else {
const div = document.createElement('div')
element.insertAdjacentElement('beforebegin', div)
div.className = 'selection-container'
div.appendChild(element)
const div = document.createElement("div");
element.insertAdjacentElement("beforebegin", div);
div.className = "selection-container";
div.appendChild(element);

select = document.createElement('select')
div.insertAdjacentElement('afterbegin', select)
select = document.createElement("select");
div.insertAdjacentElement("afterbegin", select);

// Hide the select element if there is one option.
select.style.display = 'none'
select.addEventListener('change', () => {
div.querySelectorAll('.expandjson').forEach(child => {
child.style.display = 'none'
})
div.querySelector(`.${select.value}`).style.display = ''
})
select.style.display = "none";
select.addEventListener("change", () => {
for (const child of div.querySelectorAll(".expandjson")) {
child.style.display = "none";
}
div.querySelector(`.${select.value}`).style.display = "";
});
}

const option = document.createElement('option')
option.value = fileClassName
option.textContent = fileClassName.replace('file-', '')
select.appendChild(option)
})
const option = document.createElement("option");
option.value = fileClassName;
option.textContent = fileClassName.replace("file-", "");
select.appendChild(option);
}
1 change: 1 addition & 0 deletions docs/_static/svg/framework_agreement_diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
'license_url': f'{repository_url}/blob/HEAD/LICENSE',
'repository_url': repository_url,
}
html_short_title = f'{html_theme_options["short_project"]} v{release}'

# List the extension identifiers and versions that should be part of this specification. The extensions must be in
# the extension registry: https://github.com/open-contracting/extension_registry/blob/main/extension_versions.csv
Expand Down
14 changes: 0 additions & 14 deletions docs/examples/pre-qualification/multi-stage.csv

This file was deleted.

61 changes: 61 additions & 0 deletions docs/examples/release_schema_reference/release_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,47 @@
"projectID": "SP001",
"uri": "https://openspending.org/uk-barnet-budget/entries/6801ad388f3a38b7740dde20108c58b35984ee91"
},
"project": {
"id": "oc4ids-bu3kcz-0000",
"title": "Central Junction Cycle Lane Construction",
"description": "Design, construction and supervision of a new cycle lane for the Central Junction.",
"totalValue": {
"amount": 1100000,
"currency": "GBP"
},
"uri": "http://example.com/projects/oc4ids-bu3kcz-0000.json",
"sector": {
"id": "transport.road",
"description": "Road transport, including roads, highways, streets, tunnels and bridges.",
"scheme": "oc4idsProjectSector"
},
"additionalClassifications": [
{
"id": "03.04.05",
"description": "Cycle lanes for road transport.",
"scheme": "GB-EXAMPLE"
}
],
"locations": [
{
"description": "Barnet, London, UK",
"geometry": {
"type": "Point",
"coordinates": [
51.605,
0.2076
]
},
"gazetteer": {
"scheme": "GEONAMES",
"identifier": [
"2656295"
]
},
"uri": "https://www.geonames.org/2656295/barnet.html"
}
]
},
"documents": [
{
"datePublished": "2009-01-05T00:00:00Z",
Expand Down Expand Up @@ -155,6 +196,26 @@
"currency": "GBP"
}
}
},
{
"id": "0002",
"description": "Paint for road markings",
"classification": {
"scheme": "CPV",
"id": "44811000",
"description": "Road paint",
"uri": "http://cpv.data.ac.uk/code-44811000"
},
"immediateContainer": {
"name": "Can/Tin",
"capacity": {
"unit": {
"scheme": "UNCEFACT",
"id": "GLI"
},
"value": "[100,100]"
}
}
}
],
"value": {
Expand Down
2 changes: 1 addition & 1 deletion docs/guidance/build/hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ In either case:
* Use `limit=NUMBER`, to limit the number of results returned on each page.
* Include the total number of results across all pages.

In addition to performance reasons, the seek method is preferred to the offset method when results are ordered in reverse chronology, because:
In addition to performance reasons, the seek method is preferred to the offset method when results are ordered in reverse chronology, because, with the offset method:

* A given page won't return the same results over time. `page=1` will return different results today, next week, and next year.
* Users can receive duplicate results while paginating. For example, if a new release is published to page 1 while users are paginating, then the result at the bottom of each page will be moved to the top of the following page.
Expand Down
2 changes: 1 addition & 1 deletion docs/guidance/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The four phases of implementation described in this guide have helped implemente

Read the guidance to understand the main steps to implement OCDS and to find supporting resources. Detailed guidance on specific topics and tasks is provided in sub-pages.

Use the [OCDS Implementation Checklist](https://www.open-contracting.org/resources/ocds-implementation-checklist) to keep track of your progress.
Use the [OCDS Implementation Checklist](https://www.open-contracting.org/resources/ocds-implementation-checklist/) to keep track of your progress.

```{toctree}
:maxdepth: 2
Expand Down
Loading

0 comments on commit a3d0ec6

Please sign in to comment.