feat: simplify README handling
This commit is contained in:
parent
dfd8e299cd
commit
b420a6eafa
3 changed files with 16 additions and 13 deletions
11
dragon_fire.code-workspace
Normal file
11
dragon_fire.code-workspace
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "../dragon_fire_content"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
|
@ -97,6 +97,10 @@ class PostHandler extends MySQLAdapter {
|
|||
}
|
||||
|
||||
function save_markdown_post($post_path, $post_data) {
|
||||
if(basename($post_path) == "README.md") {
|
||||
$post_path = dirname($post_path);
|
||||
}
|
||||
|
||||
$frontmatter_post = YamlFrontMatter::parse($post_data);
|
||||
$post_path = $this->_sanitize_path($post_path);
|
||||
|
||||
|
@ -110,19 +114,6 @@ class PostHandler extends MySQLAdapter {
|
|||
|
||||
$post_metadata['tags'][]= 'type:' . $post_metadata['type'];
|
||||
|
||||
if(basename($post_path) == "README.md") {
|
||||
$readme_metadata = [];
|
||||
if(isset($post_metadata['settings'])) {
|
||||
$readme_metadata['settings'] = $post_metadata['settings'];
|
||||
}
|
||||
if(isset($post_metadata['directory'])) {
|
||||
$readme_metadata = $post_metadata['directory'];
|
||||
}
|
||||
|
||||
$this->update_or_create_post(dirname($post_path),
|
||||
$readme_metadata, $post_content);
|
||||
}
|
||||
|
||||
$this->update_or_create_post($post_path, $post_metadata, $post_content);
|
||||
}
|
||||
|
||||
|
|
1
www/secrets/.gitignore
vendored
1
www/secrets/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.json
|
||||
*.yml
|
||||
api_admin_key
|
Loading…
Add table
Add a link
Reference in a new issue