Skip to content

Instantly share code, notes, and snippets.

@sflavelle

sflavelle/compile.ps1 Secret

Last active Nov 6, 2020
Embed
What would you like to do?
Begin Again - Folder Structure and Compile Script
param (
[string]$Part,
[int]$ChapterNumber,
[string]$ChapterName,
[string]$OutputName = "BeginAgain",
[switch]$Verbose = $false,
[switch]$ePub = $false,
[switch]$HTML = $true
)
$contentPath = if ( $Part -and $ChapterNumber ) {
Get-ChildItem -Directory -Path ".\Chapters\Part $Part" | Where-Object {$_.Name -match "^$ChapterNumber "} | Select-Object -ExpandProperty FullName
}
elseif ( $Part -and $ChapterName ) {
Get-ChildItem -Directory -Path ".\Chapters\Part $Part" | Where-Object {$_.Name -match $ChapterName} | Select-Object -ExpandProperty FullName
}
elseif ( $Part ) {
Get-ChildItem -Directory -Path ".\Chapters\Part $Part" | Select-Object -ExpandProperty FullName
}
else { Get-Item Chapters | Select-Object -ExpandProperty FullName }
# collect everything into a temp variable
$content = switch ($IsWindows)
{
true {
Get-ChildItem -Path $contentPath -Filter *.md -Recurse -ErrorAction SilentlyContinue | Get-Content -Encoding utf8 -Raw | Join-String -Separator "`n`n"
}
false {
& find -s $contentPath -type f -iname "*.md" | Get-Item | Get-Content -Encoding utf8 -Raw | Join-String -Separator "`n`n"
}
}
if ( $Verbose )
{
Write-Host -BackgroundColor Yellow -ForegroundColor Black "Selected content from $contentPath"
Get-Variable content -ValueOnly | Out-File ContentDebug.txt
Get-Variable content -ValueOnly | Measure-Object -IgnoreWhiteSpace -Word -Character -Line
}
# to ePub
if ( $ePub ) {
Write-Host "Compiling to ePub..."
Get-Variable content -ValueOnly | pandoc --verbose --defaults pandoc-defaults.yaml --metadata-file=Resources/metadata.yaml --to epub -o Compiled/$OutputName.epub
}
# to HTML
if ( $HTML ) {
Write-Host "Compiling to HTML..."
Get-Variable content -ValueOnly | pandoc --verbose --defaults pandoc-defaults.yaml --metadata-file=Resources/metadata.yaml --to html -o Compiled/$OutputName.html
}
Write-Host "Done!"
---
title: 'Begin Again: Chronicles of an Ex-Human in Inkopolis'
author:
- Splatsune
abstract: |
A human finds themselves transformed and left twelve thousand years in the future, when humans are extinct and marine life has taken their place.
lang: en-AU
...
from: markdown+line_blocks+multiline_tables
standalone: true
file-scope: true
table-of-contents: true
toc-depth: 3
number-sections: true
ascii: false
epub-chapter-level: 2
.
|____.markdownlint.json
|____.vscode
| |____launch.json
|____Chapters
| |____Part 1
| | |____00-part-header.md
| | |____01 Gift From The Skies
| | | |____1 The Encounter.md
| | | |____2 What Is This_.md
| | | |____3 Breaking News.md
| | | |____4 He's Awake.md
| | | |____5 Implications.md
| | | |____6 The Next Day.md
| | |____02 The Attack
| | | |____1 Discovery.md
| | | |____2 Attack.md
| | | |____3 Answers.md
| | |____03 Her New World
| | | |____01 Lily and Four.md
| | | |____02 The More Things Change.md
| | | |____03 Ammo Knights.md
| | | |____04 Medical Exam.md
| | | |____05 The Plan.md
| | | |____06 Weapon Set.md
| | | |____07 Training.md
| | | |____08 Mobile.md
| | | |____09 The Museum.md
| | |____04 Gravity's Calling
| | | |____1 Agent Five.md
| | | |____2 Tracked.md
| | | |____3 Surprise Attack.md
| | | |____4 Terrorist.md
| | | |____5 Concrete Jungle.md
| | | |____6 Ouch.md
| | | |____7 Painful Escape.md
| | | |____8 The Climb.md
| | |____05 Begin Again
| | | |____1 Playing with her prize.md
| | | |____2 Enter Off The Hook.md
| | | |____3 Four's Apartment.md
| | |____06 On Being Blue
| | | |____1 The Call.md
| | | |____2 City Metro.md
| | | |____3 Marina.md
| | | |____4 Coffee For Marie.md
| | | |____5 Pomf.md
| | | |____6 Remember Human Life.md
| | | |____7 Human Music.md
| | | |____8 Agent 4 Calls In.md
| | |____07 The Longest Night
| | | |____1 Day In.md
| | | |____2 New Albacore.md
| | | |____3 Reading Material.md
| | | |____4-1 Where Am I_.md
| | | |____4-2 A Split In The Path.md
| | | |____4-3 Off The Path.md
| | | |____4-4 Grand Oak Tree.md
| | | |____5 Back To Reality.md
| | | |____6 Truck Ride.md
| | |____08 Hot Chocolate
| | | |____1 4+5.md
| | | |____2 Laundry.md
| | | |____3 The Neighbors.md
| | | |____4 Inkopolis Gardens Coffeehouse.md
| | | |____5 The Garden.md
| | | |____6 Rain.md
| | | |____7 An Excited Passenger.md
| | |____09 Ghosts
| | | |____1 Ghosts.md
| |____Part 2
| | |____00-part-header.md
| | |____01 Universal Language
| | | |____1 This Is An Arena_.md
| | | |____2 What Kind Of Supermarket.md
| | | |____3 Roller and Slosh.md
| | | |____4 Lily's First Respawn.md
| | | |____5 The Battle Begins.md
| | | |____6 The Aftermath.md
| | |____02 Hooked
| | | |____1 News Segment.md
| | | |____2 Lily And Crew Arrives.md
| | | |____3 Taking a Look At The Car.md
| | | |____4 Are You Human_.md
| | |____03 Human After All
| | | |____01 Agent 8..md
| | | |____02 Pearl's 'Interview'.md
| | | |____03 The Alleyway.md
| | | |____04 Rooftop.md
| | | |____05 I Have To Leave.md
| | | |____06 let me in.md
| | | |____07 The Sewers.md
| | | |____08 Encounter with The Octos.md
| | | |____09 Lily's Down.md
| | |____04 Going Wrong
| | | |____1 Pearl's Plan.md
| | | |____2 Interrogation.md
| | | |____3 Conflict.md
| | | |____4 Safe House.md
| | | |____5 #IRC.md
| | |____05 Something About Us
| | | |____1 The Bulletin.md
| | | |____2 The Hang Out.md
| | | |____3 That Night.md
| | |____06 Piercing The Fog
| | | |____1 Early Morning Chat.md
| | | |____2 Train Visitor.md
| | | |____3 Tartar 101.md
| | | |____4 Deepsea.md
| | |____07 Metal Bork
| | | |____1 Lily meets Octavio.md
| | | |____2 Crossing Beaker's Depot.md
| | | |____3 Stompy.md
| | |____08 Age of Enlightenment
| | | |____1 Meeting at the Hiedout.md
| | | |____2 Organising the meeting.md
| | | |____3 The girl on the Grate.md
| | | |____4 The Meeting.md
| | | |____5 A Way Back.md
| | |____09 Heart Is King
| | | |____1 The Apology.md
| | | |____2 Travel Time.md
| | | |____3 Cap'n And The Hideout.md
| | | |____4 Skill Test.md
| | | |____5 Craig's Decision.md
| | |____10 Let There Be Light
| | | |____1 Two days.md
| | | |____2 The Apology.md
| | | |____3 Scent Drunk.md
| | | |____4 The Babelfish.md
| | |____11 Terminal March
| | | |____1 Lily and Lorne awoke early.md
| | | |____2 Inkopolis Square Station.md
| | | |____3 Departure.md
| | | |____4 The conversation continued.md
| | | |____5 Music.md
| | | |____6 Triggerfish Station.md
| | |____12 Vivid Memories Turn to Fantasies
| | | |____1 Camp Triggerfish.md
| | | |____2 The Forest Journey.md
| | | |____3 The Meeting.md
| | | |____4 Interface.md
| | | |____5 Revenge.md
| | | |____6 Lily's Aftermath.md
| | |____13 Part 2 Epilogue All My Friends
| | | |____1 All My Friends.md
| |____Part 2+
| | |____00-part-header.md
| | |____1 The Interview
| | | |____1 Mia.md
| | | |____2 Gardens.md
| | | |____3 Special Report.md
| | | |____4 An Introduction.md
| | | |____5 Leaving.md
| | |____2 The Salmon Dance
| | | |____1 Approach.md
| | | |____2 Setup.md
| | | |____3 Shift.md
| | | |____4 Mission.md
| | | |____5 Underwater.md
| | | |____6 End.md
| | |____3 On A Rail
| | | |____1 Deepsea Metro Central Station had seen better days.md
| | | |____2 Their Mission.md
| | | |____3 Station One.md
| | | |____4 Station Zero.md
| | | |____5 Darkness.md
| | | |____6 Civilization.md
| | | |____7 Check In.md
| | | |____8 Deja Vu.md
| | |____4 Time Capsule
| | | |____1 Agent Eight.md
| | | |____2 With The Agents.md
| | | |____3 Eight and Craven.md
| | | |____4 Returning the Laptop.md
| | |____6 The Octopus's Garden
| | | |____1 DJ Octavio Takowasa.md
| | | |____2 Three Months Prior.md
| | | |____3 Ceph Squad.md
| |____Part 3
| | |____00-part-header.md
| | |____1 The Beginning Of The End
| | | |____1 Literally the Splatfest Dialogue.md
| | | |____2 After the Show.md
| | | |____3 The Gardens.md
| | | |____4 Surprise Party.md
| | |____2 Neu Wave Music
| | | |____1 In Da Club.md
| | | |____2 Recuperation.md
| | |____3 Last Night a DJ
| | | |____1 The Octo Canyon.md
| | | |____2 Spirit.md
| | |____31 Glitch
| | | |____1 CQ and Iso.md
| | | |____2 The Metro.md
| | | |____3 The Aftermath.md
| | |____32 The Final Broadcast
| | | |____1 The Final Broadcast.md
| | |____33 The Mortician's Tale
| | | |____2 Abandoned Town.md
| | |____34 Subject 10,009
| | | |____3 Subject 10,009.md
| | |____4 Sound of the Underground
| | | |____1 Imprisoned.md
| | | |____2 An Audience With the King.md
| | |____5 Your New Frame of Mind
| | | |____1 Conversion.md
| | | |____2 The Great Zapfish.md
| | | |____2 _Hey,_ Octavio said calmly, slightly irritated. Had the mind control faltered....md
| | |____6 Here We Go Again
| | | |____1 The Morning After.md
| | | |____2 Sheldon's Rescue.md
| | | |____3 Detective Marina.md
| | |____7 Begin Again (DJ Octavio Remix)
| | | |____01 Meeting Gomez.md
|____Compiled
| |____BeginAgain.epub
| |____BeginAgain.html
| |____ChapterTest.epub
| |____ChapterTest.html
| |____Part3-2.epub
| |____Part3-2.html
|____Resources
| |____Unfinished Chapters
| | |____2.5-5 How To Hype Up A Crowd, With Pearl Houzuki
| | | |____1 _Hey, whoa._.md
| | | |____2 The Green Room.md
| |____metadata.yaml
|____beginagain.code-workspace
|____compile.ps1
|____compile.sh
|____pandoc-defaults.yaml
|____tree.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment