Skip to content

Commit 1f9a302

Browse files
committed
fixup! wip: switch docs to shayu
1 parent 1b30473 commit 1f9a302

File tree

8 files changed

+183
-133
lines changed

8 files changed

+183
-133
lines changed

docs/assets/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ kbd {
402402
}
403403
}
404404

405-
// Footnotes from pulldown-cmark
405+
/* Footnotes from pulldown-cmark */
406406
.footnote-definition {
407407
display: flex;
408408
font-size: 0.95em;

docs/components/blocks.jsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const React = require('react');
2+
3+
function DocSection({ children }) {
4+
return (
5+
<div className="documentation-entry">
6+
{children}
7+
</div>
8+
);
9+
}
10+
11+
function Option({ children }) {
12+
return (
13+
<div className="config-option">
14+
{children}
15+
</div>
16+
);
17+
}
18+
19+
module.exports = {
20+
DocSection,
21+
Option,
22+
}

docs/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ const shayu = require('shayu');
44

55
const config = {
66
basePath: __dirname, // easy way to get the path where this index.js is in, all directories will be based from here
7+
defaultMeta: {
8+
title: 'selfoss',
9+
description: 'Open source web based RSS reader and multi-source mashup aggregator.',
10+
baseUrl: 'https://selfoss.aditu.de',
11+
author: 'Tobias Zeising',
12+
authorAddress: '[email protected]',
13+
currentVersion: '2.19-SNAPSHOT',
14+
15+
layout: './default',
16+
},
717
assets: {
818
postcssModules: [
919
require('postcss-import')(),

docs/layouts/default.jsx

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const React = require('react');
4+
const { getUrl } = require('../helpers/url');
45

56
function Layout({
67
title,
@@ -14,49 +15,49 @@ function Layout({
1415
return (
1516
<html lang="en">
1617
<head>
17-
<title>{title ?? config.title}</title>
18+
<title>{title ?? meta.title}</title>
1819

19-
<meta charset="utf-8">
20-
<meta name="copyright" content={config.extra.author}>
21-
<meta name="keywords" content="selfoss rss reader webbased mashup aggregator tobias zeising aditu">
22-
<meta name="description" content="selfoss the web based open source rss reader and multi source mashup aggregator">
23-
<meta name="robots" content="all">
20+
<meta charSet="utf-8" />
21+
<meta name="copyright" content={meta.author} />
22+
<meta name="keywords" content="selfoss rss reader webbased mashup aggregator tobias zeising aditu" />
23+
<meta name="description" content="selfoss the web based open source rss reader and multi source mashup aggregator" />
24+
<meta name="robots" content="all" />
2425

25-
<link rel="alternate" type="application/atom+xml" title="RSS Feed" href="https://github.com/fossar/selfoss/releases.atom">
26+
<link rel="alternate" type="application/atom+xml" title="RSS Feed" href="https://github.com/fossar/selfoss/releases.atom" />
2627

27-
<link rel="shortcut icon" href={get_url('favicon.ico')} type="image/x-icon">
28+
<link rel="shortcut icon" href={getUrl('favicon.ico')} type="image/x-icon" />
2829

29-
<link rel="stylesheet" type="text/css" media="screen" href={get_url('style.css')}>
30-
<link rel="stylesheet" type="text/css" media="screen" href={get_url('javascript/jquery.fancybox.min.css')}>
30+
<link rel="stylesheet" type="text/css" media="screen" href={getUrl('style.css')} />
31+
<link rel="stylesheet" type="text/css" media="screen" href={getUrl('javascript/jquery.fancybox.min.css')} />
3132
</head>
32-
<body class={current_path == '/' ? 'homepage' : ''}>
33+
<body className={meta.url == '/' ? 'homepage' : ''}>
3334

34-
<!-- header -->
35-
<div id="header" class={current_path === '/' ? 'header-homepage' : ''}>
35+
{/* header */}
36+
<div id="header" className={meta.url === '/' ? 'header-homepage' : ''}>
3637
<h1 id="header-name"><a href="/"><span>selfoss</span></a></h1>
3738

3839
<ul id="header-navigation">
39-
<li><a href={get_url('@/_index.md#screenshots')}>screenshots</a></li>
40-
<li><a href={get_url('@/_index.md#documentation')}>documentation</a></li>
41-
<li><a href={get_url('@/docs/project/credits.md')}>about</a></li>
40+
<li><a href={getUrl('@/_index.md#screenshots')}>screenshots</a></li>
41+
<li><a href={getUrl('@/_index.md#documentation')}>documentation</a></li>
42+
<li><a href={getUrl('@/docs/project/credits.md')}>about</a></li>
4243
<li><a href="/forum">forum</a></li>
43-
<li><a href={`https://github.com/fossar/selfoss/releases/download/${config.extra.current_version}/selfoss-${config.extra.current_version}.zip`}>download</a></li>
44+
<li><a href={`https://github.com/fossar/selfoss/releases/download/${meta.currentVersion}/selfoss-${meta.currentVersion}.zip`}>download</a></li>
4445
</ul>
4546

4647
<a id="header-fork" href="https://github.com/fossar/selfoss"></a>
4748
</div>
4849

4950
{postHeader}
5051

51-
<!-- Documentations -->
52-
<div class="wrapper-bright">
53-
{current_path !== '/' && (
52+
{/* Documentations */}
53+
<div className="wrapper-bright">
54+
{meta.url !== '/' && (
5455
<aside>
5556
{side}
5657
</aside>
5758
)}
5859

59-
<div class="main">
60+
<div className="main">
6061
{mdxContent}
6162
</div>
6263
</div>
@@ -73,28 +74,32 @@ function Layout({
7374
logo by <a href="http://blackbooze.com/">Artcore</a>
7475
</p>
7576
<p>
76-
&copy; by {config.extra.author} &sdot; <a href={`mailto:${config.extra.author_address}`}>{config.extra.author_address}</a> &sdot; <a href="https://www.aditu.de">www.aditu.de</a>
77+
&copy; by {meta.author} &sdot; <a href={`mailto:${meta.author_address}`}>{meta.author_address}</a> &sdot; <a href="https://www.aditu.de">www.aditu.de</a>
7778
</p>
7879
</div>
7980

8081
{scripts}
81-
<script type="text/javascript" src={get_url('javascript/jquery-3.2.1.min.js')}></script>
82-
<script type="text/javascript" src={get_url('javascript/jquery.fancybox.min.js')}></script>
83-
<script type="text/javascript" src={get_url('javascript/base.js')}></script>
82+
<script type="text/javascript" src={getUrl('javascript/jquery-3.2.1.min.js')}></script>
83+
<script type="text/javascript" src={getUrl('javascript/jquery.fancybox.min.js')}></script>
84+
<script type="text/javascript" src={getUrl('javascript/base.js')}></script>
8485

8586

8687
{/* Piwik */}
8788
<script type="text/javascript">
89+
{`
8890
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik.aditu.de/" : "http://piwik.aditu.de/");
8991
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
92+
`}
9093
</script><script type="text/javascript">
94+
{`
9195
try {
9296
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 7);
9397
piwikTracker.trackPageView();
9498
piwikTracker.enableLinkTracking();
9599
} catch( err ) {}
96-
</script><noscript><p><img src="http://piwik.aditu.de/piwik.php?idsite=7" style="border:0" alt=""></p></noscript>
97-
<!-- End Piwik Tracking Code -->
100+
`}
101+
</script><noscript><p><img src="http://piwik.aditu.de/piwik.php?idsite=7" style={{border: 0}} alt="" /></p></noscript>
102+
{/* End Piwik Tracking Code */}
98103
</body>
99104
</html>
100105
);

docs/layouts/index.jsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
const React = require('react');
44
const Layout = require('./default.jsx');
5+
const { getUrl } = require('../helpers/url');
56

67
function IndexLayout({ mdxContent, meta, section, pageContext }) {
78
const postHeader = (
89
<React.Fragment>
9-
<div class="wrapper-light">
10+
<div className="wrapper-light">
1011
<div id="header-logo"></div>
1112

1213
<div id="header-just-updated"></div>
@@ -16,7 +17,7 @@ function IndexLayout({ mdxContent, meta, section, pageContext }) {
1617
<a id="header-donate" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=LR67F3T9DMSC8"><span>donate</span></a>
1718

1819
<div id="header-appstores">
19-
<a href="https://f-droid.org/packages/apps.amine.bou.readerforselfoss"><img alt="Android app on F-Droid" src="{{ get_url(path='images/f-droid.svg') }}" width="141" height="42"></a>
20+
<a href="https://f-droid.org/packages/apps.amine.bou.readerforselfoss"><img alt="Android app on F-Droid" src={getUrl('images/f-droid.svg')} width="141" height="42"></a>
2021
</div>
2122

2223
<div id="header-donate-tooltipp"><span>selfoss is completely free!<br>But if you like selfoss then feel free to donate the programmer a beer</span></div>
@@ -44,14 +45,14 @@ function IndexLayout({ mdxContent, meta, section, pageContext }) {
4445
</div>
4546

4647
{/* Screenshots */}
47-
<div class="wrapper-dark">
48+
<div className="wrapper-dark">
4849
<div id="screenshots">
4950
<h1>Screenshots</h1>
5051

5152
<ul>
52-
<li><a href="{{ get_url(path='images/screenshot1.png') }}" title="selfoss on desktop" data-fancybox="screenshots"><img src="{{ get_url(path='images/screenshot1_thumb.png') }}" alt="selfoss on desktop"></a></li>
53-
<li><a href="{{ get_url(path='images/screenshot2.png') }}" title="selfoss on ipad" data-fancybox="screenshots"><img src="{{ get_url(path='images/screenshot2_thumb.png') }}" alt="selfoss on ipad"></a></li>
54-
<li><a href="{{ get_url(path='images/screenshot3.png') }}" title="selfoss on smartphone" data-fancybox="screenshots"><img src="{{ get_url(path='images/screenshot3_thumb.png') }}" alt="selfoss on smartphone"></a></li>
53+
<li><a href={getUrl('images/screenshot1.png')} title="selfoss on desktop" data-fancybox="screenshots"><img src={getUrl('images/screenshot1_thumb.png')} alt="selfoss on desktop"></a></li>
54+
<li><a href={getUrl('images/screenshot2.png')} title="selfoss on ipad" data-fancybox="screenshots"><img src={getUrl('images/screenshot2_thumb.png')} alt="selfoss on ipad"></a></li>
55+
<li><a href={getUrl('images/screenshot3.png')} title="selfoss on smartphone" data-fancybox="screenshots"><img src={getUrl('images/screenshot3_thumb.png')} alt="selfoss on smartphone"></a></li>
5556
</ul>
5657

5758
</div>
@@ -60,16 +61,18 @@ function IndexLayout({ mdxContent, meta, section, pageContext }) {
6061
);
6162

6263
const scripts = (
63-
current_path === '/' ? (
64+
meta.url === '/' ? (
6465
<script>
66+
{`
6567
switch (document.location.hash) {
6668
case '#configuration_params':
67-
document.location.href = '{safe(get_url(path="@/docs/administration/options.md"))}';
69+
document.location.href = '${safe(getUrl("@/docs/administration/options.md"))}';
6870
break;
6971
case '#about':
70-
document.location.href = '{safe(get_url(path="@/docs/project/credits.md"))}';
72+
document.location.href = '${safe(getUrl("@/docs/project/credits.md"))}';
7173
break;
7274
}
75+
`}
7376
</script>
7477
) : undefined
7578
);
@@ -79,6 +82,9 @@ function IndexLayout({ mdxContent, meta, section, pageContext }) {
7982
title={section.title}
8083
postHeader={postHeader}
8184
scripts={scripts}
85+
mdxContent={mdxContent}
86+
meta={meta}
87+
pageContext={pageContext}
8288
>
8389
{mdxContent}
8490
</Layout>

docs/layouts/page.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ const React = require('react');
44
const Layout = require('./default.jsx');
55

66
function PageLayout({ mdxContent, meta, pageContext }) {
7-
const doc_section = get_section("docs/_index.md");
7+
const docSection = getSection('docs/_index.md');
88

99
const side = (
1010
<nav>
11-
{doc_section.subsections.map((sec_path) => {
12-
const sec = get_section(sec_path);
11+
{docSection.subsections.map((sec_path) => {
12+
const sec = getSection(sec_path);
1313
return (
1414
<React.Fragment>
1515
<h3>{sec.title}</h3>
1616
<ul>
1717
{sec.pages.map((page) => (
18-
<li class={current_path === page.path ? 'active' : ''}>
18+
<li className={meta.url === page.path ? 'active' : ''}>
1919
<a href={page.permalink}>{page.title}</a>
2020
</li>
2121
))}
@@ -31,6 +31,9 @@ function PageLayout({ mdxContent, meta, pageContext }) {
3131
title={meta.title}
3232
postHeader={postHeader}
3333
scripts={scripts}
34+
mdxContent={mdxContent}
35+
meta={meta}
36+
pageContext={pageContext}
3437
>
3538
<h1>{meta.title}</h1>
3639
{mdxContent}

docs/pages/_index.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import DocSection from "./components/blocks";
2+
13
export const meta = {
24
title: "selfoss – the open source web based rss reader and multi source mashup aggregator",
35
}
@@ -6,7 +8,7 @@ export const meta = {
68
# Documentation
79

810
## Requirements {#requirements}
9-
<div class="documentation-entry">
11+
<DocSection>
1012

1113
selfoss is not a hosted service. It has to be installed on your own web server. This web server must fulfil the following requirements (which are available from most providers)
1214

@@ -17,10 +19,10 @@ selfoss is not a hosted service. It has to be installed on your own web server.
1719
With Apache, ensure that you have `mod_authz_core`, `mod_rewrite` and `mod_headers` enabled and that `.htaccess` files are [allowed](http://httpd.apache.org/docs/current/mod/core.html#allowoverride) to set rewrite rules.
1820

1921
selfoss supports all modern browsers, including Mozilla Firefox, Safari, Google Chrome, Opera and Internet Explorer. selfoss also supports mobile browsers on iPad, iPhone, Android and other devices.
20-
</div>
22+
</DocSection>
2123

2224
## Installing selfoss {#installation}
23-
<div class="documentation-entry">
25+
<DocSection>
2426

2527
selfoss is a lightweight php based application. Just follow the simple installation instructions:
2628

@@ -31,10 +33,10 @@ selfoss is a lightweight php based application. Just follow the simple installat
3133
5. Create cron job for updating feeds and point it to https://yoururl.com/update via `wget` or `curl`. You can also execute the `cliupdate.php` from command line.
3234

3335
For further questions or any problems, use our [support forum](forum). For a more detailed step-by-step example installation, please visit the [wiki](https://github.com/fossar/selfoss/wiki/).
34-
</div>
36+
</DocSection>
3537

3638
## Configuring selfoss {#configuration}
37-
<div class="documentation-entry">
39+
<DocSection>
3840

3941
All [configuration options](@/docs/administration/options.md) are optional. Any settings in `config.ini` will override the settings in `src/helpers/Configuration.php`. For convenience, the archive includes `config-example.ini` file containing the default configuration exported in INI format. To customize settings follow these instructions:
4042

@@ -57,11 +59,11 @@ db_database=selfoss
5759
db_username=secretagent
5860
db_password=life0fD4ng3r
5961
```
60-
</div>
62+
</DocSection>
6163

6264
## Importing feeds from a different RSS reader {#importing}
63-
<div class="documentation-entry">
65+
<DocSection>
6466

6567
selfoss supports importing OPML files. Find the OPML export in the old application, it is usually located somewhere in settings.
6668
Then visit the page `https://your-selfoss-url.com/opml` and upload it there.
67-
</div>
69+
</DocSection>

0 commit comments

Comments
 (0)