Guide-API

Guide-API

76M Downloads

[Suggestion & question] Do you want PageText to auto detect text overflowing down of the page and make extra pages?

Lothrazar opened this issue ยท 3 comments

commented

I am asking because I am thinking about making a pull request

Consider this case http://i.imgur.com/YccQLBi.png

Now in my own code i put in a step where i translate the text and check its length, then if its over a certain length I add as many PageText's as needed.

My question is, do you want page text class to do this automatically in Guide API? Or if I made a secondary page type, maybe PageTextSplitter, that can do this?

I found that about MAX_PAGE_LENGTH = 308; is a good number, but this could be configurable, or passed into constructor. Also I have it smart tokenizing so it only splits on a space character. (tokenizing algorithm i used is here http://stackoverflow.com/a/14160155 )

If you would be willing to accept this new PR i will start on it, just let me know.

commented

PageHelper.pagesForLongText(text, maxLength) exists for just this purpose.

commented

Oh thanks, i didnt realize there was a super great function already! awesome!

commented

In the future, it may be easier to ask this kind of stuff on Discord. I'm mostly active in the Modded Minecraft (/r/feedthebeast) and Modded Minecraft Development discords.