Skip to content

Commit

Permalink
chore: split blog genre into independent library
Browse files Browse the repository at this point in the history
  • Loading branch information
david-christiansen committed Dec 6, 2023
1 parent 558ae83 commit 2ff3351
Show file tree
Hide file tree
Showing 42 changed files with 58 additions and 59 deletions.
3 changes: 1 addition & 2 deletions BlogContents.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import LeanDoc
import LeanDoc.Doc.Html
import LeanDoc.Genre
import LeanDoc.Genre.Blog

import BlogContents.Pages.Front
import BlogContents.Pages.Mission
Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Blog.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)
open LeanDoc.Genre.Blog (page_link)
Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Contact.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)

Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Front.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)

Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Links.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)
open LeanDoc.Genre.Blog (page_link)
Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Mission.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)
open LeanDoc.Genre.Blog (page_link)
Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Roadmap.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)

Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Pages/Team.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre (Blog)
open LeanDoc.Genre.Blog (page_link htmlSpan htmlDiv blob)
Expand Down
2 changes: 1 addition & 1 deletion BlogContents/Posts/AnExcellentPost.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre

Expand Down
12 changes: 6 additions & 6 deletions BlogContents/Posts/AnotherPost.lean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LeanDoc
import LeanDoc.Genre.Blog

open LeanDoc.Genre
open LeanDoc.Genre.Blog (label ref lean leanInit)
Expand Down Expand Up @@ -83,8 +83,8 @@ Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. Etiam vel t

Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. Etiam vel tortor sodales tellus ultricies commodo. Suspendisse potenti. Aenean in sem ac leo mollis blandit. Donec neque quam, dignissim in, mollis nec, sagittis eu, wisi. Phasellus lacus. Etiam laoreet quam sed arcu. Phasellus at dui in ligula mollis ultricies. Integer placerat tristique nisl. Praesent augue. Fusce commodo. Vestibulum convallis, lorem a tempus semper, dui dui euismod elit, vitae placerat urna tortor vitae lacus. Nullam libero mauris, consequat quis, varius et, dictum id, arcu. Mauris mollis tincidunt felis. Aliquam feugiat tellus ut neque. Nulla facilisis, risus a rhoncus fermentum, tellus tellus lacinia purus, et dictum nunc justo sit amet elit.

* Praesent fermentum tempor tellus.
* Pellentesque tristique imperdiet tortor.
* Nam euismod tellus id erat.
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
* Nullam tempus.
1. Praesent fermentum tempor tellus.
2. Pellentesque tristique imperdiet tortor.
3. Nam euismod tellus id erat.
4. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
5. Nullam tempus.
1 change: 0 additions & 1 deletion DemoBlog.lean
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BlogContents
import LeanDoc

open LeanDoc.Genre.Blog

Expand Down
7 changes: 0 additions & 7 deletions LeanDoc/Basic.lean

This file was deleted.

5 changes: 0 additions & 5 deletions LeanDoc/Genre/Blog.lean

This file was deleted.

6 changes: 5 additions & 1 deletion Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ Copyright (c) 2023 Lean FRO LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: David Thrane Christiansen
-/
import LeanDoc
import LeanDoc.Doc.Elab
import LeanDoc.Doc.Html
import LeanDoc.Output
import LeanDoc.Output.Html
import LeanDoc.Doc.Concrete

open LeanDoc Doc Output Html Concrete ToHtml Elab Monad
open Lean Elab Term
Expand Down
8 changes: 7 additions & 1 deletion lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ require std from git "https://github.com/leanprover/std4" @ "main"
package «leandoc» where
-- add package configuration options here

lean_lib «LeanDoc» where
lean_lib LeanDoc where
srcDir := "src/leandoc"
roots := #[`LeanDoc.Doc, `LeanDoc.Output, `LeanDoc.Parser, `LeanDoc.Examples, `LeanDoc.Method, `LeanDoc.Syntax, `LeanDoc.SyntaxUtils]
-- add library configuration options here

lean_lib LeanBlog where
srcDir := "src/leanblog"
roots := #[`LeanDoc.Genre.Blog]

@[default_target]
lean_exe «leandoc» where
root := `Main
Expand Down
33 changes: 7 additions & 26 deletions LeanDoc/Genre.lean → src/leanblog/LeanDoc/Genre/Blog.lean
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import Lean.Data.RBMap

import LeanDoc.Doc
import LeanDoc.Doc.Html

import LeanDoc.Genre.Blog
import LeanDoc.Genre.Blog.Basic
import LeanDoc.Genre.Blog.Generate
import LeanDoc.Genre.Blog.Highlighted
import LeanDoc.Genre.Blog.HighlightCode
import LeanDoc.Genre.Blog.Site
import LeanDoc.Genre.Blog.Site.Syntax

import LeanDoc.Output.Html


open LeanDoc.Doc (Genre Part)
open LeanDoc.Doc.Html

namespace LeanDoc.Genre


namespace Blog

import LeanDoc.Genre.Blog.Template
import LeanDoc.Genre.Blog.Theme
open LeanDoc.Output Html
open Lean (RBMap)

section
namespace LeanDoc.Genre.Blog

open Lean Elab
open LeanDoc Doc Elab
Expand Down Expand Up @@ -158,8 +146,6 @@ def lean : CodeBlockExpander
pure #[← ``(Block.other (Blog.BlockExt.highlightedCode $(quote x.getId) $(quote hls)) #[Block.code none #[] 0 $(quote str.getString)])]
| otherArgs, str => throwErrorAt str "Unexpected arguments {repr otherArgs}"

end

private def filterString (p : Char → Bool) (str : String) : String := Id.run <| do
let mut out := ""
for c in str.toList do
Expand All @@ -183,8 +169,3 @@ where
| ("--drafts"::more) => opts {cfg with showDrafts := true} more
| (other :: _) => throw (↑ s!"Unknown option {other}")
| [] => pure cfg

end Blog
namespace Manual

end Manual
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions LeanDoc.lean → src/leandoc/LeanDoc.lean
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
-- This module serves as the root of the `Leandoc` library.
-- This module serves as the root of the `LeanDoc` library.
-- Import modules here that should be built as part of the library.
import LeanDoc.Basic
import LeanDoc.Doc.Concrete
import LeanDoc.Doc.Elab
import LeanDoc.Doc.Elab.Monad
import LeanDoc.Doc.Html
import LeanDoc.Doc.Lsp
import LeanDoc.Genre
import LeanDoc.Parser
import LeanDoc.Output.Html
23 changes: 23 additions & 0 deletions src/leandoc/LeanDoc/Build.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Lean

import LeanDoc.Doc

namespace LeanDoc.Build

namespace Traverse
-- In the traverse pass, we propagate information between nodes in the
-- document Additionally, nodes may transform themselves in response
-- to the information that's been gained.

-- A given genre will fix its type of traversal values. Additionally,
-- all genres support dynamically-typed entries to facilitate
-- cross-genre libraries.

structure TraversalState.{u} where
Value : Type u
contents : Lean.RBMap String (Value ⊕ Dynamic) compare




end Traverse
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2ff3351

Please sign in to comment.