Giter Site home page Giter Site logo

kefirfromperm / kefirbb Goto Github PK

View Code? Open in Web Editor NEW
87.0 87.0 14.0 547 KB

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

License: GNU Lesser General Public License v3.0

Java 100.00%
bbcode converter html html-filtration java java-library markdown text-processing textile translator

kefirbb's People

Contributors

jasperkrijgsman avatar kefirfromperm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kefirbb's Issues

Safe HTML processor gets stuck or runs very slow

A safehtml processor instantiated like this:
TextProcessor safeProcessor = BBProcessorFactory.getInstance().createFromResource("org/kefirsf/bb/safehtml.xml");
gets stuck or runs very slow during the parsing of a string which contains many
s.
Example test case:
safeProcessor.process("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>");
The issue exists in version 1.0 and 1.2 as well.

Stabilize

Stabilize configuration's syntax
Make refactoring
Complete javadoc

Logging

I need a logging. It's needed to fix which part of a text recognized as which code. Debugging is very hard now.

Email tag

It's needed to create an email tag for parsing emails. It's like url tag.

Add tag junk

Add configuration tag junk for unparseable text.

Ability to move the project architecture to loosely coupled

Sometimes simple configuration options are not enough. And at the same time, there is no way to customize the basic project without delving deeply into its architecture. Here, of course, I mean without physical modification of the code of the base artifact.

It would be great to be able to extend parsing capabilities not only with configuration, but also through DI. Even without being tied to a specific DI implementation.

However, allow users of the project to choose how to build certain nodes of the system.
For example, writing custom functions for your own needs (of course, the XSD schema have to allow this).

Crash by java.util.regex.PatternSyntaxException

I tried to add KefirBB to my android project and with the default initializer I got this exception:

FATAL EXCEPTION: main
 Process: se.avanzabank.androidapplikation.debug, PID: 488
 java.lang.ExceptionInInitializerError
     at org.kefirsf.bb.PatternElementFactory.create(PatternElementFactory.java:43)
     at org.kefirsf.bb.ProcessorBuilder.createPattern(ProcessorBuilder.java:139)
     at org.kefirsf.bb.ProcessorBuilder.createCode(ProcessorBuilder.java:97)
     at org.kefirsf.bb.ProcessorBuilder.createScope(ProcessorBuilder.java:67)
     at org.kefirsf.bb.ProcessorBuilder.build(ProcessorBuilder.java:33)
     at org.kefirsf.bb.BBProcessorFactory.create(BBProcessorFactory.java:52)
     at org.kefirsf.bb.BBProcessorFactory.createFromResource(BBProcessorFactory.java:63)
     at se.avanzabank.androidapplikation.news.fragment.PlaceraArticleFragment.populateWithArticle(PlaceraArticleFragment.java:226)
     at se.avanzabank.androidapplikation.news.fragment.PlaceraArticleFragment.lambda$null$235(PlaceraArticleFragment.java:143)
     at se.avanzabank.androidapplikation.news.fragment.PlaceraArticleFragment$$Lambda$4.run(Unknown Source)
     at android.os.Handler.handleCallback(Handler.java:751)
     at android.os.Handler.dispatchMessage(Handler.java:95)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6077)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
  Caused by: java.util.regex.PatternSyntaxException: In a character range [x-y], x is greater than y near index 8
 #([\w&-=]|(%\p{XDigit}{2}))*
         ^
     at java.util.regex.Pattern.compileImpl(Native Method)
     at java.util.regex.Pattern.compile(Pattern.java:1340)
     at java.util.regex.Pattern.<init>(Pattern.java:1324)
     at java.util.regex.Pattern.compile(Pattern.java:946)
     at org.kefirsf.bb.proc.ProcUrl.<clinit>(ProcUrl.java:21)
        ... 17 more

Any ideas how to fix this?

Nesting limit

Add nesting limit on tags for prevent StackOverflowException

[img]-elements are not processed correctly

After processing a simple [img]-element, the value of the src -attribute is null:

TextProcessor processor = BBProcessorFactory.getInstance().create();
String imgFail = processor.process("[img]https://upload.wikimedia.org/wikipedia/commons/9/90/JustAnExample.JPG[/img]");
// imgFail = <img src="null"/>

But if I provide a width and a height the processing is successful:

TextProcessor processor = BBProcessorFactory.getInstance().create();
String imgSuccess = processor.process("[img width:350px height:350px]https://upload.wikimedia.org/wikipedia/commons/9/90/JustAnExample.JPG[/img]");
// imgSuccess = <img src="https://upload.wikimedia.org/wikipedia/commons/9/90/JustAnExample.JPG" style="width:350px; height:350px;"/>

I think it's a bug or do I have to set any configurations?

Make OSGi-ready

Need to add the OSGi descriptor. And something else, maybe.

Configuration decomposition.

Add a tag import to import configuration files in configuration.

For example the safe HTML tags are needed in Textile and Markdown.

A tag for URLs

Very often an URL is found in markup languages. So this tag will be very useful.

Matching failure with use of / in certain situations

The following tag definition:

<code name="example">
<pattern>[url]<var name="a" regex="http://example.com"/&gt;/&lt;var name="b"/>[/url]</pattern>
<template>FOUND</template>
</code>

should match http://example.com/hello, but it does not. However, this tag:

<code name="example">
<pattern>[url]<var name="a" regex="example.com"/>/<var name="b"/>[/url]</pattern>
<template>FOUND</template>
</code>

does match example.com/hello. Moreover, this tag:

<code name="example">
<pattern>[url]<var name="a" regex="http://example.com"/&gt;/h&lt;var name="b"/>[/url]</pattern>
<template>FOUND</template>
</code>

will match http://example.com/hello

The issue seems to relate to the existence of a / in both a regular expression and the text. The existence of the second variable also seems to be required to cause this issue, as does the / being the only character between the two variables.

Quote with author

Hi,

how i can convert quote with author to html?
Example:
[quote=Jack][quote=John]Some text[/quote]John i can help you ;)[/quote]Thanks Jack, i send you pm...

Thanks for help

Mistake in block attributes

block attributes like (((myclass) is parsed with error. Must be converted as style="padding-left:2em;" class="myclass"

"if" expression in templates

It's needed to add "if" expression to templates.

<if name="style"> style=&quot;<var name="style"/>&quot;</if>

The value inside the if expression will be appended only if style variable is not null.

It allows reduce configuration complexity and increase capacity. Because it allows to reduce code and pattern values

how to convert html to bbCode?

I found KefirBB library in stackoverflow but it's only providing converting BBCode to Html.How to convert html to BBCode?

Do tests refactoring

It's needed to do refactoring of tests. There are to many code duplicates and it is not clear which text was parsed on failure.

URLs with dashes not recognised as valid.

For example the token[url=http://example.com/dashed-path/index.html]Link name[/url]does not evaluate to a hyperlink.

[url=http://example.com/nondashedpath/index.html]Link name[/url] works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.