Switch to unified view

a/src/query/plaintorich.cpp b/src/query/plaintorich.cpp
...
...
359
#endif
359
#endif
360
360
361
    // Input character iterator
361
    // Input character iterator
362
    Utf8Iter chariter(in);
362
    Utf8Iter chariter(in);
363
363
364
    // State variable used to limit the number of consecutive empty lines,
364
    // State variables used to limit the number of consecutive empty lines,
365
    // and convert all eol to '\n'
365
    // convert all eol to '\n', and preserve some indentation
366
    int eol = 0;
366
    int eol = 0;
367
    int hadcr = 0;
367
    int hadcr = 0;
368
    int inindent = 1;
368
369
369
    // Value for numbered anchors at each term match
370
    // Value for numbered anchors at each term match
370
    int anchoridx = 1;
371
    int anchoridx = 1;
371
    // HTML state
372
    // HTML state
372
    bool intag = false, inparamvalue = false;
373
    bool intag = false, inparamvalue = false;
...
...
423
        } else if (car == '\r') {
424
        } else if (car == '\r') {
424
            hadcr++;
425
            hadcr++;
425
            eol++;
426
            eol++;
426
            continue;
427
            continue;
427
        } else if (eol) {
428
        } else if (eol) {
428
            // Do line break;
429
            // Got non eol char in line break state. Do line break;
430
      inindent = 1;
429
            hadcr = 0;
431
            hadcr = 0;
430
            if (eol > 2)
432
            if (eol > 2)
431
                eol = 2;
433
                eol = 2;
432
            while (eol) {
434
            while (eol) {
433
        if (!m_inputhtml && m_eolbr)
435
        if (!m_inputhtml && m_eolbr)
...
...
445
            }
447
            }
446
        }
448
        }
447
449
448
        switch (car) {
450
        switch (car) {
449
        case '<':
451
        case '<':
452
      inindent = 0;
450
            if (m_inputhtml) {
453
            if (m_inputhtml) {
451
                if (!inparamvalue)
454
                if (!inparamvalue)
452
                    intag = true;
455
                    intag = true;
453
                chariter.appendchartostring(*olit);    
456
                chariter.appendchartostring(*olit);    
454
            } else {
457
            } else {
455
                *olit += "&lt;";
458
                *olit += "&lt;";
456
            }
459
            }
457
            break;
460
            break;
458
        case '>':
461
        case '>':
462
      inindent = 0;
459
            if (m_inputhtml) {
463
            if (m_inputhtml) {
460
                if (!inparamvalue)
464
                if (!inparamvalue)
461
                    intag = false;
465
                    intag = false;
462
            }
466
            }
463
            chariter.appendchartostring(*olit);    
467
            chariter.appendchartostring(*olit);    
464
            break;
468
            break;
465
        case '&':
469
        case '&':
470
      inindent = 0;
466
            if (m_inputhtml) {
471
            if (m_inputhtml) {
467
                chariter.appendchartostring(*olit);
472
                chariter.appendchartostring(*olit);
468
            } else {
473
            } else {
469
                *olit += "&amp;";
474
                *olit += "&amp;";
470
            }
475
            }
471
            break;
476
            break;
472
        case '"':
477
        case '"':
478
      inindent = 0;
473
            if (m_inputhtml && intag) {
479
            if (m_inputhtml && intag) {
474
                inparamvalue = !inparamvalue;
480
                inparamvalue = !inparamvalue;
475
            }
481
            }
476
            chariter.appendchartostring(*olit);
482
            chariter.appendchartostring(*olit);
477
            break;
483
            break;
484
485
  case ' ': 
486
      if (m_eolbr && inindent) {
487
      *olit += "&nbsp;";
488
      } else {
489
      chariter.appendchartostring(*olit);
490
      }
491
      break;
492
  case '\t': 
493
      if (m_eolbr && inindent) {
494
      *olit += "&nbsp;&nbsp;&nbsp;&nbsp;";
495
      } else {
496
      chariter.appendchartostring(*olit);
497
      }
498
      break;
499
478
        default:
500
        default:
501
      inindent = 0;
479
            chariter.appendchartostring(*olit);
502
            chariter.appendchartostring(*olit);
480
        }
503
        }
481
504
482
    } // End chariter loop
505
    } // End chariter loop
483
506