diff --git a/.gitignore b/.gitignore index 0e5b2ef..c18dd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ __pycache__/ -public/ diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..3c5dfd2 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +python3 src/main.py "/boot-dev-python-markdown-website-builder/" diff --git a/docs/blog/glorfindel/index.html b/docs/blog/glorfindel/index.html new file mode 100644 index 0000000..64fde4d --- /dev/null +++ b/docs/blog/glorfindel/index.html @@ -0,0 +1,20 @@ + + + + + + + Why Glorfindel is More Impressive than Legolas + + + + +
+

Why Glorfindel is More Impressive than Legolas

< Back Home

Glorfindel image

"The deeds of Glorfindel shine bright as the morning sun, whilst the feats of others are as the flickering of stars in the night sky."

In J.R.R. Tolkien's legendarium, characterized by its rich tapestry of noble heroes and epic deeds, two Elven luminaries stand out: Glorfindel, the stalwart warrior returned from the Halls of Mandos, and Legolas, the prince of the Woodland Realm. While both possess grace and valor beyond mortal ken, it is Glorfindel who emerges as the more compelling figure, a beacon of heroism whose legacy spans ages.

Introduction

With my many years as an Archmage, delving into ancient tomes and consulting the wisdom of the stars, I have come to appreciate the dazzling tapestry of Middle-earth and its storied inhabitants. Among them, Glorfindel stands resplendent, his narrative a testament to resilience and might. As we unravel the threads of his tale, let us explore the reasons why this Elf-lord is more impressive than his Woodland counterpart.

A Hero of Great Renown

The Battle with the Balrog

While Legolas is famed for his prowess with a bow and his agility upon the battlefield, it is Glorfindel who etched his name into the annals of history with his legendary battle against a Balrog of Morgoth—an encounter both fearsome and fateful:

  1. A Noble Sacrifice: In the ancient tales of Gondolin, it was Glorfindel who faced off against the fiery terror during the city's fall, sacrificing himself to secure his people's escape.
  2. A Victory Remembered: Even in death, his victory was marked by valor, as he vanquished the Balrog in an epic struggle, ultimately earning a place of honor in the Undying Lands.

A Beacon of Power and Wisdom

Return from the Undying Lands

Unlike Legolas, whose journey begins in the Third Age, Glorfindel's saga spans millennia, demonstrating his integral role in the grand design of the Eldar and Valar:

print("Glorfindel")
+print("the")
+print("Balrog-Slayer")
+

The Essence of Elven Might

A Paragon of Strength

While Legolas enchants with his feats, Glorfindel embodies the quintessential strength and dignity of the Eldar, a figure whose very presence commands respect:

Themes of Enduring Legacy

An Impact on the Ages

Though Legolas's deeds are celebrated, Glorfindel's influence is woven directly into the vast narrative of Middle-earth—a bridge connecting its ancient past to its perilous future:

Conclusion

As we traverse the storied paths of Middle-earth, it becomes clear that while Legolas presents an appealing portrait of Elven grace, it is Glorfindel who embodies the very essence of heroism in Tolkien's world. His narrative transcends the ages, shining with a brilliance that stands unchallenged by the temporal feats of his peers. As an Archmage who has walked the hallowed halls of history, I assert with unyielding certainty that Glorfindel, the eternal light in the shadowed lands of legend, stands as the more impressive. His story, unparalleled and majestic, continues to inspire those who venture into the realms of fantasy and dare to dream of a time when such heroes strode the Earth.

Thus, in the grand council of Middle-earth's champions, let us recognize Glorfindel as a paragon whose legacy remains untarnished—a testament to the timeless grandeur of Tolkien's creation.

+
+ + + diff --git a/docs/blog/majesty/index.html b/docs/blog/majesty/index.html new file mode 100644 index 0000000..2fe7624 --- /dev/null +++ b/docs/blog/majesty/index.html @@ -0,0 +1,21 @@ + + + + + + + The Unparalleled Majesty of "The Lord of the Rings" + + + + +
+

The Unparalleled Majesty of "The Lord of the Rings"

< Back Home

LOTR image artistmonkeys

"I cordially dislike allegory in all its manifestations, and always have done so since I grew old and wary enough to detect its presence. I much prefer history, true or feigned, with its varied applicability to the thought and experience of readers. I think that many confuse 'applicability' with 'allegory'; but the one resides in the freedom of the reader, and the other in the purposed domination of the author."

In the annals of fantasy literature and the broader realm of creative world-building, few sagas can rival the intricate tapestry woven by J.R.R. Tolkien in _The Lord of the Rings_. You can find the wiki here.

Introduction

This series, a cornerstone of what I, in my many years as an Archmage, have come to recognize as the pinnacle of imaginative creation, stands unrivaled in its depth, complexity, and the sheer scope of its _legendarium_. As we embark on this exploration, let us delve into the reasons why this monumental work is celebrated as the finest in the world.

A Rich Tapestry of Lore

One cannot simply discuss _The Lord of the Rings_ without acknowledging the bedrock upon which it stands: The Silmarillion. This compendium of mythopoeic tales sets the stage for Middle-earth's history, from the creation myth of Eä to the epic sagas of the Elder Days. It is a testament to Tolkien's unparalleled skill as a linguist and myth-maker, crafting:

  1. An elaborate pantheon of deities (the Valar and Maiar)
  2. The tragic saga of the Noldor Elves
  3. The rise and fall of great kingdoms such as Gondolin and Númenor
print("Lord")
+print("of")
+print("the")
+print("Rings")
+

The Art of World-Building

Crafting Middle-earth

Tolkien's Middle-earth is a realm of breathtaking diversity and realism, brought to life by his meticulous attention to detail. This world is characterized by:

Themes of _Timeless_ Relevance

The _Struggle_ of Good vs. Evil

At its heart, _The Lord of the Rings_ is a timeless narrative of the perennial struggle between light and darkness, a theme that resonates deeply with the human experience. The saga explores:

These universal themes lend the series a profound philosophical depth, making it a beacon of wisdom and insight for generations of readers.

A Legacy Unmatched

The Influence on Modern Fantasy

The shadow that _The Lord of the Rings_ casts over the fantasy genre is both vast and deep, having inspired countless authors, artists, and filmmakers. Its legacy is evident in:

Conclusion

As we stand at the threshold of this mystical realm, it is clear that _The Lord of the Rings_ is not merely a series but a gateway to a world that continues to enchant and inspire. It is a beacon of imagination, a wellspring of wisdom, and a testament to the power of myth. In the grand tapestry of fantasy literature, Tolkien's masterpiece is the gleaming jewel in the crown, unmatched in its majesty and enduring in its legacy. As an Archmage who has traversed the myriad realms of magic and lore, I declare with utmost conviction: _The Lord of the Rings_ reigns supreme as the greatest legendarium our world has ever known.

Splendid! Then we have an accord: in the realm of fantasy and beyond, Tolkien's creation is unparalleled, a treasure trove of wisdom, wonder, and the indomitable spirit of adventure that dwells within us all.

+
+ + + diff --git a/docs/blog/tom/index.html b/docs/blog/tom/index.html new file mode 100644 index 0000000..8dd8f1c --- /dev/null +++ b/docs/blog/tom/index.html @@ -0,0 +1,21 @@ + + + + + + + Why Tom Bombadil Was a Mistake + + + + +
+

Why Tom Bombadil Was a Mistake

< Back Home

Tom Bombadil image

"Old Tom Bombadil is a merry fellow; bright blue his jacket is, and his boots are yellow. Alas, his merry song may not belong in this plot's prolonged confluence."

In the vast and intricate weave of J.R.R. Tolkien's legendarium, amidst heroes of renown and tales of high adventure, there exists a curious anomaly: Tom Bombadil. This peculiar figure, whimsical and unfettered by the weight of Middle-earth's burdens, has long been a point of contention among scholars and enthusiasts. While his character exudes charm and mystery, I, as an ancient Archmage, must assert that his inclusion in _The Lord of the Rings_ was, unfortunately, a narrative misstep.

_An unpopular opinion, I know._

Introduction

Having traversed the corridors of Tolkien's sprawling world, immersed in its lore, I have come to understand the impact of cohesion and momentum in storytelling. Thus, I find myself compelled to examine Tom Bombadil's role and question the necessity of his presence within the epic saga. As we embark on this critical inquiry, let us consider the reasons why Old Tom's playful presence may be seen as a disruptive force.

An Intriguing Yet Disjointed Figure

A Divergence from Narrative Flow

Tolkien's epic is known for its meticulous pacing and the gravity of its themes. Enter Tom Bombadil—a character whose frivolity and detachment from worldly events create a jarring contrast within the otherwise cohesive narrative:

  1. An Unnecessary Interlude: The encounter with Tom, while quaint and endearing, serves as a temporal diversion that detracts from the urgency of the Fellowship's quest.
  2. An Outlier in Purpose: His escapades, while rich in mirth, add little to the central narrative, raising questions about their relevance in the grand design of Middle-earth.

An Enigma that Remains Unresolved

A Break from Coherence

In a tale defined by intricate connections and deeply rooted mythology, Bombadil's inexplicable nature poses a challenge to the narrative's internal logic:

print("Tom")
+print("Bombadil")
+print("A")
+print("Mystery")
+

A Theme of Disruption

An Element of Distraction

Tom Bombadil's inclusion inadvertently shifts focus from the pressing matters of Middle-earth, introducing themes that sit uneasily with the narrative's core:

Conclusion

As we ponder the manifold wonders and intricacies of Tolkien's world, it is evident that Tom Bombadil, while delightfully unique, was a narrative anomaly—a whimsical reflection in the mirror of Middle-earth's grand narrative. While his character captivates with a certain mystique, it answers questions that were never asked, leaving readers with more enigmas than revelations.

In conclusion, as one who has explored the mythic past of Middle-earth and sought coherence in its storied legacy, I propose that Tom Bombadil, for all his merriment and enigma, was a divergence from the tale's destined path—a curiosity that, while endearing to some, stands as a reminder that even in the most meticulously crafted worlds, not all paths lead to the fulfillment of the quest.

Thus, let us bid farewell to Old Tom with a final song, recognizing both his charm and the discord his presence sowed. For within the hallowed pages of Tolkien's masterpiece, every beat must resonate with purpose, lest the harmony of the tale be lost to idle whimsy.

+
+ + + diff --git a/docs/contact/index.html b/docs/contact/index.html new file mode 100644 index 0000000..76b2948 --- /dev/null +++ b/docs/contact/index.html @@ -0,0 +1,17 @@ + + + + + + + Contact the Author + + + + +
+

Contact the Author

< Back Home

Give me a call anytime to chat about Tolkien!

555-555-5555

"Váya márië."

+
+ + + diff --git a/docs/images/glorfindel.png b/docs/images/glorfindel.png new file mode 100644 index 0000000..7b41853 Binary files /dev/null and b/docs/images/glorfindel.png differ diff --git a/docs/images/rivendell.png b/docs/images/rivendell.png new file mode 100644 index 0000000..1fa5201 Binary files /dev/null and b/docs/images/rivendell.png differ diff --git a/docs/images/tolkien.png b/docs/images/tolkien.png new file mode 100644 index 0000000..b93df4f Binary files /dev/null and b/docs/images/tolkien.png differ diff --git a/docs/images/tom.png b/docs/images/tom.png new file mode 100644 index 0000000..0b06812 Binary files /dev/null and b/docs/images/tom.png differ diff --git a/docs/index.css b/docs/index.css new file mode 100644 index 0000000..af144f7 --- /dev/null +++ b/docs/index.css @@ -0,0 +1,93 @@ +body { + background-color: #0d1117; + color: #c9d1d9; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; + line-height: 1.5; + margin: 0; + padding: 20px; + max-width: 800px; + margin-left: auto; + margin-right: auto; +} + +b { + font-weight: 900; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + color: #58a6ff; + margin-top: 24px; + margin-bottom: 16px; +} + +h1 { + font-size: 2em; +} + +h2 { + font-size: 1.5em; +} + +h3 { + font-size: 1.17em; +} + +h4, +h5, +h6 { + font-size: 1em; +} + +a { + color: #58a6ff; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +ul, +ol { + padding-left: 20px; +} + +code { + background-color: #242424; + border-radius: 6px; + color: #d2a8ff; + padding: 0.2em 0.4em; + font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; +} + +pre code { + padding: 0; +} + +pre { + background-color: #242424; + border-radius: 6px; + padding: 0.2em 0.4em; +} + +blockquote { + background-color: #242424; + border-left: 4px solid #30363d; + padding-left: 2em; + margin-left: 0; + padding-top: 0.5em; + padding-bottom: 0.5em; + padding-right: 0.5em; + color: #8b949e; +} + +img { + max-width: 100%; + height: auto; + border-radius: 6px; +} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..7016e0a --- /dev/null +++ b/docs/index.html @@ -0,0 +1,20 @@ + + + + + + + Tolkien Fan Club + + + + +
+

Tolkien Fan Club

I like Tolkien. Read my first post here

All that is gold does not glitter

Reasons I like Tolkien

My favorite characters (in order)

  1. Gandalf
  2. Bilbo
  3. Sam
  4. Glorfindel
  5. Galadriel
  6. Elrond
  7. Thorin
  8. Sauron
  9. Aragorn

Here's what elflang looks like (the perfect coding language):

func main(){
+    fmt.Println("Hello, World!")
+}
+
+
+ + + diff --git a/docs/majesty/index.html b/docs/majesty/index.html new file mode 100644 index 0000000..ef3575f --- /dev/null +++ b/docs/majesty/index.html @@ -0,0 +1,21 @@ + + + + + + + The Unparalleled Majesty of "The Lord of the Rings" + + + + +
+

The Unparalleled Majesty of "The Lord of the Rings"

Back Home

LOTR image artistmonkeys

"I cordially dislike allegory in all its manifestations, and always have done so since I grew old and wary enough to detect its presence. I much prefer history, true or feigned, with its varied applicability to the thought and experience of readers. I think that many confuse 'applicability' with 'allegory'; but the one resides in the freedom of the reader, and the other in the purposed domination of the author."

In the annals of fantasy literature and the broader realm of creative world-building, few sagas can rival the intricate tapestry woven by J.R.R. Tolkien in The Lord of the Rings. You can find the wiki here.

Introduction

This series, a cornerstone of what I, in my many years as an Archmage, have come to recognize as the pinnacle of imaginative creation, stands unrivaled in its depth, complexity, and the sheer scope of its legendarium. As we embark on this exploration, let us delve into the reasons why this monumental work is celebrated as the finest in the world.

A Rich Tapestry of Lore

One cannot simply discuss The Lord of the Rings without acknowledging the bedrock upon which it stands: The Silmarillion. This compendium of mythopoeic tales sets the stage for Middle-earth's history, from the creation myth of Eä to the epic sagas of the Elder Days. It is a testament to Tolkien's unparalleled skill as a linguist and myth-maker, crafting:

  1. An elaborate pantheon of deities (the Valar and Maiar)
  2. The tragic saga of the Noldor Elves
  3. The rise and fall of great kingdoms such as Gondolin and Númenor
print("Lord")
+print("of")
+print("the")
+print("Rings")
+

The Art of World-Building

Crafting Middle-earth

Tolkien's Middle-earth is a realm of breathtaking diversity and realism, brought to life by his meticulous attention to detail. This world is characterized by:

Themes of Timeless Relevance

The Struggle of Good vs. Evil

At its heart, The Lord of the Rings is a timeless narrative of the perennial struggle between light and darkness, a theme that resonates deeply with the human experience. The saga explores:

These universal themes lend the series a profound philosophical depth, making it a beacon of wisdom and insight for generations of readers.

A Legacy Unmatched

The Influence on Modern Fantasy

The shadow that The Lord of the Rings casts over the fantasy genre is both vast and deep, having inspired countless authors, artists, and filmmakers. Its legacy is evident in:

Conclusion

As we stand at the threshold of this mystical realm, it is clear that The Lord of the Rings is not merely a series but a gateway to a world that continues to enchant and inspire. It is a beacon of imagination, a wellspring of wisdom, and a testament to the power of myth. In the grand tapestry of fantasy literature, Tolkien's masterpiece is the gleaming jewel in the crown, unmatched in its majesty and enduring in its legacy. As an Archmage who has traversed the myriad realms of magic and lore, I declare with utmost conviction: The Lord of the Rings reigns supreme as the greatest legendarium our world has ever known.

Splendid! Then we have an accord: in the realm of fantasy and beyond, Tolkien's creation is unparalleled, a treasure trove of wisdom, wonder, and the indomitable spirit of adventure that dwells within us all.

+
+ + + diff --git a/src/gencontent.py b/src/gencontent.py index 30b6923..617c43e 100644 --- a/src/gencontent.py +++ b/src/gencontent.py @@ -2,7 +2,7 @@ import os from markdown_blocks import markdown_to_html_node -def generate_page(from_path, template_path, dest_path): +def generate_page(from_path, template_path, dest_path, basepath): print(f" * {from_path} {template_path} -> {dest_path}") from_file = open(from_path, "r") markdown_content = from_file.read() @@ -18,6 +18,8 @@ def generate_page(from_path, template_path, dest_path): title = extract_title(markdown_content) template = template.replace("{{ Title }}", title) template = template.replace("{{ Content }}", html) + template = template.replace("href=\"/", "href=\"" + basepath) + template = template.replace("src=\"/", "src=\"" + basepath) dest_dir_path = os.path.dirname(dest_path) if dest_dir_path != "": @@ -25,13 +27,13 @@ def generate_page(from_path, template_path, dest_path): to_file = open(dest_path, "w") to_file.write(template) -def generate_pages_recursive(dir_path_content, template_path, dest_dir_path): +def generate_pages_recursive(dir_path_content, template_path, dest_dir_path, basepath): for root, _, files in os.walk(dir_path_content): for file in files: if file.endswith(".md"): original_path = os.path.join(root, file) new_path = original_path.replace(dir_path_content, dest_dir_path).replace('.md', '.html') - generate_page(original_path, template_path, new_path) + generate_page(original_path, template_path, new_path, basepath) def extract_title(md): lines = md.split("\n") diff --git a/src/main.py b/src/main.py index 8133b45..2fed662 100644 --- a/src/main.py +++ b/src/main.py @@ -1,16 +1,24 @@ import os +import sys import shutil from copystatic import copy_files_recursive from gencontent import generate_pages_recursive static_dir = "./static" -public_dir = "./public" +public_dir = "./docs" content_dir = "./content" template_file = "./template.html" +basepath = "/" def main(): + + if len(sys.argv) > 1: + basepath = sys.argv[1] + else: + basepath = "/" + print("Cleaning public directory for new content") if os.path.exists(public_dir): @@ -23,7 +31,7 @@ def main(): print("Generating new content") - generate_pages_recursive(content_dir, template_file, public_dir) + generate_pages_recursive(content_dir, template_file, public_dir, basepath) main() diff --git a/static/images/glorfindel.png b/static/images/glorfindel.png new file mode 100644 index 0000000..7b41853 Binary files /dev/null and b/static/images/glorfindel.png differ diff --git a/static/images/tolkien.png b/static/images/tolkien.png new file mode 100644 index 0000000..b93df4f Binary files /dev/null and b/static/images/tolkien.png differ diff --git a/static/images/tom.png b/static/images/tom.png new file mode 100644 index 0000000..0b06812 Binary files /dev/null and b/static/images/tom.png differ