-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e82f73e
Showing
97 changed files
with
27,987 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
Copyright (c) 2018 石固 | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
// mkdnotes --commit | ||
|
||
#include <stdio.h> | ||
#include <dirent.h> | ||
#include <errno.h> | ||
#include <sys/stat.h> | ||
#include "./vendor/cJSON/cJSON.c" | ||
|
||
char* Idx2JSON_printStr(char *startDirPath); | ||
void Idx2JSON_recursiveDir(char *dirPath, cJSON *f); | ||
|
||
char* Idx2JSON_printStr(char *startDirPath) | ||
{ | ||
cJSON *root = NULL; | ||
if ((root = cJSON_CreateArray()) == NULL) | ||
{ | ||
fprintf(stderr, "error: Failed to create cJSON structure!\n"); | ||
exit(1); | ||
} | ||
|
||
Idx2JSON_recursiveDir(startDirPath, root); | ||
|
||
char *res = NULL; | ||
if ((res = cJSON_Print(root)) == NULL) | ||
{ | ||
fprintf(stderr, "error: Failed to print cJSON structure!\n"); | ||
exit(1); | ||
} | ||
|
||
cJSON_Delete(root); | ||
|
||
return res; | ||
} | ||
|
||
void Idx2JSON_recursiveDir(char *dirPath, cJSON *f) | ||
{ | ||
DIR *dirP = NULL; | ||
if ((dirP = opendir(dirPath)) == NULL) | ||
{ | ||
fprintf(stderr, "error: Failed to open directory: \"%s\"\n", dirPath); | ||
exit(1); | ||
} | ||
|
||
struct dirent *dp; | ||
dp = readdir(dirP); | ||
|
||
while (dp) | ||
{ | ||
if (errno != 0) | ||
{ | ||
fprintf(stderr, "error: Failed to read directory: \"%s\"\n", dirPath); | ||
exit(1); | ||
} | ||
|
||
if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) | ||
{ | ||
// check the file type | ||
char testFilePath[256] = {'\0'}; | ||
strcpy(testFilePath, dirPath); | ||
strcat(testFilePath, "/"); | ||
strcat(testFilePath, dp->d_name); | ||
|
||
struct stat buf; | ||
stat(testFilePath, &buf); | ||
if (S_ISDIR(buf.st_mode)) | ||
{ | ||
// is folder | ||
cJSON *obj = NULL, | ||
*arr = NULL; | ||
|
||
if ((obj = cJSON_CreateObject()) == NULL || (arr = cJSON_CreateArray()) == NULL || (cJSON_AddStringToObject(obj, "text", dp->d_name)) == NULL) | ||
{ | ||
fprintf(stderr, "error: Failed to create cJSON structure!\n"); | ||
exit(1); | ||
} | ||
|
||
cJSON_AddItemToObject(obj, "nodes", arr); | ||
cJSON_AddItemToArray(f, obj); | ||
|
||
// sub folder | ||
Idx2JSON_recursiveDir(testFilePath, arr); | ||
} | ||
else if (strlen(dp->d_name) > 5 && strcmp(dp->d_name + (strlen(dp->d_name) - 5), ".html") == 0) | ||
{ | ||
cJSON *obj = NULL; | ||
if ((obj = cJSON_CreateObject()) == NULL || (cJSON_AddStringToObject(obj, "text", dp->d_name)) == NULL) | ||
{ | ||
fprintf(stderr, "error: Failed to create cJSON structure!\n"); | ||
exit(1); | ||
} | ||
|
||
cJSON_AddItemToArray(f, obj); | ||
} | ||
} | ||
|
||
dp = readdir(dirP); | ||
} | ||
|
||
closedir(dirP); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 石固 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# mkdnotes | ||
Guides / Documentation, see [https://sigool.github.io/mkdnotes/demo/](https://sigool.github.io/mkdnotes/demo/) | ||
|
||
|
||
# Credits | ||
|
||
- [cJSON](https://github.com/DaveGamble/cJSON): Ultralightweight JSON parser in ANSI C | ||
- [inih](https://github.com/benhoyt/inih): Simple .INI file parser in C, good for embedded systems | ||
- [whereami](https://github.com/gpakosz/whereami): Locate the current executable and the current module/library on the file system | ||
- [jQuery.mmenu](https://github.com/FrDH/jQuery.mmenu): The best jQuery plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp. | ||
- [strapdown](https://github.com/arturadib/strapdown): Instant and elegant Markdown documents in the browser | ||
- Icons from [IcoMoon app](https://icomoon.io/app) | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/*! | ||
* Copyright (c) SiGool | ||
* base on mmenu demo.css | ||
*/ | ||
|
||
html, body | ||
{ | ||
padding: 0; | ||
margin: 0; | ||
|
||
height: 100%; | ||
} | ||
body | ||
{ | ||
background-color: #fff; | ||
font-family: Arial, Helvetica, Verdana; | ||
font-size: 14px; | ||
line-height: 22px; | ||
color: #666; | ||
position: relative; | ||
-webkit-text-size-adjust: none; | ||
} | ||
body * | ||
{ | ||
text-shadow: none; | ||
} | ||
h1, h2, h3, h4, h5, h6 | ||
{ | ||
line-height: 1; | ||
font-weight: bold; | ||
margin: 20px 0 10px 0; | ||
} | ||
h1, h2, h3 | ||
{ | ||
font-size: 18px; | ||
} | ||
h4, h5, h6 | ||
{ | ||
font-size: 16px; | ||
} | ||
p | ||
{ | ||
margin: 0 0 10px 0; | ||
} | ||
a, a:link, a:active, a:visited, a:hover | ||
{ | ||
color: inherit; | ||
text-decoration: underline; | ||
} | ||
|
||
.header, | ||
.content, | ||
.footer | ||
{ | ||
text-align: center; | ||
} | ||
.header, | ||
.footer | ||
{ | ||
background: #777; | ||
font-size: 16px; | ||
font-weight: bold; | ||
color: #fff; | ||
line-height: 40px; | ||
|
||
|
||
-moz-box-sizing: border-box; | ||
box-sizing: border-box; | ||
width: 100%; | ||
height: 40px; | ||
padding: 0 50px; | ||
} | ||
.header.fixed | ||
{ | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
} | ||
.footer.fixed | ||
{ | ||
position: fixed; | ||
bottom: 0; | ||
left: 0; | ||
} | ||
.header a | ||
{ | ||
display: block; | ||
width: 28px; | ||
height: 18px; | ||
padding: 11px; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
} | ||
.header a:before, | ||
.header a:after | ||
{ | ||
content: ''; | ||
display: block; | ||
background: #fff; | ||
height: 2px; | ||
} | ||
.header a span | ||
{ | ||
background: #fff; | ||
display: block; | ||
height: 2px; | ||
margin: 6px 0; | ||
} | ||
|
||
/* 100% */ | ||
#page { | ||
height: 100%; | ||
} | ||
|
||
.content | ||
{ | ||
/*padding: 150px 50px 50px 50px;*/ | ||
height: 100%; | ||
overflow-y: hidden; | ||
} | ||
|
||
/**/ | ||
|
||
nav:not(.mm-menu) | ||
{ | ||
display: none; | ||
} | ||
|
||
@media (min-width: 992px) { | ||
.header a { | ||
display: none; | ||
} | ||
} | ||
|
||
.mm-navbar_tabs span { | ||
display: inline-block; | ||
margin-left: 8px; | ||
} | ||
@media (max-width: 450px) { | ||
.mm-navbar_tabs span { | ||
display: none; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var data = [{ | ||
"text": "testDefault.html" | ||
}, { | ||
"text": "testOption.html" | ||
}, { | ||
"text": "动物", | ||
"nodes": [{ | ||
"text": "kitten.html" | ||
}] | ||
}]; |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@font-face { | ||
font-family: 'icomoon'; | ||
src: url('fonts/icomoon.eot?xrgxmd'); | ||
src: url('fonts/icomoon.eot?xrgxmd#iefix') format('embedded-opentype'), | ||
url('fonts/icomoon.ttf?xrgxmd') format('truetype'), | ||
url('fonts/icomoon.woff?xrgxmd') format('woff'), | ||
url('fonts/icomoon.svg?xrgxmd#icomoon') format('svg'); | ||
font-weight: normal; | ||
font-style: normal; | ||
} | ||
|
||
[class^="icon-"], [class*=" icon-"] { | ||
/* use !important to prevent issues with browser extensions that change fonts */ | ||
font-family: 'icomoon' !important; | ||
speak: none; | ||
font-style: normal; | ||
font-weight: normal; | ||
font-variant: normal; | ||
text-transform: none; | ||
line-height: 1; | ||
|
||
/* Better Font Rendering =========== */ | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
.icon-github:before { | ||
content: "\e900"; | ||
} | ||
.icon-home:before { | ||
content: "\e901"; | ||
} |
Oops, something went wrong.