Coder Social home page Coder Social logo

Bug? about gonmarkupparser HOT 3 CLOSED

Droppix avatar Droppix commented on June 6, 2024
Bug?

from gonmarkupparser.

Comments (3)

nicolasgoutaland avatar nicolasgoutaland commented on June 6, 2024

Hi Robert,

Can you past the code you are using ?
What is the expected output ?

My first guess is that you are trying to use a custom tag small but didn't register it.

// Add add font markup, to display small text when encountered
   [[GONMarkupParserManager sharedParser] addMarkup:[GONMarkupNamedFont namedFontMarkup:[UIFont systemFontOfSize:12.0] forTag:@"small"]];

from gonmarkupparser.

Droppix avatar Droppix commented on June 6, 2024

My code :

[[GONMarkupParserManager sharedParser].defaultConfiguration setObject:[UIFont systemFontOfSize:17.0] forKey:NSFontAttributeName];

[GONMarkupParserManager sharedParser].replaceNewLineCharactersFromInputString = YES;

[[GONMarkupParserManager sharedParser] addMarkup:[GONMarkupNamedFont namedFontMarkup:[UIFont systemFontOfSize:12.0] forTag:@"small"]];

[[GONMarkupParserManager sharedParser] addMarkup:[GONMarkupNamedColor namedColorMarkup:[UIColor redColor]
                                                                                forTag:@"red"]];

NSString *string = @"<left>Title <right><small>| <color value="red"><b>iPad 4</b></color></small></right></left><br/><small>MyApp 1.0.0 Build 4128 | Executions: 2<br/>14 Mar 2016 14:00:40</small>";
NSAttributedString *attributedText = [[GONMarkupParserManager sharedParser] attributedStringFromString:string

Output: Title and iPad 4 are aligned left (normally iPad 4 should be aligned right)
Tested on iOS 9.2 (iPAD)

Thanks for your help.

from gonmarkupparser.

nicolasgoutaland avatar nicolasgoutaland commented on June 6, 2024

Hi,

unfortunately, this kind of format isn't possible. You have a left and a right alignment on same line. Try to split your string with br to achieve this.

   NSString *string = @"<left>Title <br/><right>right</right></left>"; // will work
   NSString *string = @"<left>Title <right>right</right></left>"; // won't work

Regards,

from gonmarkupparser.

Related Issues (20)

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.