Skip to content

Commit

Permalink
Update sbt-hepek
Browse files Browse the repository at this point in the history
  • Loading branch information
sake92 committed Nov 30, 2023
1 parent 47f5cae commit 2c17e37
Show file tree
Hide file tree
Showing 54 changed files with 809 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: hepek-docs/target/web/public/main/docs
FOLDER: hepek-docs/hepek_output
5 changes: 5 additions & 0 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
$VERSION="v0.16.0"
git tag -a $VERSION -m "Release $VERSION"
git push origin $VERSION


TODO napravit starter za dokumentaciju, sa gh pages npr


52 changes: 12 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import com.typesafe.sbt.web.Import.WebKeys

inThisBuild(
List(
organization := "ba.sake",
Expand All @@ -23,12 +21,10 @@ inThisBuild(
"-Yretain-trees",
"-Wunused:all"
),
resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)
)

// components
lazy val hepekComponents = crossProject(JVMPlatform, JSPlatform)
.in(file("hepek-components"))
.settings(
Expand All @@ -41,19 +37,19 @@ lazy val hepekComponents = crossProject(JVMPlatform, JSPlatform)
)
.jvmSettings(
libraryDependencies ++= Seq(
"com.vladsch.flexmark" % "flexmark" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-attributes" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-tables" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % V.flexmark,
"org.scalameta" %%% "munit" % V.munit % Test
"com.vladsch.flexmark" % "flexmark" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-attributes" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-tables" % V.flexmark,
"com.vladsch.flexmark" % "flexmark-ext-gfm-strikethrough" % V.flexmark,
"org.scalameta" %%% "munit" % V.munit % Test
)
)
.jsSettings()

// static-site-generator
lazy val hepekStatic = (project in file("hepek"))
lazy val hepekSSG = (project in file("hepek"))
.settings(
name := "hepek",
description := "Hepek SSG",
publish / skip := false,
libraryDependencies ++= Seq(
"ba.sake" % "hepek-core" % V.hepekCore,
Expand All @@ -67,40 +63,16 @@ lazy val hepekStatic = (project in file("hepek"))
)
.dependsOn(hepekComponents.jvm)

// docs
lazy val hepekDocs = (project in file("hepek-docs"))
.settings(
(Compile / hepek) := {
WebKeys.assets.value
(Compile / hepek).value
},
hepekIncremental := false,
openIndexPage := openIndexPageTask.value
)
.dependsOn(hepekStatic)
.enablePlugins(HepekPlugin, SbtWeb)
.dependsOn(hepekSSG)
.enablePlugins(HepekPlugin)

// tests
lazy val hepekTests = (project in file("hepek-tests"))
.settings(
(Test / test) := {
WebKeys.assets.value
(Compile / hepek).value // run hepek before tests
(Test / test).value
},
libraryDependencies ++= Seq(
"org.seleniumhq.selenium" % "selenium-java" % V.selenium % "test",
"org.scalameta" %%% "munit" % V.munit % Test
)
)
.dependsOn(hepekStatic)
.enablePlugins(HepekPlugin, SbtWeb)

val openIndexPage = taskKey[Unit]("Opens index.html")

val openIndexPageTask = Def.taskDyn {
Def.task {
java.awt.Desktop.getDesktop
.browse(new File(hepekTarget.value + "/docs/index.html").toURI)
}
}
.dependsOn(hepekSSG)
.enablePlugins(HepekPlugin)
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ object BootstrapFormComponents {
}

object BootstrapValidationStateClasses extends FormComponents.ValidationStateClasses {
override def success: AttrPair = cls := "is-valid"
override def warning: AttrPair = cls := "is-invalid"
override def error: AttrPair = cls := "is-invalid"
override def success: AttrPair = cls := "is-valid"
override def warning: AttrPair = cls := "is-invalid"
override def error: AttrPair = cls := "is-invalid"
override def successFeedback: AttrPair = cls := "valid-feedback"
override def warningFeedback: AttrPair = cls := "invalid-feedback"
override def errorFeedback: AttrPair = cls := "invalid-feedback"
Expand Down Expand Up @@ -53,9 +53,11 @@ final case class BootstrapFormComponents(
inputTransform: Frag => Frag
) = {
val commonAttrs =
Seq(cls := "form-control", inputType, inputName) ++ inputId.map(id := _) ++ inputValidationState.map(_.clazz) ++ inputAttrs
val inputHelpFrag = inputHelp.map(h => span(inputValidationState.map(_.feedbackClazz))(h))
val inputMsgsFrag = inputMessages.map(m => span(inputValidationState.map(_.feedbackClazz))(m))
Seq(cls := "form-control", inputType, inputName) ++ inputId.map(
id := _
) ++ inputValidationState.map(_.clazz) ++ inputAttrs
val inputHelpFrag = inputHelp.map(h => span(inputValidationState.map(_.feedbackClazz))(h))
val inputMsgsFrag = inputMessages.map(m => span(inputValidationState.map(_.feedbackClazz))(m))
val inputFrag =
if (inputType.v == "textarea") textarea(commonAttrs)("") // TODO
else input(commonAttrs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ object FormComponents {
trait Type { def classes: List[String] = List.empty }

trait ValidationStateClasses {
def success: AttrPair = cls := "success"
def warning: AttrPair = cls := "warning"
def error: AttrPair = cls := "error"
def success: AttrPair = cls := "success"
def warning: AttrPair = cls := "warning"
def error: AttrPair = cls := "error"
def successFeedback: AttrPair = cls := "success"
def warningFeedback: AttrPair = cls := "warning"
def errorFeedback: AttrPair = cls := "error"
Expand Down Expand Up @@ -706,27 +706,27 @@ trait FormComponents {
)
}

sealed trait ValidationState {
def clazz: AttrPair
sealed trait ValidationState {
def clazz: AttrPair
def feedbackClazz: AttrPair
}

object ValidationState {

case object Success extends ValidationState {
override def clazz = validationStateClasses.success
override def clazz = validationStateClasses.success
override def feedbackClazz = validationStateClasses.successFeedback
}

case object Warning extends ValidationState {
override def clazz = validationStateClasses.warning
override def clazz = validationStateClasses.warning
override def feedbackClazz = validationStateClasses.warningFeedback
}

case object Error extends ValidationState {
override def clazz = validationStateClasses.error
override def clazz = validationStateClasses.error
override def feedbackClazz = validationStateClasses.errorFeedback
}

}
}
21 changes: 21 additions & 0 deletions hepek-docs/hepek_output/404.html

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions hepek-docs/hepek_output/hepek/blog-page.html

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions hepek-docs/hepek_output/hepek/components/bundle-docs.html

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions hepek-docs/hepek_output/hepek/components/code-highlighter.html

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions hepek-docs/hepek_output/hepek/components/dependencies.html

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions hepek-docs/hepek_output/hepek/components/grid-support.html

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions hepek-docs/hepek_output/hepek/components/html-page.html

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions hepek-docs/hepek_output/hepek/components/index.html

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions hepek-docs/hepek_output/hepek/components/math-support.html

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions hepek-docs/hepek_output/hepek/index.html

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions hepek-docs/hepek_output/hepek/multi-page.html

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions hepek-docs/hepek_output/hepek/pdf-generator.html

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions hepek-docs/hepek_output/hepek/quick-start.html

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions hepek-docs/hepek_output/hepek/static-bundle.html

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions hepek-docs/hepek_output/hepek/static-page.html

Large diffs are not rendered by default.

File renamed without changes.
18 changes: 18 additions & 0 deletions hepek-docs/hepek_output/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="ie=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="generator" content="hepek" /><meta name="theme-color" content="#000" /><meta name="mobile-web-app-capable" content="yes" /><meta name="description" content="Hepek docs" /><meta name="og:title" content="hepek" /><title>Welcome! - hepek</title><link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" /><link rel="stylesheet" href="https://unpkg.com/bootswatch@5.3.2/dist/yeti/bootstrap.min.css" /><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css" /><link rel="stylesheet" href="styles/main.css" /><style>
.affix {
position: fixed;
width: 10%;
}
</style></head><body><nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top"><div class="container-fluid"><a class="navbar-brand" href="index.html"><span><img src="images/favicon.ico" alt="logo" width="32" height="32" /></span> hepek</a><button type="button" class="navbar-toggler collapsed" data-bs-toggle="collapse" data-bs-target="#main-navbar"><span class="navbar-toggler-icon"></span></button><div class="collapse navbar-collapse" id="main-navbar"><ul class="navbar-nav"></ul><ul class="navbar-nav ms-auto"><li class="nav-item"><a href="hepek/components/index.html" class=" nav-link">Hepek Components</a></li><li class="nav-item"><a href="hepek/index.html" class=" nav-link">Hepek SSG</a></li></ul></div></div></nav><div class="container-fluid"><div class="page-header text-center"><h1>Welcome!</h1></div><div class="row"><div class="col-lg-2 col-md-2 invisible"></div><div class="col-lg-8 col-md-8"><p>Hepek is a collection of useful projects for typesafe HTML construction:</p>
<ul>
<li><a href="hepek/components/index.html">Components</a></li>
<li><a href="hepek/index.html">Static site generator</a></li>
</ul>
<p>Components can be used in <strong>any project</strong>. This project has minimal dependencies.<br />
If you need grid, form inputs, panels, navbars, markdown, code highlighting, maths rendering and lots more,
this is the library you're looking for.<br />
It supports frameworks like Bootstrap, Bulma etc.<br />
You write generic code, and it <em>compiles to Bootstrap</em>!<br />
You can easily switch to a different framework and <em>override</em> parts you don't like. :)</p>
<p>SSG has support for automatic relative links, PDF rendering and lots more.</p>
</div><div class="col-lg-2 col-md-2 invisible"></div></div><footer class="text-center bg-info fixed-bottom"><a href="https://github.com/sake92/hepek" class="btn"><i class="fa-github fab"></i></a><a href="https://gitter.im/sake92/hepek" class="btn"><i class="fa-gitter fab"></i></a></footer></div><script src="https://unpkg.com/bootstrap@5.3.2/dist/js/bootstrap.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/js/all.js"></script><script src="scripts/main.js"></script></body></html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions hepek-docs/src/main/resources/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Disallow: /scripts/
Disallow: /styles/
Disallow: /lib/
6 changes: 6 additions & 0 deletions hepek-docs/src/main/resources/public/scripts/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

var parent = "section";
for (i = 1; i <= 6; i++) {
// CSS selectors "section h1", "section h2" ...
anchors.add(parent + ' h' + i);
}
42 changes: 42 additions & 0 deletions hepek-docs/src/main/resources/public/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

body {
font-size: 16px;
padding-bottom: 33px;
padding-top: 4.5rem; /* fixed top navbar */
}

.navbar-brand {
padding: 10px 15px;
}
.navbar-brand img {
width: 24px;
height: auto;
}

/* default SVG maximum height */
object[type="image/svg+xml"] {
max-height: 300px;
width: 100%;
}

.pages-toc ul {
list-style: none;
}

.pages-toc > ul > li > a {
font-weight: bold;
font-size: 17px;
}

/* prismjs sets 0.3em and then we get unnecessary horizontal slider. This fixes it. */
pre[class*="language-"] {
border-width: 0.3rem !important;
}

/* anchor offset when clicking it :) https://stackoverflow.com/a/22655654/4496364 */
:target:before {
content: "";
display: block;
height: 50px;
margin: -50px 0 0;
}
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/Index.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs
package files

import utils.Imports.Bundle.*, Tags.*, Grid.*, Classes.*

Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/NotFound404.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs
package files

import ba.sake.hepek.core.RelativePath
import ba.sake.hepek.scalatags.all._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils.Imports._
import utils.Imports.Bundle.*, Tags.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils.*
import utils.Imports.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils._
import utils.Imports._
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek-components/Grid.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils._
import utils.Imports._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import ba.sake.hepek.html.statik.BlogPostPage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils._
import utils.Imports._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import utils.Imports.Bundle.*, Tags.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek.components
package files.hepek.components

import ba.sake.hepek.katex.KatexDependencies
import utils.Imports.Bundle.*, Tags.*
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/BlogPage.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/HepekDocsPage.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import ba.sake.hepek.html.statik.BlogPostPage

Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/Index.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.Imports.Bundle.*, Tags.*

Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/MultiPage.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/PdfGenerator.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down
4 changes: 2 additions & 2 deletions hepek-docs/src/main/scala/docs/hepek/QuickStart.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down Expand Up @@ -32,7 +32,7 @@ object QuickStart extends HepekDocsPage {
You can also make sbt **watch for file changes**.
Just type `~hepek` and you'll see changes applied.

> HTML/CSS or whatever you're rendering will be in `/target/web/public/main/site` folder.
> HTML/CSS or whatever you're rendering will be in `hepek_files` folder.
> You can make an sbt task for copying these to a more desirable location.
> Or you can use `sbt-ghpages` for even faster deployment!
""".md
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/StaticBundle.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down
2 changes: 1 addition & 1 deletion hepek-docs/src/main/scala/docs/hepek/StaticPage.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package docs.hepek
package files.hepek

import utils.*
import utils.Imports.*
Expand Down
Loading

0 comments on commit 2c17e37

Please sign in to comment.