OLD | NEW |
1 #!/usr/local/bin/python | 1 #!/usr/local/bin/python |
2 # coding: utf-8 | 2 # coding: utf-8 |
3 | 3 |
4 import sys | 4 import sys |
5 import re | 5 import re |
6 | 6 |
7 # TODO(edisonn): put processed part of file in a new file | 7 # TODO(edisonn): put processed part of file in a new file |
8 # put unprocessed part, in a new file, so we see what we miss | 8 # put unprocessed part, in a new file, so we see what we miss |
9 # keep blank lines, and generate a version without the blank lines | 9 # keep blank lines, and generate a version without the blank lines |
10 | 10 |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 568 |
569 return False | 569 return False |
570 return False | 570 return False |
571 | 571 |
572 def processLine(line): | 572 def processLine(line): |
573 global fnewspec | 573 global fnewspec |
574 | 574 |
575 inSpec = processLineCore(line) | 575 inSpec = processLineCore(line) |
576 | 576 |
577 #just return, use the next lines if you wish to rewrite spec | 577 #just return, use the next lines if you wish to rewrite spec |
578 return | 578 #return |
579 | 579 |
580 if inSpec: | 580 if inSpec: |
581 #resize colum with types | 581 #resize colum with types |
582 line = line[:columnWidth[0] + columnWidth[1]] + (' ' * (60 - columnWidth[1])
) + line[columnWidth[0] + columnWidth[1]:] | 582 line = line[:columnWidth[0] + columnWidth[1]] + (' ' * (60 - columnWidth[1])
) + line[columnWidth[0] + columnWidth[1]:] |
583 line = line[:columnWidth[0]] + (' ' * (40 - columnWidth[0])) + line[columnWi
dth[0]:] | 583 line = line[:columnWidth[0]] + (' ' * (40 - columnWidth[0])) + line[columnWi
dth[0]:] |
584 | 584 |
585 fnewspec.write(line) | 585 fnewspec.write(line) |
586 | 586 |
587 | 587 |
588 def generateDef(): | 588 def generateDef(): |
589 global lines | 589 global lines |
590 global fnewspec | 590 global fnewspec |
591 | 591 |
592 #fnewspec = open('PdfReference-okular-2.txt', 'w') | 592 fnewspec = open('PdfReference-okular-2.txt', 'w') |
593 | 593 |
594 print 'import datatypes' | 594 print 'import datatypes' |
595 print | 595 print |
596 | 596 |
597 print 'def buildPdfSpec(pdfspec):' | 597 print 'def buildPdfSpec(pdfspec):' |
598 | 598 |
599 for line in sys.stdin: | 599 for line in sys.stdin: |
600 processLine(line) | 600 processLine(line) |
601 | 601 |
602 # close last table if it was not closed already | 602 # close last table if it was not closed already |
603 stopTable() | 603 stopTable() |
604 | 604 |
605 print | 605 print |
606 | 606 |
607 #print lines | 607 #print lines |
608 #fnewspec.close() | 608 fnewspec.close() |
609 | 609 |
610 if '__main__' == __name__: | 610 if '__main__' == __name__: |
611 sys.exit(generateDef()) | 611 sys.exit(generateDef()) |
OLD | NEW |