Skip to content
Permalink
Browse files

initial import

  • Loading branch information...
devnewton committed Sep 13, 2018
0 parents commit abfc8ee648f172fa6306cb1c2183920b2e96b96f
Showing with 8,569 additions and 0 deletions.
  1. +5 −0 CHANGELOG.md
  2. +21 −0 LICENSE
  3. +56 −0 README.md
  4. +178 −0 backend2html.pegjs
  5. +39 −0 blueprints.yaml
  6. +8 −0 languages.yaml
  7. +7,924 −0 peg-0.10.0.js
  8. +113 −0 tribune.css
  9. +65 −0 tribune.js
  10. +151 −0 tribune.php
  11. +9 −0 tribune.yaml
@@ -0,0 +1,5 @@
# v0.1.0
## 09/12/2018

1. [](#new)
* ChangeLog started...
21 LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 devnewton

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.
@@ -0,0 +1,56 @@
# Tribune Plugin

**This README.md file should be modified to describe the features, installation, configuration, and general usage of this plugin.**

The **Tribune** Plugin is for [Grav CMS](http://github.com/getgrav/grav). Tribune/shoutbox/webchat plugin

## Installation

Installing the Tribune plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

### GPM Installation (Preferred)

The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:

bin/gpm install tribune

This will install the Tribune plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/tribune`.

### Manual Installation

To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `tribune`. You can find these files on [GitHub](https://github.com/devnewton/grav-plugin-tribune) or via [GetGrav.org](http://getgrav.org/downloads/plugins#extras).

You should now have all the plugin files under

/your/site/grav/user/plugins/tribune

> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) and the [Error](https://github.com/getgrav/grav-plugin-error) and [Problems](https://github.com/getgrav/grav-plugin-problems) to operate.
### Admin Plugin

If you use the admin plugin, you can install directly through the admin plugin by browsing the `Plugins` tab and clicking on the `Add` button.

## Configuration

Before configuring this plugin, you should copy the `user/plugins/tribune/tribune.yaml` to `user/config/plugins/tribune.yaml` and only edit that copy.

Here is the default configuration and an explanation of available options:

```yaml
enabled: true
```

Note that if you use the admin plugin, a file with your configuration, and named tribune.yaml will be saved in the `user/config/plugins/` folder once the configuration is saved in the admin.

## Usage

**Describe how to use the plugin.**

## Credits

**Did you incorporate third-party code? Want to thank somebody?**

## To Do

- [ ] Future plans, if any

@@ -0,0 +1,178 @@
{
var backend2html = {};
backend2html.tagStack = [];

backend2html.encode = function encode(e) {
return e.replace(/[.]/g, function(e) {
return "&#"+e.charCodeAt(0)+";";
});
};

}

post
= items:postItem*
{
var result = items.join("");
while(backend2html.tagStack.length > 0) {
result += "</" + backend2html.tagStack.pop() + ">";
}
return result;
}

postItem
= url
/ totoz
/ bigorno
/ norloge
/ openTag
/ closeTag
/ xmlSpecialChar
/ .

xmlSpecialChar
= (lt / gt / amp / quot / apos)

lt
= "<"
{ return "&lt;"; }

gt
= ">"
{ return "&gt;"; }

amp
= "&"
{ return "&amp;"; }

quot
= '"'
{ return "&quot;"; }

apos
= "'"
{ return "&apos;"; }

url
= protocol:$((("http" "s"?) / "ftp") "://") url:$([^< \t\r\n])+
{ return [].concat('<a href="', protocol, encodeURI(url), '" target="_blank" rel="noreferrer">url</a>').join("");}

openTag
= "<" tag:validFormatTag ">"
{
backend2html.tagStack.push(tag);
return "<" + tag + ">";
}

closeTag
= "</" tag:validFormatTag ">"
{
var result = "";
for(;;) {
var poppedTag = backend2html.tagStack.pop();
if(poppedTag == undefined) {
break;
}
if( poppedTag == tag) {
result += "</" + tag + ">";
break;
} else {
result += "</" + poppedTag + ">";
}
}
return result;
}

validFormatTag
= (spoiler / "b" / "i" / "s" / "u" / "tt" / "code" )

spoiler
= "spoiler"
{ return "mark"; }

invalidOpenTag
= "<" tag:invalidTag ">"
{ return "&lt" + tag + "&gt"; }

invalidCloseTag
= "</" tag:invalidTag ">"
{ return "&lt/" + tag + "&gt"; }

invalidTag
= [A-Za-z] (xmlSpecialChar / [^>])*

tagAttributes
= attributes:(separator:" " attribute:tagAttribute { return attribute;})*
{ var result = {};
for(var a in attributes) {
result[attributes[a].name] = attributes[a].value;
}
return result;
}

tagAttribute
= name:$[a-z]+ value:("=\"" value:$[^"]* "\"" {return value;} )?
{return { name: name, value: value}}

norloge
= fullNorloge / normalNorloge / shortNorloge

fullNorloge
= y: norlogeYear "-" m: norlogeMonth "-" d:norlogeDay [T# ] h:norlogeHours ":" mi:norlogeMinutes ":" s:norlogeSeconds
{
var time = h + ':' + mi + ':' + s;
return '<time title="' + y + "-" + m + "-" + d + "T" + time + '">' + time + '</time>';
}

norlogeYear
= digits: [0-9]+
{ return digits.join(""); }

norlogeMonth
= first: [0-1] last: [0-9]
{ return first + last; }

norlogeDay
= first: [0-3] last: [0-9]
{ return first + last; }

normalNorloge
= h:norlogeHours ":" mi:norlogeMinutes ":" s:norlogeSeconds
{
var time = h + ':' + mi + ':' + s;
return '<time title="' + time + '">' + time + '</time>';
}

shortNorloge
= h:norlogeHours ":" mi:norlogeMinutes
{
var time = h + ':' + mi;
return '<time title="' + time + '">' + time + '</time>';
}

norlogeHours
= first: [0-2] last: [0-9]
{ return first + last; }

norlogeMinutes
= first: [0-5] last: [0-9]
{ return first + last; }

norlogeSeconds
= first: [0-5] last: [0-9]
{ return first + last; }

bigorno
= spaces:$(inputStart / whitespaces) s2:whitespaces? bigorno:$[a-zA-Z0-9-_]+ "<" &(whitespaces / [<[] / !.)
{ return spaces + '<cite>' + bigorno + '</cite>';}

totoz
= first:"[:" totoz:[^\]]+ third:"]"
{ var totozId = totoz.join("");
return '<figure>' + backend2html.encode(totozId) + '<img src="https://totoz.eu/img/' + encodeURI(totozId) + '"></figure>'; }

whitespaces
= [ \t\r\n]

inputStart
= & { return location().start.offset == 0; }
@@ -0,0 +1,39 @@
name: Tribune
version: 0.1.0
description: Tribune/shoutbox/webchat plugin
icon: plug
author:
name: devnewton
email: devnewton@bci.im
homepage: https://github.com/devnewton/grav-plugin-tribune
demo: http://perdu.com
keywords: grav, plugin, etc
bugs: https://github.com/devnewton/grav-plugin-tribune/issues
docs: https://github.com/devnewton/grav-plugin-tribune/blob/develop/README.md
license: MIT

form:
validation: strict
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
highlight: 1
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
page:
type: text
label: PLUGIN_TRIBUNE.PAGE_VARIABLE
help: PLUGIN_TRIBUNE.PAGE_VARIABLE_HELP
style:
type: toggle
default: 1
options:
1: PLUGIN_TRIBUNE.STYLE_ENABLED
0: PLUGIN_TRIBUNE.STYLE_DISABLED
label: PLUGIN_TRIBUNE.STYLE_VARIABLE
help: PLUGIN_TRIBUNE.STYLE_VARIABLE_HELP
@@ -0,0 +1,8 @@
en:
PLUGIN_TRIBUNE:
PAGE_VARIABLE: Page
PAGE_VARIABLE_HELP: Page where tribune will be visible
STYLE_VARIABLE: Style
STYLE_VARIABLE_HELP: Style tribune with default embedded CSS or not
STYLE_ENABLED: Default
STYLE_DISABLED: None
Oops, something went wrong.

0 comments on commit abfc8ee

Please sign in to comment.
You can’t perform that action at this time.