예제 #1
0
파일: PaperCheck.py 프로젝트: cbanek/talks
def GetFileEncodings(TexFileName, Problems):

    Report = []
    Encodings = []
    Certainty = AdassChecks.GetFileEncoding(TexFileName, Encodings, Report)
    if (len(Encodings) == 1):
        print("")
        if (Encodings[0] == "ASCII"):
            print("File is encoded in standard ASCII")
        else:
            print("File contains characters that may not be supported" + \
                                                 " by all LaTeX installations.")
            if (Certainty == 100):
                print("File is encoded using", Encodings[0])
            else:
                print("File appears to be encoded using", Encodings[0])
                for Line in Report:
                    print(Line)
                print("")
                Problems.append("File contains non-standard characters," + \
                         " and there is some uncertainty about the encoding used")
    else:
        print("File contains extended characters that may not be supported")
        print("by all LaTeX installations, and the encoding is ambiguous")
        Message = "File could be encoded using any of: "
        for Encoding in Encodings:
            Message = Message + ' ' + Encoding
        print(Message)
        for Line in Report:
            print(Line)
        Problems.append("File contains non-standard characters," + \
                                         " and the encoding is ambiguous")

    return Encodings
예제 #2
0
def CheckUnprintable(TexFileName):

    ReturnOK = False
    LineNumber = 0
    TexFile = open(TexFileName, mode='r')
    for TexFileLine in TexFile:
        LineNumber = LineNumber + 1
        if (not TexFileLine.startswith("%")):
            Problem = AdassChecks.CheckCharacters(TexFileLine, LineNumber)
            if (Problem): ReturnOK = True
    TexFile.close()

    return ReturnOK
예제 #3
0
파일: PaperCheck.py 프로젝트: cbanek/talks
            print("The parser used for these tests reported a problem:")
            Report = TheScanner.GetReport()
            for Line in Report:
                print(Line)
            Problems.append("There was a problem parsing the .tex file")
        TexFile.close()

        #  Check to see if the main .tex file makes use of any non-standard
        #  LaTeX packages..

        Step = Step + 1
        print("")
        print("Step", Step,
              " - Check for use of unsupported LaTeX packages -------")

        AllOK = AdassChecks.CheckPackages(Paper, TexFileName)
        if (AllOK):
            print("No unsupported packages used")
        else:
            Problems.append(
                "Problems were found with the use of LaTeX packages")

        #  Check to see if the main .tex file contains any characters some
        #  LaTeX installations might have problems with..

        Step = Step + 1
        print("")
        print("Step", Step,
              " - Check for unprintable characters in the .tex file -")

        Encodings = GetFileEncodings(TexFileName, Problems)
예제 #4
0
if (ArgsValid):
    TexFileName = sys.argv[1]

    if (not os.path.exists(TexFileName)):
        print("Cannot find file '" + TexFileName + "'")
    else:

        #  Unless we've been asked to use a specific encoding, try to determine
        #  the encoding automatically. GetFileEncoding() will do this.

        EncodingOK = True
        if (CheckEncoding):
            Report = []
            Encodings = []
            Certainty = AdassChecks.GetFileEncoding(TexFileName, Encodings,
                                                    Report)
            if (len(Encodings) == 1):
                print("")
                if (Encodings[0] == "ASCII"):
                    print("File is encoded in standard ASCII")
                else:
                    if (Certainty == 100):
                        print("File is encoded using", Encodings[0])
                    else:
                        print("File appears to be encoded using", Encodings[0])
                        for Line in Report:
                            print(Line)
                        print("")
                        print(
                            "If necessary, restore the saved version an re-run"
                        )
예제 #5
0
#     It has been tested under 2.7 and 3.6.
#

from __future__ import (print_function, division, absolute_import)

import sys
import string

import AdassChecks

NumberArgs = len(sys.argv)
if (NumberArgs < 2):
    print("Usage: Aindex <paper>")
    print("eg: Aindex O1-4")
else:
    Paper = sys.argv[1]
    Notes = []

    print("")
    print("Generating author index entries for paper", Paper)
    print("")
    AuthorList = AdassChecks.GetAuthors(Paper, Notes)
    if (len(AuthorList) <= 0):
        print("** No authors found for", Paper, "**")
    else:
        for Author in AuthorList:
            print("%\\aindex{" + Author + "}")
        print("")
        for Note in Notes:
            print("*", Note, "*")