feat(#121): add support for org files

This commit is contained in:
tdurieux
2022-07-22 09:14:33 +02:00
parent 604f7de0a0
commit 51d9aa7a17
4 changed files with 1740 additions and 35 deletions
+71 -35
View File
@@ -24,6 +24,7 @@
background-color: var(--canvas-bg-color); background-color: var(--canvas-bg-color);
color: var(--color); color: var(--color);
} }
body { body {
--canvas-bg-color: #ffffff; --canvas-bg-color: #ffffff;
--sidebar-bg-color: #ffffff; --sidebar-bg-color: #ffffff;
@@ -62,6 +63,7 @@ body {
0% { 0% {
opacity: 0; opacity: 0;
} }
100% { 100% {
opacity: 1; opacity: 1;
} }
@@ -72,12 +74,14 @@ body {
outline: none !important; outline: none !important;
box-shadow: none; box-shadow: none;
} }
textarea, textarea,
select, select,
input, input,
button { button {
outline: none; outline: none;
} }
input:hover, input:hover,
input:active { input:active {
box-shadow: none !important; box-shadow: none !important;
@@ -97,6 +101,7 @@ select:-webkit-autofill:focus {
-webkit-box-shadow: none; -webkit-box-shadow: none;
transition: background-color 1000s ease-in-out 0s; transition: background-color 1000s ease-in-out 0s;
} }
input:-internal-autofill-selected, input:-internal-autofill-selected,
.form-control, .form-control,
.custom-select { .custom-select {
@@ -104,6 +109,7 @@ input:-internal-autofill-selected,
background-color: var(--input-bg) !important; background-color: var(--input-bg) !important;
border-color: var(--border-color); border-color: var(--border-color);
} }
.form-control:focus { .form-control:focus {
border-color: var(--border-color); border-color: var(--border-color);
} }
@@ -119,6 +125,7 @@ body {
a { a {
color: var(--link-color); color: var(--link-color);
} }
.dropdown-menu a:hover, .dropdown-menu a:hover,
.markdown-body a:hover, .markdown-body a:hover,
a:hover { a:hover {
@@ -134,10 +141,13 @@ a:hover {
font-weight: 300; font-weight: 300;
transition: background-color 0.5s ease; transition: background-color 0.5s ease;
} }
.navbar .nav-link.nav-icon { .navbar .nav-link.nav-icon {
padding: 0 0.5rem; padding: 0 0.5rem;
} }
.navbar .nav-link .fa, .navbar .nav-link .fab {
.navbar .nav-link .fa,
.navbar .nav-link .fab {
font-size: 30px; font-size: 30px;
line-height: 40px; line-height: 40px;
} }
@@ -147,9 +157,11 @@ a:hover {
width: 280px; width: 280px;
} }
} }
.navbar-brand { .navbar-brand {
text-align: center; text-align: center;
} }
#navbarSupportedContent { #navbarSupportedContent {
padding-right: 200px; padding-right: 200px;
} }
@@ -161,21 +173,15 @@ a:hover {
} }
.rgba-gradient { .rgba-gradient {
background: -moz-linear-gradient( background: -moz-linear-gradient(45deg,
45deg, rgba(51, 51, 51, 0.82),
rgba(51, 51, 51, 0.82), rgba(13, 17, 198, 0.69) 100%);
rgba(13, 17, 198, 0.69) 100% background: -webkit-linear-gradient(45deg,
); rgba(51, 51, 51, 0.82),
background: -webkit-linear-gradient( rgba(13, 17, 198, 0.69) 100%);
45deg, background: linear-gradient(to 45deg,
rgba(51, 51, 51, 0.82), rgba(51, 51, 51, 0.82),
rgba(13, 17, 198, 0.69) 100% rgba(13, 17, 198, 0.69) 100%);
);
background: linear-gradient(
to 45deg,
rgba(51, 51, 51, 0.82),
rgba(13, 17, 198, 0.69) 100%
);
color: var(--header-color); color: var(--header-color);
} }
@@ -186,6 +192,7 @@ a:hover {
background-color: var(--main-bg-color) !important; background-color: var(--main-bg-color) !important;
color: var(--color) !important; color: var(--color) !important;
} }
.file-content { .file-content {
padding: 4px 7px; padding: 4px 7px;
text-align: left; text-align: left;
@@ -200,12 +207,14 @@ a:hover {
.dropdown-item:hover { .dropdown-item:hover {
background-color: var(--hover-bg-color); background-color: var(--hover-bg-color);
} }
.card-header .btn, .card-header .btn,
.card-header .btn:hover, .card-header .btn:hover,
.card-header .btn:focus { .card-header .btn:focus {
border: none !important; border: none !important;
background: transparent !important; background: transparent !important;
} }
.btn { .btn {
color: var(--btn-color); color: var(--btn-color);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
@@ -221,20 +230,25 @@ a:hover {
background-color: var(--hover-bg-color); background-color: var(--hover-bg-color);
box-shadow: none !important; box-shadow: none !important;
} }
.btn.btn-primary { .btn.btn-primary {
color: var(--primary-color); color: var(--primary-color);
background-color: var(--primary-bg); background-color: var(--primary-bg);
} }
.btn.btn-primary:active, .btn.btn-primary:active,
.btn.btn-primary:hover { .btn.btn-primary:hover {
color: var(--primary-active-color); color: var(--primary-active-color);
background-color: var(--primary-hover-bg) !important; background-color: var(--primary-hover-bg) !important;
} }
.btn::placeholder { .btn::placeholder {
/* Chrome, Firefox, Opera, Safari 10.1+ */ /* Chrome, Firefox, Opera, Safari 10.1+ */
color: var(--color); color: var(--color);
opacity: 1; /* Firefox */ opacity: 1;
/* Firefox */
} }
.white_border { .white_border {
border: 1px solid white; border: 1px solid white;
color: white; color: white;
@@ -288,18 +302,22 @@ a:hover {
background: var(--hover-bg-color); background: var(--hover-bg-color);
color: var(--color); color: var(--color);
} }
.files ul { .files ul {
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.files li ul { .files li ul {
padding-left: 10px; padding-left: 10px;
} }
.files .folder > ul {
.files .folder>ul {
display: none; display: none;
} }
.files .folder.open > ul {
.files .folder.open>ul {
display: block; display: block;
} }
@@ -327,6 +345,7 @@ a:hover {
.ace_editor { .ace_editor {
height: 100%; height: 100%;
} }
.ace_scroller { .ace_scroller {
cursor: default; cursor: default;
} }
@@ -351,9 +370,11 @@ a:hover {
.paths a { .paths a {
color: var(--color); color: var(--color);
} }
.paths .breadcrumb-item { .paths .breadcrumb-item {
padding-left: 3px; padding-left: 3px;
} }
.paths .breadcrumb-item::before { .paths .breadcrumb-item::before {
padding-right: 3px; padding-right: 3px;
} }
@@ -372,6 +393,7 @@ a:hover {
text-align: center; text-align: center;
padding: 4px; padding: 4px;
} }
.file-error { .file-error {
font-weight: bold; font-weight: bold;
font-size: 50px; font-size: 50px;
@@ -382,6 +404,7 @@ pdfviewer {
display: block; display: block;
padding: 15px; padding: 15px;
} }
pdfpageviewer { pdfpageviewer {
display: block; display: block;
width: 100%; width: 100%;
@@ -402,6 +425,7 @@ notebook {
height: 47px !important; height: 47px !important;
right: 3px !important; right: 3px !important;
} }
.floating-chat-kofi-popup-iframe { .floating-chat-kofi-popup-iframe {
left: inherit !important; left: inherit !important;
bottom: inherit !important; bottom: inherit !important;
@@ -413,15 +437,19 @@ notebook {
color: var(--color); color: var(--color);
display: block; display: block;
} }
.faq-section .panel-heading { .faq-section .panel-heading {
background-color: var(--sidebar-bg-color); background-color: var(--sidebar-bg-color);
} }
.faq-section .panel-default { .faq-section .panel-default {
background-color: var(--hover-bg-color); background-color: var(--hover-bg-color);
} }
.faq-section .panel-default .panel-title { .faq-section .panel-default .panel-title {
margin-bottom: 0; margin-bottom: 0;
} }
.faq-section .panel-default .panel-title a:after { .faq-section .panel-default .panel-title a:after {
font-family: "FontAwesome"; font-family: "FontAwesome";
font-style: normal; font-style: normal;
@@ -430,9 +458,11 @@ notebook {
float: right; float: right;
margin-top: -12px; margin-top: -12px;
} }
.faq-section .panel-default .panel-title a.collapsed:after { .faq-section .panel-default .panel-title a.collapsed:after {
content: "\f107"; content: "\f107";
} }
.faq-section .panel-default .panel-body { .faq-section .panel-default .panel-body {
font-size: 1.2rem; font-size: 1.2rem;
} }
@@ -458,6 +488,7 @@ loc {
width: 100%; width: 100%;
height: 5px; height: 5px;
} }
loc .lang { loc .lang {
float: left; float: left;
height: 100%; height: 100%;
@@ -474,7 +505,8 @@ loc .lang {
} }
.featurette-divider { .featurette-divider {
margin: 5rem 0; /* Space out the Bootstrap <hr> more */ margin: 5rem 0;
/* Space out the Bootstrap <hr> more */
} }
/* Thin out the marketing headings */ /* Thin out the marketing headings */
@@ -505,20 +537,24 @@ loc .lang {
} }
.dark-mode .rgba-gradient { .dark-mode .rgba-gradient {
background: -moz-linear-gradient( background: -moz-linear-gradient(45deg,
45deg, rgb(45 45 64 / 82%),
rgb(45 45 64 / 82%), rgb(23 26 49) 100%);
rgb(23 26 49) 100% background: -webkit-linear-gradient(45deg,
); rgb(45 45 64 / 82%),
background: -webkit-linear-gradient( rgb(23 26 49) 100%);
45deg, background: linear-gradient(to 45deg,
rgb(45 45 64 / 82%), rgb(45 45 64 / 82%),
rgb(23 26 49) 100% rgb(23 26 49) 100%);
);
background: linear-gradient(
to 45deg,
rgb(45 45 64 / 82%),
rgb(23 26 49) 100%
);
} }
.section-number {
padding-right: 10px;
font-weight: bold;
font-style: italic;
}
.org-subscript-child {
font-size: 85%;
}
+2
View File
@@ -71,6 +71,8 @@
<script src="/script/external/katex-auto-render.min.js"></script> <script src="/script/external/katex-auto-render.min.js"></script>
<script src="/script/external/notebook.min.js"></script> <script src="/script/external/notebook.min.js"></script>
<script src="/script/external/org.js"></script>
<!-- Anonymous GitHub scripts --> <!-- Anonymous GitHub scripts -->
<script src="/script/utils.js"></script> <script src="/script/utils.js"></script>
<script src="/script/ng-pdfviewer.min.js"></script> <script src="/script/ng-pdfviewer.min.js"></script>
+17
View File
@@ -1340,6 +1340,9 @@ angular
if (extension == "md") { if (extension == "md") {
return "md"; return "md";
} }
if (extension == "org") {
return "org";
}
if (extension == "ipynb") { if (extension == "ipynb") {
return "IPython"; return "IPython";
} }
@@ -1380,6 +1383,20 @@ angular
$scope.content = marked(md, { baseUrl: $location.url() }); $scope.content = marked(md, { baseUrl: $location.url() });
$scope.type = "html"; $scope.type = "html";
} }
if ($scope.type == "org") {
const content = contentAbs2Relative(res.data);
const orgParser = new Org.Parser();
const orgDocument = orgParser.parse(content);
var orgHTMLDocument = orgDocument.convert(Org.ConverterHTML, {
headerOffset: 1,
exportFromLineNumber: false,
suppressSubScriptHandling: false,
suppressAutoLink: false,
});
$scope.content = orgHTMLDocument.toString();
$scope.type = "html";
}
setTimeout(() => { setTimeout(() => {
Prism.highlightAll(); Prism.highlightAll();
}, 50); }, 50);
+1650
View File
File diff suppressed because it is too large Load Diff