Skip to content

Commit

Permalink
feat: Various updates
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb authored Mar 6, 2024
1 parent 36aa58e commit ebfd571
Show file tree
Hide file tree
Showing 43 changed files with 2,991 additions and 2,788 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build/
/node_modules/
/public/
.vscode
1 change: 1 addition & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"comment-empty-line-before": null,
"no-descending-specificity": null,
"rule-empty-line-before": null,
"value-keyword-case": ["lower", { "ignoreKeywords": ["BlinkMacSystemFont", "Roboto", "Helvetica", "Arial"] }]
}
}
83 changes: 83 additions & 0 deletions gulp.d/tasks/generate-octicons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
'use strict'

const octicons = require('@primer/octicons')
const ospath = require('path')
const fs = require('fs')

const icons = [
'alert',
'book',
'chevron-down',
'chevron-left',
'copy',
'flame',
'fold',
'home',
'info',
'law',
'light-bulb',
'moon',
'question',
'rocket',
'search',
'stop',
'sun',
'three-bars',
'unfold',
'x',
]

const pathRegex = /<svg .+?>(.*)<\/svg>/m

const preamble = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 208">
<title>Octicons</title>
<desc>Octicons by GitHub - https://primer.style/octicons/ - License: MIT</desc>
<metadata
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:title>@primer/octicons</dc:title>
<dc:description>A scalable set of icons handcrafted with &lt;3 by GitHub</dc:description>
<dc:format>image/svg+xml</dc:format>
<dc:creator>
<cc:Agent>
<dc:title>GitHub</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Copyright (c) GitHub Inc.</dc:title>
</cc:Agent>
</dc:rights>
<cc:license rdf:resource="https://opensource.org/licenses/MIT" />
<dc:relation>https://primer.style/octicons/</dc:relation>
</cc:Work>
</rdf:RDF>
</metadata>
`

function generateOcticons (cb) {
let result = preamble
let offset = 0
for (const icon of icons) {
const svg = octicons[icon].toSVG({ width: 16, height: 16 })
const path = pathRegex.exec(svg)[1]
result += ` <symbol id="icon-${icon}" viewBox="0 0 16 16">
${path}
</symbol>
<use href="#icon-${icon}" width="16" height="16" x="0" y="${offset}" />
<view id="view-${icon}" viewBox="0 ${offset} 16 16" />
`
offset += 16
}
result += '</svg>'
const filename = ospath.join(__filename, '../../../src/img/octicons-16.svg')
fs.writeFile(filename, result, cb)
cb()
}

module.exports = () => generateOcticons
11 changes: 9 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const lintTask = createTask({
const formatJsTask = createTask({
name: 'format:js',
desc: 'Format the JavaScript source files using prettify (JavaScript Standard Style)',
call: task.format(glob.test),
call: task.format(glob.js),
})

const formatTestJsTask = createTask({
Expand Down Expand Up @@ -130,6 +130,12 @@ const previewTask = createTask({
call: series(previewBuildTask, previewServeTask),
})

const generateOcticons = createTask({
name: 'generateOcticons',
desc: 'Generates an SVG file with the octicons we use',
call: task.generateOcticons(),
})

module.exports = exportTasks(
bundleTask,
cleanTask,
Expand All @@ -140,5 +146,6 @@ module.exports = exportTasks(
bundlePackTask,
previewTask,
previewBuildTask,
packTask
packTask,
generateOcticons
)
20 changes: 14 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"devDependencies": {
"@asciidoctor/core": "~2.2",
"@asciidoctor/tabs": "1.0.0-beta.3",
"@asciidoctor/tabs": "1.0.0-beta.6",
"@docsearch/js": "3",
"@springio/asciidoctor-extensions": "1.0.0-alpha.8",
"algoliasearch": "4",
Expand All @@ -29,9 +29,9 @@
"chai": "~4.3",
"chai-fs": "~2.0",
"chai-spies": "~1.0",
"dirty-chai": "~2.0",
"core-js": "~3.26",
"cssnano": "~5.1",
"dirty-chai": "~2.0",
"eslint": "~6.8",
"eslint-config-standard": "~14.1",
"eslint-plugin-import": "~2.22",
Expand All @@ -52,9 +52,9 @@
"highlight.js": "9.18.3",
"instantsearch.js": "^4.54.1",
"js-yaml": "~4.1",
"mocha": "~10.2",
"merge-stream": "~2.0",
"micromodal": "^0.4.10",
"mocha": "~10.2",
"postcss": "~8.4",
"postcss-calc": "~8.2",
"postcss-custom-properties": "~12.1",
Expand All @@ -68,6 +68,7 @@
"vinyl-fs": "~3.0"
},
"dependencies": {
"@algolia/client-search": "^4.17.0"
"@algolia/client-search": "^4.17.0",
"@primer/octicons": "^19.8.0"
}
}
131 changes: 130 additions & 1 deletion preview-src/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ Don't forget this step!
.Key Points to Remember
[TIP]
====
If you installed the CLI and the default site generator globally, you can upgrade both of them with the same command.
If you installed the CLI and the default `site-generator` globally, you can upgrade both of them with the same command.
$ npm i -g @antora/cli @antora/site-generator-default
====
Expand Down Expand Up @@ -463,6 +463,135 @@ Showing a gear icon: icon:gear[]

====== H6


== Edge cases

There are a few things that can trip our stylesheet up if we're not careful:


=== Title with Code (`withcode`)

Restdocs uses these and they should look nice.

=== Long Tables

A table with long entries and no breakable space.

[cols="1,2", options="header"]
.Issues
|===
|Name
|Description

|VeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpaceVeryLongNameWithoutBreakableSpace
|This is an edge case

|Name
|Another entry
|===

That's the end of that.



=== Another Long Table

When a Spring Boot application starts:

[cols="2,2,2,3,5"]
|===
|Startup phase |LivenessState |ReadinessState |HTTP server |Notes

|Starting
|`BROKEN`
|`REFUSING_TRAFFIC`
|Not started
|Kubernetes checks the "liveness" Probe and restarts the application if it takes too long.

|Started
|`CORRECT`
|`REFUSING_TRAFFIC`
|Refuses requests
|The application context is refreshed. The application performs startup tasks and does not receive traffic yet.

|Ready
|`CORRECT`
|`ACCEPTING_TRAFFIC`
|Accepts requests
|Startup tasks are finished. The application is receiving traffic.
|===

When a Spring Boot application shuts down:

[cols="2,2,2,3,5"]
|===
|Shutdown phase |Liveness State |Readiness State |HTTP server |Notes

|Running
|`CORRECT`
|`ACCEPTING_TRAFFIC`
|Accepts requests
|Shutdown has been requested.

|Graceful shutdown
|`CORRECT`
|`REFUSING_TRAFFIC`
|New requests are rejected
|If enabled, <<spring-boot-features#boot-features-graceful-shutdown,graceful shutdown processes in-flight requests>>.

|Shutdown complete
|N/A
|N/A
|Server is shut down
|The application context is closed and the application is shut down.
|===

TIP: Check out the Kubernetes container lifecycle section for more information about Kubernetes deployment.



=== Long Shell Blocks

A shell code block can also break things:

[indent=0,subs="attributes"]
----
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: v{spring-boot-version}
2019-04-31 13:09:54.117 INFO 56603 --- [ main] o.s.b.s.app.SampleApplication : Starting SampleApplication v0.1.0 on mycomputer with PID 56603 (/apps/myapp.jar started by pwebb)
2019-04-31 13:09:54.166 INFO 56603 --- [ main] ationConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6e5a8246: startup date [Wed Jul 31 00:08:16 PDT 2013]; root of context hierarchy
2019-04-01 13:09:56.912 INFO 41370 --- [ main] .t.TomcatServletWebServerFactory : Server initialized with port: 8080
2019-04-01 13:09:57.501 INFO 41370 --- [ main] o.s.b.s.app.SampleApplication : Started SampleApplication in 2.992 seconds (JVM running for 3.658)
----


=== Code With `nowrap`

Have some HTTP that also has `nowrap` set:

[source,http,options="nowrap"]
----
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 121
{
"events" : [ {
"timestamp" : "2021-03-18T16:49:30.625Z",
"principal" : "alice",
"type" : "logout"
} ]
}
----




== Fin

That's all, folks!
Loading

0 comments on commit ebfd571

Please sign in to comment.