mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-03 01:16:14 +03:00
Include extension in generated content file.
This commit is contained in:
parent
412d500144
commit
e770d19254
@ -44,6 +44,7 @@ import Pages.Manifest exposing (DisplayMode, Orientation)
|
||||
import Pages.Manifest.Category as Category exposing (Category)
|
||||
import RawContent
|
||||
import Url.Parser as Url exposing ((</>), s)
|
||||
import Pages.Document
|
||||
|
||||
|
||||
port toJsPort : Json.Encode.Value -> Cmd msg
|
||||
@ -54,10 +55,8 @@ application :
|
||||
, update : userMsg -> userModel -> ( userModel, Cmd userMsg )
|
||||
, subscriptions : userModel -> Sub userMsg
|
||||
, view : userModel -> List ( List String, metadata ) -> Page metadata view -> { title : String, body : Html userMsg }
|
||||
, parser : Pages.Parser metadata view
|
||||
, head : metadata -> List Head.Tag
|
||||
, frontmatterParser : Json.Decode.Decoder metadata
|
||||
, markdownToHtml : String -> view
|
||||
, document : Pages.Document.Document metadata view
|
||||
, manifest :
|
||||
{ backgroundColor : Maybe Color
|
||||
, categories : List Category
|
||||
@ -79,10 +78,8 @@ application config =
|
||||
, view = config.view
|
||||
, update = config.update
|
||||
, subscriptions = config.subscriptions
|
||||
, parser = config.parser
|
||||
, frontmatterParser = config.frontmatterParser
|
||||
, document = config.document
|
||||
, content = RawContent.content
|
||||
, markdownToHtml = config.markdownToHtml
|
||||
, toJsPort = toJsPort
|
||||
, head = config.head
|
||||
, manifest =
|
||||
@ -119,6 +116,7 @@ import Pages.Manifest exposing (DisplayMode, Orientation)
|
||||
import Pages.Manifest.Category as Category exposing (Category)
|
||||
import RawContent
|
||||
import Url.Parser as Url exposing ((</>), s)
|
||||
import Pages.Document
|
||||
|
||||
|
||||
port toJsPort : Json.Encode.Value -> Cmd msg
|
||||
@ -129,10 +127,8 @@ application :
|
||||
, update : userMsg -> userModel -> ( userModel, Cmd userMsg )
|
||||
, subscriptions : userModel -> Sub userMsg
|
||||
, view : userModel -> List ( List String, metadata ) -> Page metadata view -> { title : String, body : Html userMsg }
|
||||
, parser : Pages.Parser metadata view
|
||||
, document : Pages.Document.Document metadata view
|
||||
, head : metadata -> List Head.Tag
|
||||
, frontmatterParser : Json.Decode.Decoder metadata
|
||||
, markdownToHtml : String -> view
|
||||
, manifest :
|
||||
{ backgroundColor : Maybe Color
|
||||
, categories : List Category
|
||||
@ -154,10 +150,8 @@ application config =
|
||||
, view = config.view
|
||||
, update = config.update
|
||||
, subscriptions = config.subscriptions
|
||||
, parser = config.parser
|
||||
, frontmatterParser = config.frontmatterParser
|
||||
, document = config.document
|
||||
, content = RawContent.content
|
||||
, markdownToHtml = config.markdownToHtml
|
||||
, toJsPort = toJsPort
|
||||
, head = config.head
|
||||
, manifest =
|
||||
|
@ -46,13 +46,23 @@ function unpackMarkup(path) {
|
||||
fs.readFileSync(path).toString(),
|
||||
markupFrontmatterOptions
|
||||
);
|
||||
return { path, metadata: separated.matter, body: separated.content };
|
||||
return {
|
||||
path,
|
||||
metadata: separated.matter,
|
||||
body: separated.content,
|
||||
extension: "emu"
|
||||
};
|
||||
}
|
||||
|
||||
function parseMarkdown(path, fileContents) {
|
||||
console.log("!!! 3");
|
||||
const { content, data } = matter(fileContents, markupFrontmatterOptions);
|
||||
return { path, metadata: JSON.stringify(data), body: content };
|
||||
return {
|
||||
path,
|
||||
metadata: JSON.stringify(data),
|
||||
body: content,
|
||||
extension: "md"
|
||||
};
|
||||
}
|
||||
|
||||
function run() {
|
||||
|
@ -4,21 +4,11 @@ module.exports = function(markdown, markup) {
|
||||
import Dict exposing (Dict)
|
||||
|
||||
|
||||
content : { markdown : List ( List String, { frontMatter : String, body : Maybe String } ), markup : List ( List String, { frontMatter : String, body : Maybe String } ) }
|
||||
content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } )
|
||||
content =
|
||||
{ markdown = markdown, markup = markup }
|
||||
|
||||
|
||||
markdown : List ( List String, { frontMatter : String, body : Maybe String } )
|
||||
markdown =
|
||||
[ ${markdown.map(toEntry)}
|
||||
[ ${markdown.concat(markup).map(toEntry)}
|
||||
]
|
||||
|
||||
|
||||
markup : List ( List String, { frontMatter : String, body : Maybe String } )
|
||||
markup =
|
||||
[ ${markup.map(toEntry)}
|
||||
]`;
|
||||
`;
|
||||
};
|
||||
|
||||
function toEntry(entry) {
|
||||
@ -32,6 +22,8 @@ function toEntry(entry) {
|
||||
return `
|
||||
( [${fullPath.join(", ")}]
|
||||
, { frontMatter = """${entry.metadata}
|
||||
""", body = Nothing } )
|
||||
""" , body = Nothing
|
||||
, extension = "${entry.extension}"
|
||||
} )
|
||||
`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user