Skip to content

Commit faf3581

Browse files
joerickhenryiii
authored andcommitted
Add option tag labels to each header
1 parent a882d28 commit faf3581

File tree

2 files changed

+89
-9
lines changed

2 files changed

+89
-9
lines changed

docs/extra.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ h1, h2, h3, h4, h5, h6 {
4747
padding-bottom: 0.2em;
4848
}
4949

50+
.wy-nav-content {
51+
max-width: 900px;
52+
}
53+
5054
.rst-content blockquote {
5155
margin-bottom: 14px;
5256
}

docs/options.md

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Build selection
66

7-
### `CIBW_PLATFORM` {: #platform}
7+
### `platform` {: #platform cmd-line env-var }
88

99
> Override the auto-detected target platform
1010
@@ -38,7 +38,7 @@ This option can also be set using the [command-line option](#command-line) `--pl
3838
not require `--platform` or `--arch`, and will override any build/skip
3939
configuration.
4040

41-
### `CIBW_BUILD`, `CIBW_SKIP` {: #build-skip}
41+
### `build` & `skip` {: #build-skip toml="build, skip" env-var="CIBW_BUILD, CIBW_SKIP" }
4242

4343
> Choose the Python versions to build
4444
@@ -169,7 +169,7 @@ See the [cibuildwheel 2 documentation](https://cibuildwheel.pypa.io/en/2.x/) for
169169
</style>
170170

171171

172-
### `CIBW_ARCHS` {: #archs}
172+
### `archs` {: #archs cmd-line env-var toml }
173173
> Change the architectures built on your machine by default.
174174
175175
A list of architectures to build.
@@ -1702,8 +1702,48 @@ Some options support placeholders, like `{project}`, `{package}` or `{wheel}`, t
17021702
.options-toc a.option code {
17031703
font-size: 80%;
17041704
}
1705-
h3 code {
1706-
font-size: 100%;
1705+
.rst-content h3 code {
1706+
font-size: 115%;
1707+
}
1708+
.rst-content h3 code.cmd-line, .rst-content h3 code.toml, .rst-content h3 code.env-var {
1709+
font-size: 80%;
1710+
float: right;
1711+
margin-left: 8px;
1712+
display: inline-flex;
1713+
flex-direction: column;
1714+
justify-content: left;
1715+
padding-left: 10px;
1716+
padding-right: 10px;
1717+
line-height: normal;
1718+
}
1719+
.rst-content h3 code.cmd-line:before, .rst-content h3 code.toml:before, .rst-content h3 code.env-var:before {
1720+
content: ' ';
1721+
font-size: 10px;
1722+
font-weight: bold;
1723+
opacity: 0.3;
1724+
display: inline-block;
1725+
border-radius: 5px;
1726+
margin-left: -3px;
1727+
margin-right: -3px;
1728+
margin-bottom: -1px;
1729+
}
1730+
.rst-content h3 code.cmd-line:before {
1731+
content: 'command line';
1732+
}
1733+
.rst-content h3 code.cmd-line {
1734+
background: rgba(224, 202, 56, 0.3);
1735+
}
1736+
.rst-content h3 code.toml:before {
1737+
content: 'pyproject.toml';
1738+
}
1739+
.rst-content h3 code.toml {
1740+
background: rgba(41, 128, 185, 0.3);
1741+
}
1742+
.rst-content h3 code.env-var:before {
1743+
content: 'env var';
1744+
}
1745+
.rst-content h3 code.env-var {
1746+
background: rgba(61, 153, 112, 0.3);
17071747
}
17081748
</style>
17091749

@@ -1714,9 +1754,6 @@ Some options support placeholders, like `{project}`, `{package}` or `{wheel}`, t
17141754
var headers = []
17151755

17161756
$('.rst-content h3')
1717-
.filter(function (i, el) {
1718-
return !!$(el).text().match(/(^([A-Z0-9, _*]| and )+$/);
1719-
})
17201757
.each(function (i, el) {
17211758
var optionName = $(el).text().replace('', '');
17221759
var description = $(el).next('blockquote').text()
@@ -1795,7 +1832,46 @@ Some options support placeholders, like `{project}`, `{package}` or `{wheel}`, t
17951832
markdown += '|\n'
17961833
}
17971834
}
1798-
17991835
console.log('readme options markdown\n', markdown)
1836+
1837+
// add the option tags to each heading
1838+
$('.rst-content h3')
1839+
.each(function (i, el) {
1840+
el.classList.add('option', 'clearfix');
1841+
var optionName = $(el).text().replace('', '');
1842+
1843+
// some options are specified as their env var names
1844+
if (optionName.startsWith('CIBW_')) {
1845+
optionName = optionName.replace('CIBW_', '');
1846+
optionName = optionName.replace(/_/g, '-');
1847+
optionName = optionName.toLowerCase();
1848+
}
1849+
1850+
var cmdLine = el.getAttribute('cmd-line');
1851+
var envVar = el.getAttribute('env-var');
1852+
var toml = el.getAttribute('toml');
1853+
1854+
// fill default value
1855+
if (cmdLine == "cmd-line") {
1856+
cmdLine = '--'+optionName;
1857+
}
1858+
if (envVar == "env-var") {
1859+
envVar = 'CIBW_'+optionName.toUpperCase().replace(/-/g, '_');
1860+
}
1861+
if (toml == "toml") {
1862+
toml = optionName
1863+
}
1864+
1865+
if (envVar) {
1866+
$(el).append(' <code class="env-var" title="Environment variable">'+envVar+'</code>');
1867+
}
1868+
if (toml) {
1869+
$(el).append(' <code class="toml" title="TOML option key">'+toml+'</code>');
1870+
}
1871+
if (cmdLine) {
1872+
$(el).append(' <code class="cmd-line" title="Command line argument">'+cmdLine+'</code>');
1873+
}
1874+
});
18001875
});
1876+
18011877
</script>

0 commit comments

Comments
 (0)