orga-build 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__tests__/build.test.js +6 -0
- package/lib/app.jsx +11 -1
- package/lib/orga.d.ts.map +1 -1
- package/lib/orga.js +1 -4
- package/package.json +1 -1
|
@@ -40,6 +40,8 @@ This is a test page.
|
|
|
40
40
|
Here's [[file:./docs/index.org][index page]].
|
|
41
41
|
|
|
42
42
|
Here's [[file:more.org][another page]].
|
|
43
|
+
|
|
44
|
+
Here's [[mailto:hi@unclex.net][send me an email]].
|
|
43
45
|
`
|
|
44
46
|
)
|
|
45
47
|
await fs.writeFile(
|
|
@@ -85,6 +87,10 @@ Here's [[file:more.org][another page]].
|
|
|
85
87
|
'should rewrite docs/index.org to /docs'
|
|
86
88
|
)
|
|
87
89
|
assert.ok(html.includes('href="/more"'), 'should rewrite more.org to /more')
|
|
90
|
+
assert.ok(
|
|
91
|
+
html.includes('href="mailto:hi@unclex.net"'),
|
|
92
|
+
'should keep mailto protocol in href'
|
|
93
|
+
)
|
|
88
94
|
})
|
|
89
95
|
|
|
90
96
|
test('generates assets directory', async () => {
|
package/lib/app.jsx
CHANGED
|
@@ -3,6 +3,13 @@ import * as components from '/@orga-build/components'
|
|
|
3
3
|
import layouts from '/@orga-build/layouts'
|
|
4
4
|
import pages from '/@orga-build/pages'
|
|
5
5
|
|
|
6
|
+
function SmartLink({ href, ...props }) {
|
|
7
|
+
if (!href || /^([a-z][a-z\d+\-.]*:|\/\/)/i.test(href)) {
|
|
8
|
+
return <a href={href} {...props} />
|
|
9
|
+
}
|
|
10
|
+
return <Link href={href} {...props} />
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
export function App() {
|
|
7
14
|
const _pages = Object.entries(pages).map(([path, page]) => {
|
|
8
15
|
return {
|
|
@@ -16,7 +23,10 @@ export function App() {
|
|
|
16
23
|
.filter((key) => path.startsWith(key))
|
|
17
24
|
.sort((a, b) => -a.localeCompare(b))
|
|
18
25
|
let element = (
|
|
19
|
-
<page.default
|
|
26
|
+
<page.default
|
|
27
|
+
key={path}
|
|
28
|
+
components={{ ...components, Link, a: SmartLink }}
|
|
29
|
+
/>
|
|
20
30
|
)
|
|
21
31
|
for (const layoutId of layoutIds) {
|
|
22
32
|
const Layout = layouts[layoutId]
|
package/lib/orga.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orga.d.ts","sourceRoot":"","sources":["orga.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,mEAJG;IAAiC,cAAc,EAAvC,MAAM,GAAC,MAAM,EAAE;IACC,IAAI,EAApB,MAAM;IACoC,aAAa;CACjE,
|
|
1
|
+
{"version":3,"file":"orga.d.ts","sourceRoot":"","sources":["orga.js"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,mEAJG;IAAiC,cAAc,EAAvC,MAAM,GAAC,MAAM,EAAE;IACC,IAAI,EAApB,MAAM;IACoC,aAAa;CACjE,mCAUA"}
|
package/lib/orga.js
CHANGED