M src/objects/content.cr => src/objects/content.cr +4 -0
@@ 16,6 16,7 @@ module Beulogue
getter frontMatter : BeulogueFrontMatter
getter is_markdown : Bool
getter is_gemini : Bool
+ getter is_draft : Bool
def initialize(@fromPath : Path, pathLang : String, contentLang : String, @wd : Path, dev_mode : Bool | Nil)
frontMatterDelimiter = "---"
@@ 56,6 57,9 @@ module Beulogue
folderName = "content"
if dev_mode == true && fromPath.to_s.includes? "/drafts"
folderName = "drafts"
+ @is_draft = true
+ else
+ @is_draft = false
end
@contentPath = fromPath.to_s.sub(@wd.join(folderName).to_s, "")
M src/objects/page.cr => src/objects/page.cr +9 -2
@@ 18,6 18,7 @@ module Beulogue
getter weight : Float64
getter is_markdown : Bool
getter is_gemini : Bool
+ getter is_draft : Bool
def initialize(content : BeulogueContent, multilang : Array(Hash(String, String)))
@contentPath = content.contentPath
@@ 32,6 33,7 @@ module Beulogue
@weight = content.frontMatter.weight || 1.0
@is_markdown = content.is_markdown
@is_gemini = content.is_gemini
+ @is_draft = content.is_draft
@content = Markd.to_html(Emoji.emojize(BeulogueParser.parse(content, multilang) || ""))
end
@@ 42,11 44,16 @@ module Beulogue
"date" => @date,
"dateFormatted" => @date.to_s("%F"),
"description" => @description,
+ "is_draft" => @is_draft,
"language" => @language,
"multilang" => @multilang.sort_by { |e| e["language"] },
"tags" => tags,
- "title" => @title,
- "type" => if @is_gemini
+ "title" => if @is_draft
+ "#{@title} (draft)"
+ else
+ @title
+ end,
+ "type" => if @is_gemini
"gemini"
else
"markdown"