@@ -60,8 +60,8 @@ - (void)typesetMathWithArray:(NSArray *)arr{
6060 NSMutableArray *arrNew = [NSMutableArray arrayWithArray: arr];
6161 for (NSInteger i = 0 ; i < arr.count ; i ++) {
6262 NSString *str = arr[i];
63- if ([str hasPrefix: @" math> " ]) {
64- NSArray *arr_t = [str componentsSeparatedByString: @" > " ];
63+ if ([str hasPrefix: @" math# " ]) {
64+ NSArray *arr_t = [str componentsSeparatedByString: @" # " ];
6565 __block MathView *math = [[MathView alloc ]initWithRenderCompleted:^(CGRect frame,NSInteger index) {
6666 MathModel *model = [[MathModel alloc ]init];
6767 model.mathView = math;
@@ -72,13 +72,13 @@ - (void)typesetMathWithArray:(NSArray *)arr{
7272 } withCode:arr_t [1 ] Index: i];
7373 math.ratio = 0.6 ;
7474 [self addSubview: math];
75- }else if ([str hasPrefix: @" image> " ]){
76- NSArray *arr_m = [str componentsSeparatedByString: @" > " ];
75+ }else if ([str hasPrefix: @" image# " ]){
76+ NSArray *arr_m = [str componentsSeparatedByString: @" # " ];
7777 [[SDWebImageManager sharedManager ] downloadImageWithURL: [NSURL URLWithString: arr_m[1 ]] options: SDWebImageLowPriority progress: ^(NSInteger receivedSize, NSInteger expectedSize) {
7878 } completed: ^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
7979 UIImageView *imageView = [[UIImageView alloc ]initWithImage:image];
8080 imageView.frame = CGRectMake (0 , 0 , image.size .width /3 , image.size .height /3 );
81- NSUInteger imageIndex = [arr indexOfObject: [NSString stringWithFormat: @" image> %@ " ,imageURL.absoluteString]];
81+ NSUInteger imageIndex = [arr indexOfObject: [NSString stringWithFormat: @" image# %@ " ,imageURL.absoluteString]];
8282 [arrNew replaceObjectAtIndex: imageIndex withObject: imageView];
8383 self.renderCount ++;
8484 [self typesetWithOriArr: arr andMultiArr: arrNew];
@@ -97,13 +97,13 @@ - (void)typesetMathWithArray:(NSArray *)arr{
9797 @return 数据源数组
9898 */
9999- (NSArray *)parserString : (NSString *)str {
100- NSArray *arr = [str componentsSeparatedByString: @" < " ];
100+ NSArray *arr = [str componentsSeparatedByString: @" @ " ];
101101 NSLog (@" %@ " ,arr);
102102 NSMutableArray *newArr = [NSMutableArray arrayWithArray: arr];
103103 for (NSInteger i = 0 ; i < newArr.count ; i ++) {
104- if ([newArr[i] hasPrefix: @" /math> " ]||[newArr[i] hasPrefix: @" /image> " ]) {
105- NSString *newStr = [newArr[i] stringByReplacingOccurrencesOfString: @" /math> " withString: @" " ];
106- NSString *newStr1 = [newStr stringByReplacingOccurrencesOfString: @" /image> " withString: @" " ];
104+ if ([newArr[i] hasPrefix: @" /math# " ]||[newArr[i] hasPrefix: @" /image# " ]) {
105+ NSString *newStr = [newArr[i] stringByReplacingOccurrencesOfString: @" /math# " withString: @" " ];
106+ NSString *newStr1 = [newStr stringByReplacingOccurrencesOfString: @" /image# " withString: @" " ];
107107 [newArr replaceObjectAtIndex: i withObject: newStr1];
108108 }
109109 }
0 commit comments