Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BibtexQuery.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import BibtexQuery.Query
import BibtexQuery.String
import BibtexQuery.Name
import BibtexQuery.Format
import BibtexQuery.Xml
4 changes: 2 additions & 2 deletions BibtexQuery/Format.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author: Jz Pan

import BibtexQuery.Name
import BibtexQuery.Entry
import Lean.Data.Xml.Basic
import BibtexQuery.Xml
import Std.Data.HashMap
import Std.Internal.Parsec
import Std.Internal.Parsec.String
Expand All @@ -20,7 +20,7 @@ tag generating and sorting.

-/

open Lean Xml Std.Internal.Parsec Unicode BibtexQuery.TexDiacritics BibtexQuery.Name
open BibtexQuery.Xml Std.Internal.Parsec Unicode BibtexQuery.TexDiacritics BibtexQuery.Name

namespace BibtexQuery

Expand Down
2 changes: 1 addition & 1 deletion BibtexQuery/Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spaces and special characters before the queries are performed. In addition, the
firstnamelastname. Hence, for example, "Dupuis, Frédéric" will match the query `a.ericdup`.
-/

open Lean BibtexQuery
open BibtexQuery BibtexQuery.Xml

def listDoublons (parseRes : List BibtexQuery.Entry) : List String :=
let keysOnly := parseRes.filterMap (fun entry => match entry with
Expand Down
2 changes: 1 addition & 1 deletion BibtexQuery/Name.lean
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ return an array of `BibtexName`.

-/

open Lean Unicode BibtexQuery.TexDiacritics
open BibtexQuery.Xml Unicode BibtexQuery.TexDiacritics

namespace BibtexQuery.Name

Expand Down
6 changes: 3 additions & 3 deletions BibtexQuery/TexDiacritics.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author: Jz Pan

import Std.Internal.Parsec
import Std.Internal.Parsec.String
import Lean.Data.Xml.Basic
import BibtexQuery.Xml
import UnicodeBasic

/-!
Expand All @@ -20,7 +20,7 @@ and preserve other TeX commands.

-/

open Lean Xml Std.Internal.Parsec Std.Internal.Parsec.String Unicode
open BibtexQuery.Xml Std.Internal.Parsec Std.Internal.Parsec.String Unicode

namespace BibtexQuery.TexDiacritics

Expand Down Expand Up @@ -131,7 +131,7 @@ mutual

open Std.TreeMap

/-- Convert a TeX content to HTML, represented by an array of `Lean.Xml.Content`.
/-- Convert a TeX content to HTML, represented by an array of `Xml.Content`.
A few TeX commands can be converted to corresponding HTML. -/
partial def toHtml (x : TexContent) : Array Content :=
match x with
Expand Down
51 changes: 51 additions & 0 deletions BibtexQuery/Xml.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/-
Copyright (c) 2021 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Dany Fabian

These types were previously part of Lean.Data.Xml.Basic in the Lean 4 core,
removed in https://github.com/leanprover/lean4/pull/12302.
Inlined here for BibtexQuery's use.
-/

import Std.Data.TreeMap.Basic

namespace BibtexQuery.Xml

def Attributes := Std.TreeMap String String compare

mutual

inductive Element where
| Element
(name : String)
(attributes : Attributes)
(content : Array Content)

inductive Content where
| Element (element : Element)
| Comment (comment : String)
| Character (content : String)
deriving Inhabited

end

mutual

partial def Element.toString : Element → String
| .Element n a c =>
let inner := c.map Content.toString |>.toList |> String.join
let attrs := a.foldl (init := "") fun acc k v => acc ++ s!" {k}=\"{v}\""
s!"<{n}{attrs}>{inner}</{n}>"

partial def Content.toString : Content → String
| .Element e => e.toString
| .Comment c => s!"<!--{c}-->"
| .Character s => s

end

instance : ToString Element := ⟨Element.toString⟩
instance : ToString Content := ⟨Content.toString⟩

end BibtexQuery.Xml
4 changes: 2 additions & 2 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "git",
"subDir": null,
"scope": "",
"rev": "ff04f5c424e50e23476d3539c7c0cc4956e971ad",
"rev": "9484dd63d30bce157c7f98007a9f26ca4dfb7fb6",
"name": "UnicodeBasic",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inputRev": "v4.29.0-rc1",
"inherited": false,
"configFile": "lakefile.lean"}],
"name": "BibtexQuery",
Expand Down
2 changes: 1 addition & 1 deletion lakefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defaultTargets = ["BibtexQuery", "«bibtex-query»"]
[[require]]
name = "UnicodeBasic"
git = "https://github.com/fgdorais/lean4-unicode-basic"
rev = "main"
rev = "v4.29.0-rc1"

[[lean_lib]]
name = "BibtexQuery"
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:v4.28.0
leanprover/lean4:v4.29.0-rc1