Bbcode to html java

io.github.matafokka:bbcode-converter
Release 1.0

A Java library that provides a class to effectively convert custom BBCode to HTML. Also prevents XSS attacks.

dependency> groupId>io.github.matafokkagroupId> artifactId>bbcode-converterartifactId> version>1.0version> dependency>

Or for your building system from code here.

You can find the documentation here.

First of all, you’ve got 3 types of so-called «tags»:

  1. Simple tags. These tags contains only one so-called part (string), i.e. «[B]», that will be replaced with another string, i.e. «». These tags shouldn’t be closed. Also, this tags contains HTML entities.
  2. Complex tags. These tags can contain 2 or 3 parts. Check addComplexTag() for more information.
  3. URL entites. Same as simple tags, but these will be used when parsing text between 1st and 2nd parts of a complex tag.

Next, you need to know these rules:

  1. All tags are case-dependent. Don’t add all the cases by yourself! Apply a code-style to your project, i.e. all tags should be either in a lower case or in a upper case.
  2. BBCodeConverter will escape all necessary HTML and URL entities. You don’t need to add it by yourself.
  3. Put the output of toHtml() into block. This is needed to deal with bad markup.
Читайте также:  Customer service and support css

List of included tags:

Tags added anyways

Simple tags:

URL entities:

Tags added when addDefaultTags = true

Simple tags:

[B] => [/B] => [I] => [/I] => [U] => [/U] => [S] => [/S] => 

Complex tags:

[URL="http:// "] [/URL] V V V " [URL="https:// "] [/URL] V V V " [COLOR=" "] [/COLOR] V V V 
import io.github.matafokka.bbcode_converter.BBCodeConverter
// With all default tags included BBCodeConverter conv = new BBCodeConverter(); BBCodeConverter conv = new BBCodeConverter(true); // Only with necessary tags (HTML and URL-entities): BBCodeConverter conv = new BBCodeConverter(false);
conv.addSimpleTag(. ); conv.addComplexTag(. ); conv.addUrlEntity(. );
String output = conv.toHtml(input);

Источник

matafokka/bbcode-converter

A Java library that provides a class to effectively convert custom BBCode to HTML. Also prevents XSS attacks.

dependency> groupId>io.github.matafokkagroupId> artifactId>bbcode-converterartifactId> version>1.0version> dependency>

Or for your building system from code here.

You can find the documentation here.

First of all, you’ve got 3 types of so-called «tags»:

  1. Simple tags. These tags contains only one so-called part (string), i.e. «[B]», that will be replaced with another string, i.e. «». These tags shouldn’t be closed. Also, this tags contains HTML entities.
  2. Complex tags. These tags can contain 2 or 3 parts. Check addComplexTag() for more information.
  3. URL entites. Same as simple tags, but these will be used when parsing text between 1st and 2nd parts of a complex tag.

Next, you need to know these rules:

  1. All tags are case-dependent. Don’t add all the cases by yourself! Apply a code-style to your project, i.e. all tags should be either in a lower case or in a upper case.
  2. BBCodeConverter will escape all necessary HTML and URL entities. You don’t need to add it by yourself.
  3. Put the output of toHtml() into block. This is needed to deal with bad markup.

List of included tags:

Tags added anyways

Simple tags:

URL entities:

Tags added when addDefaultTags = true

Simple tags:

[B] => [/B] => [I] => [/I] => [U] => [/U] => [S] => [/S] => 

Complex tags:

[URL="http:// "] [/URL] V V V " [URL="https:// "] [/URL] V V V " [COLOR=" "] [/COLOR] V V V 
import io.github.matafokka.bbcode_converter.BBCodeConverter
// With all default tags included BBCodeConverter conv = new BBCodeConverter(); BBCodeConverter conv = new BBCodeConverter(true); // Only with necessary tags (HTML and URL-entities): BBCodeConverter conv = new BBCodeConverter(false);
conv.addSimpleTag(. ); conv.addComplexTag(. ); conv.addUrlEntity(. );
String output = conv.toHtml(input);

Project Statistics

Sourcerank 3
Repository Size 19.5 KB
Stars 0
Forks 0
Watchers 1
Open issues 0
Dependencies 0
Contributors 1
Tags 1
Created May 4, 2020
Last updated May 7, 2020
Last pushed May 7, 2020

Top Contributors See all

Packages Referencing this Repo

io.github.matafokka:bbcode-converter

Recent Tags See all

Something wrong with this page? Make a suggestion

Last synced: 2020-07-29 04:46:14 UTC

Login to resync this repository

Libraries.io helps you find new open source packages, modules and frameworks and keep track of ones you depend upon.

Copyright © 2023 Tidelift, Inc
Code is Open Source under AGPLv3 license
Data is available under CC-BY-SA 4.0 license

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Provides a class to effectively convert custom BBCode to HTML

License

matafokka/bbcode-converter

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A Java library that provides a class to effectively convert custom BBCode to HTML. Also prevents XSS attacks.

dependency> groupId>io.github.matafokkagroupId> artifactId>bbcode-converterartifactId> version>1.0version> dependency>

Or for your building system from code here.

You can find the documentation here.

First of all, you’ve got 3 types of so-called «tags»:

  1. Simple tags. These tags contains only one so-called part (string), i.e. «[B]», that will be replaced with another string, i.e. «». These tags shouldn’t be closed. Also, this tags contains HTML entities.
  2. Complex tags. These tags can contain 2 or 3 parts. Check addComplexTag() for more information.
  3. URL entites. Same as simple tags, but these will be used when parsing text between 1st and 2nd parts of a complex tag.

Next, you need to know these rules:

  1. All tags are case-dependent. Don’t add all the cases by yourself! Apply a code-style to your project, i.e. all tags should be either in a lower case or in a upper case.
  2. BBCodeConverter will escape all necessary HTML and URL entities. You don’t need to add it by yourself.
  3. Put the output of toHtml() into block. This is needed to deal with bad markup.

List of included tags:

Tags added anyways

Simple tags:

URL entities:

Tags added when addDefaultTags = true

Simple tags:

[B] => [/B] => [I] => [/I] => [U] => [/U] => [S] => [/S] => 

Complex tags:

[URL="http:// "] [/URL] V V V " [URL="https:// "] [/URL] V V V " [COLOR=" "] [/COLOR] V V V 
import io.github.matafokka.bbcode_converter.BBCodeConverter
// With all default tags included BBCodeConverter conv = new BBCodeConverter(); BBCodeConverter conv = new BBCodeConverter(true); // Only with necessary tags (HTML and URL-entities): BBCodeConverter conv = new BBCodeConverter(false);
conv.addSimpleTag(. ); conv.addComplexTag(. ); conv.addUrlEntity(. );
String output = conv.toHtml(input);

About

Provides a class to effectively convert custom BBCode to HTML

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A flexible Java text processor. BB, BBCode, BB-code, HTML, Textile, Markdown, parser, translator, converter.

License

kefirfromperm/kefirbb

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

KefirBB is a Java-library for text processing. Initially it was developed for BBCode (Bulletin Board Code) to HTML translation. But flexible configuration allows to use it in different cases. For example XML-to-HTML translation or for HTML filtration. Now it supports Textile and Markdown markup languages. Actually it’s the most powerfull and flexible Java-library for BBCode parsing.

dependency> groupId>org.kefirsfgroupId> artifactId>kefirbbartifactId> version>1.5version> dependency>

KefirBB fully supports converting from BBCode markup language to HTML. The syntax of BBCode is described at BBCode — Wikipedia.

TextProcessor processor = BBProcessorFactory.getInstance().create(); assert "text".equals(processor.process("[b]text[/b]"));

If you don’t want to use special markup languages in your site but you have to safe your users from XSS-attacks you can use KefirBB configuration for HTMl filtration. It prevents using of javascript, styles etc.

TextProcessor processor = BBProcessorFactory.getInstance() .createFromResource(ConfigurationFactory.SAFE_HTML_CONFIGURATION_FILE); assert "text".equals(processor.process("\"javascript:alert('Fail!');\">test"));

KefirBB fully supports Textile markup language. It’s described at TxStyle

TextProcessor processor = BBProcessorFactory.getInstance() .createFromResource(ConfigurationFactory.TEXTILE_CONFIGURATION_FILE); assert "

text

"
.equals(processor.process("**text**"));

KefirBB supports Markdown markup language partially described at Markdown Syntax. It doesn’t support fully blockquotes and lists.

TextProcessor processor = BBProcessorFactory.getInstance() .createFromResource(ConfigurationFactory.MARKDOWN_CONFIGURATION_FILE); assert "

text

"
.equals(processor.process("**text**"));

Your custom configuration

Also you can use your own configuration or customize existing. Just put your own configuration to classpath:kefirbb.xml .

You can find full documentation in the wiki of the project.

You can report bugs at GitHub Issues. Also you can ask me questions by email kefirfromperm@gmail.com.

If you want to give me a beer just send some money to https://www.paypal.me/kefir

About

A flexible Java text processor. BB, BBCode, BB-code, HTML, Textile, Markdown, parser, translator, converter.

Источник

Оцените статью