Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from jumpper/beta/0.0.8
Browse files Browse the repository at this point in the history
New components html base

- Doctype
- Body
- Head
- Html
- LinkStylesheet
- Link
- Meta
- Script
- Title
- Footer
- Header
  • Loading branch information
micheltlutz authored Apr 6, 2021
2 parents bc514bf + 8c7a5cd commit f800d1f
Show file tree
Hide file tree
Showing 220 changed files with 14,033 additions and 332 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<img src="https://codebeat.co/badges/31d5d9f4-77af-4e51-9523-30f55ae9a069" alt="codebeat badge" />
</a>
</p>

<p align="center">
<a href="https://www.buymeacoffee.com/micheltlutz" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
</p>
-----

Welcome to **jumpper**. Is an open source framework, which is independent of other web frameworks or toolkits available on the market, such as Vapor, Kitura and Perfect. It can be used in conjunction with any of them and even alone. This shows how simple it is to build HTML pages using only **Swift**.
Expand Down
File renamed without changes.
41 changes: 41 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/Body.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
Body tag element class

### Usage Example: ###
````
let body = Body()
body.add(/* Any Element*/)
````
*/
public final class Body: ContainerElementBase {
/// Override tag element. Default is `body`
override var tag: String {
return "body"
}
}
50 changes: 50 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/Doctype.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
DOCTYPE tag element class

### Usage Example: ###
````
let doctype = Doctype()
doctype.getString() // or doctype.generate()
````
*/
public final class Doctype: ElementProtocol {
private let tag: String

public init() {
tag = "<!DOCTYPE html>"
}

public func getString() -> String {
return tag
}

public func generate() {
print(tag)
}
}
41 changes: 41 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/Head.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
Head tag element class

### Usage Example: ###
````
let head = Head()
head.add(/* Any Element*/)
````
*/
public final class Head: ContainerElementBase {
/// Override tag element for element. Default is `head`
override var tag: String {
return "head"
}
}
41 changes: 41 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/Html.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
Html tag element class

### Usage Example: ###
````
let html = Html()
html.add(/* Any Element*/)
````
*/
public final class Html: ContainerElementBase {
/// Override tag element. Default is `html`
override var tag: String {
return "html"
}
}
46 changes: 46 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/LinkStylesheet.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
Link stylesheet tag element class

### Usage Example: ###
````
let linkCssTag = LinkStylesheet("/styles/milligram.min.css")
````
*/
public class LinkStylesheet: Link {
// MARK: - Initialization
/// Default initializer element
/// - Parameters:
/// - href: This is a src attribute for link **href** `String`
/// - attributes: This is a attr **attributes** `AttributeType...` CVarArg
public init(_ href: String) {
super.init(href)

addAttribute(("rel", "stylesheet"))
}
}
51 changes: 51 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/LinkTag.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
link tag element class

### Usage Example: ###
````
let linkTag = Link("/styles/milligram.min.css", attributes: ("rel", "stylesheet"))
````
*/
public class Link: GenericElement {
///Override tag element for element. Default is `link`
override var tag: String {
return "link"
}

// MARK: - Initialization
/// Default initializer element
/// - Parameters:
/// - href: This is a src attribute for link **href** `String`
/// - attributes: This is a attr **attributes** `AttributeType...` CVarArg
public init(_ href: String, attributes: AttributeType...) {
super.init(attributes)

addAttribute(("href", href))
}
}
48 changes: 48 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/MetaTag.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
Meta tag element class

### Usage Example: ###
````
let meta = Meta(("charset", "utf-8")))
````
*/
public class Meta: GenericElement {
/// Override tag element for element. Default is `meta`
override var tag: String {
return "meta"
}

// MARK: - Initialization
/// Default initializer
/// - Parameters:
/// - attributes: This is a **attributes** `AttributeType...` CVarArg
public override init(_ attributes: AttributeType...) {
super.init(attributes)
}
}
53 changes: 53 additions & 0 deletions Sources/jumpper/HTML/Tags/Document/ScriptTag.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// MIT License
//
// Copyright (c) 2020 micheltlutz
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//

import Foundation

/**
This class define a Script element

### Usage Example: ###
````
let script = Script()
script.add("var myJsVar = 1")

let script = Script(("src","myScript.js"))
````
*/
public final class Script: GenericElement {
///Override tag element for option. Default is `script`
override var tag: String {
return "script"
}
/// Override container element defaults is `true`
override var container: Bool {
return true
}
/// This method add a text in script body element
/// - Parameters:
/// - text: This is a content for tag **text** `String`
public func add(_ text: String) {
objects.append(Text(text))
}
}
Loading

0 comments on commit f800d1f

Please sign in to comment.