add some forumoji
@@ -31,3 +31,10 @@ Copyright: Gabriele Malaspina
 | 
			
		||||
Designers: Gabriele Malaspina  
 | 
			
		||||
License: CC0 1.0/CC BY 4.0  
 | 
			
		||||
CC BY 4.0 compliance: Modified to indicate the URL. Modified size.
 | 
			
		||||
 | 
			
		||||
## Forumoji
 | 
			
		||||
 | 
			
		||||
Affected files: everything in [`data/static/emoji`](./data/static/emoji)
 | 
			
		||||
URL: https://gh.vercte.net/forumoji/  
 | 
			
		||||
License: CC0 1.0  
 | 
			
		||||
Designers: lolecksdeehaha; Scratch137; 64lu (the project has many more contributors, but these are the people whose designs were reproduced here)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/angry.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 458 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/frown.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 533 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/grin.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 535 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/imp.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 532 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/impangry.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 534 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/neutral.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 527 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/smile.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 532 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/sob.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 479 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/surprised.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 522 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/think.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 523 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/tongue.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 551 B  | 
							
								
								
									
										
											BIN
										
									
								
								data/static/emoji/wink.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 536 B  | 
							
								
								
									
										36
									
								
								lib/babycode-emoji.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,36 @@
 | 
			
		||||
local emoji_template = " <img class=emoji src=\"/emoji/$.png\" alt=\"$\" title=\"$\"> "
 | 
			
		||||
 | 
			
		||||
return {
 | 
			
		||||
  ["angry"] = emoji_template:gsub("%$", "angry"),
 | 
			
		||||
  
 | 
			
		||||
  ["("] = emoji_template:gsub("%$", "frown"),
 | 
			
		||||
  
 | 
			
		||||
  ["D"] = emoji_template:gsub("%$", "grin"),
 | 
			
		||||
  
 | 
			
		||||
  ["imp"] = emoji_template:gsub("%$", "imp"),
 | 
			
		||||
  
 | 
			
		||||
  ["angryimp"] = emoji_template:gsub("%$", "impangry"),
 | 
			
		||||
  ["impangry"] = emoji_template:gsub("%$", "impangry"),
 | 
			
		||||
  
 | 
			
		||||
  ["|"] = emoji_template:gsub("%$", "neutral"),
 | 
			
		||||
  
 | 
			
		||||
  [")"] = emoji_template:gsub("%$", "smile"),
 | 
			
		||||
  
 | 
			
		||||
  [","] = emoji_template:gsub("%$", "sob"),
 | 
			
		||||
  ["T"] = emoji_template:gsub("%$", "sob"),
 | 
			
		||||
  ["cry"] = emoji_template:gsub("%$", "sob"),
 | 
			
		||||
  ["sob"] = emoji_template:gsub("%$", "sob"),
 | 
			
		||||
  
 | 
			
		||||
  ["o"] = emoji_template:gsub("%$", "surprised"),
 | 
			
		||||
  ["O"] = emoji_template:gsub("%$", "surprised"),
 | 
			
		||||
  
 | 
			
		||||
  ["hmm"] = emoji_template:gsub("%$", "think"),
 | 
			
		||||
  ["think"] = emoji_template:gsub("%$", "think"),
 | 
			
		||||
  ["thinking"] = emoji_template:gsub("%$", "think"),
 | 
			
		||||
  
 | 
			
		||||
  ["P"] = emoji_template:gsub("%$", "tongue"),
 | 
			
		||||
  ["p"] = emoji_template:gsub("%$", "tongue"),
 | 
			
		||||
  
 | 
			
		||||
  [";"] = emoji_template:gsub("%$", "wink"),
 | 
			
		||||
  ["wink"] = emoji_template:gsub("%$", "wink"),
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
local babycode = {}
 | 
			
		||||
 | 
			
		||||
local string_trim = require("lapis.util").trim
 | 
			
		||||
local emoji = require("lib.babycode-emoji")
 | 
			
		||||
 | 
			
		||||
local function s_split(s, delimiter, max_matches, trim, allow_empty)
 | 
			
		||||
  local result = {}
 | 
			
		||||
@@ -121,6 +122,14 @@ function babycode.to_html(s, escape_html)
 | 
			
		||||
  
 | 
			
		||||
  -- these can be nested, so replace open and closed separately
 | 
			
		||||
  text = text:gsub("%[(/?)quote%]", "<%1blockquote>")
 | 
			
		||||
  
 | 
			
		||||
  text = text:gsub(":(.-):", function(code)
 | 
			
		||||
    if emoji[code] then
 | 
			
		||||
      return emoji[code]
 | 
			
		||||
    else
 | 
			
		||||
      return code
 | 
			
		||||
    end
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  -- replace loose links
 | 
			
		||||
  text = text:gsub("(https?://[%w-_%.%?%.:/%+=&~%@#%%]+[%w-/])", function(url)
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,11 @@ http {
 | 
			
		||||
      alias data/static/avatars;
 | 
			
		||||
      expires 1y;
 | 
			
		||||
    }
 | 
			
		||||
    location /emoji {
 | 
			
		||||
      alias data/static/emoji;
 | 
			
		||||
      expires 1y;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    location /static/js/ {
 | 
			
		||||
      alias js/;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,25 @@
 | 
			
		||||
<details>
 | 
			
		||||
  <summary>babycode guide</summary>
 | 
			
		||||
  <ul>
 | 
			
		||||
    <li>
 | 
			
		||||
      <details>
 | 
			
		||||
        <summary>Forumoji (emoticons)</summary>
 | 
			
		||||
        <ul>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/smile.png" alt="smile" title="smile"> - <code class=inline-code>:): </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/frown.png" alt="frown" title="frown"> - <code class=inline-code>:(: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/grin.png" alt="grin" title="grin"> - <code class=inline-code>:D: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/neutral.png" alt="neutral" title="neutral"> - <code class=inline-code>:|: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/angry.png" alt="angry" title="angry"> - <code class=inline-code>:angry: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/sob.png" alt="sob" title="sob"> - <code class=inline-code>:,: :cry: :sob: :T: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/surprised.png" alt="surprised" title="surprised"> - <code class=inline-code>:o: :O: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/think.png" alt="think" title="think"> - <code class=inline-code>:hmm: :think: :thinking: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/tongue.png" alt="tongue" title="tongue"> - <code class=inline-code>:p: :P: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/wink.png" alt="wink" title="wink"> - <code class=inline-code>:;: :wink: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/imp.png" alt="imp" title="imp"> - <code class=inline-code>:imp: </code></li>
 | 
			
		||||
          <li><img class="emoji" src="/emoji/impangry.png" alt="impangry" title="impangry"> - <code class=inline-code>:angryimp: :impangry: </code></li>
 | 
			
		||||
        </ul>
 | 
			
		||||
      </details>
 | 
			
		||||
    </li>
 | 
			
		||||
    <li>Loose links will be converted to clickable links automatically</li>
 | 
			
		||||
    <li>[b]<b>bold</b>[/b]</li>
 | 
			
		||||
    <li>[i]<i>italic</i>[/i]</li>
 | 
			
		||||
 
 | 
			
		||||