示例#1
0
 def parse(self, mdFile):
   self.content = parse_markdown(mdFile)
   self.title   = getHeadder(mdFile)
     
   with open(mdFile, 'r') as fin:
     data = fin.read().splitlines(True)
   with open('temp.md', 'w') as fout:
     fout.writelines(data[1:])
     fout.close()
   self.contentWithoutHeadder  = parse_markdown('temp.md')
   remove ('temp.md')
示例#2
0
    def parse(self, mdFile):
        self.content = parse_markdown(mdFile)
        self.title = getHeadder(mdFile)

        with open(mdFile, 'r') as fin:
            data = fin.read().splitlines(True)
        with open('temp.md', 'w') as fout:
            fout.writelines(data[1:])
            fout.close()
        self.contentWithoutHeadder = parse_markdown('temp.md')
        remove('temp.md')
示例#3
0
 def __init__(self, name, objectives):
   self.folder  = name;
   objectivesMd = glob('./' + name + '/0*.md')
   if len(objectivesMd) == 0:
     print ('Cannot locate lab steps in ' + self.folder +  '. Lab steps must be named 0X.XX.md')
     exit()
     
   self.objectives = parse_markdown (objectivesMd[0])
示例#4
0
 def __init__(self):
   checkFileExists ('course.md')    
   self.content    = parse_markdown('course.md')
   self.title      = getHeadder('course.md')
   ignoreList = getIgnoreList()
   self.topicList  = []
   allTopics  = glob('topic*')
   topicsToPublish = [t for t in allTopics if t not in ignoreList]
   for topic in topicsToPublish:
     self.topicList.append(TopicSummary(topic))  
示例#5
0
 def __init__(self):
     checkFileExists('course.md')
     self.content = parse_markdown('course.md')
     self.title = getHeadder('course.md')
     self.courseUrl = getCourseUrl()
     ignoreList = getIgnoreList()
     self.topicList = []
     allTopics = glob('topic*')
     topicsToPublish = [t for t in allTopics if t not in ignoreList]
     for topic in topicsToPublish:
         self.topicList.append(TopicSummary(topic))
示例#6
0
 def __init__(self):
   mdFile = 'profile.md'
   checkFileExists (mdFile)  
   self.title   = getHeadder(mdFile)
     
   with open(mdFile, 'r') as fin:
     data = fin.read().splitlines(True)
   with open('temp.md', 'w') as fout:
     fout.writelines(data[1:])
     fout.close()
   self.content = parse_markdown('temp.md')
   remove ('temp.md')
示例#7
0
    def __init__(self):
        mdFile = 'profile.md'
        checkFileExists(mdFile)
        self.title = getHeadder(mdFile)

        with open(mdFile, 'r') as fin:
            data = fin.read().splitlines(True)
        with open('temp.md', 'w') as fout:
            fout.writelines(data[1:])
            fout.close()
        self.content = parse_markdown('temp.md')
        remove('temp.md')
示例#8
0
 def __init__(self, topicFolder, name):
   self.name = name
   self.topicFolder = topicFolder
   self.pdf  = name + '.pdf'
   self.img  = getImageFile ('./pdf/' + name)
   if self.img:
     self.fullImgPath = topicFolder + self.img[1:]
     self.fullPdfPath = topicFolder + '/pdf/' + self.pdf
   mdFile = "./pdf/" + name + ".md"
   if (path.isfile(mdFile)):
     self.text = parse_markdown ("./pdf/" + name + ".md")
     self.title = getHeadder("./pdf/" + name + ".md")
     self.textWithoutHeadder = parse_markdown_without_header ("./pdf/" + name + ".md")
示例#9
0
 def __init__(self):
   checkFileExists ('topic.md')   
   root, self.folder  = path.split(getcwd())
   self.content  = parse_markdown('topic.md')
   self.title    = getHeadder('topic.md')
   self.pdfs = []
   pdfList   = glob('./pdf/*.pdf')
   for pdf in pdfList:
     self.pdfs.append(path.basename(pdf))
   self.bookList = []
   books = glob('./book*')  
   for lab in books:
     self.bookList.append( BookSummary(path.basename(lab), "") )
示例#10
0
 def __init__(self, topicFolder, name):
     self.name = name
     self.topicFolder = topicFolder
     self.pdf = name + '.pdf'
     self.img = getImageFile('./pdf/' + name)
     if self.img:
         self.fullImgPath = topicFolder + self.img[1:]
         self.fullPdfPath = topicFolder + '/pdf/' + self.pdf
     mdFile = "./pdf/" + name + ".md"
     if (path.isfile(mdFile)):
         self.text = parse_markdown("./pdf/" + name + ".md")
         self.title = getHeadder("./pdf/" + name + ".md")
         self.textWithoutHeadder = parse_markdown_without_header("./pdf/" +
                                                                 name +
                                                                 ".md")
示例#11
0
  def __init__(self, folder):
    checkFileExists ('topic.md')   
    root, self.folder  = path.split(getcwd())
    self.content  = parse_markdown('topic.md')
    self.title    = getHeadder('topic.md')
    self.topicElements = []
    self.topicFolder = folder
    pdfList   = glob('./pdf/*.pdf')
    for pdf in pdfList:
      elementName, type = path.splitext(path.basename(pdf))
      self.topicElements.append(TopicElement(self.topicFolder, elementName))

    self.bookList = []
    books = glob('./book*')  
    for lab in books:
      self.bookList.append( BookSummary(self.topicFolder, path.basename(lab), "") )
示例#12
0
  def __init__(self, topicFolder, name, objectives):
    self.topicFolder = topicFolder
    self.folder  = name;
    objectivesMd = glob('./' + name + '/0*.md')
    if len(objectivesMd) == 0:
      print ('Cannot locate lab steps in ' + self.folder +  '. Lab steps must be named 0X.XX.md')
      exit()
      
    self.objectives = parse_markdown (objectivesMd[0])
    self.objectivesWithoutHeadder = parse_markdown_without_header (objectivesMd[0])

    s = objectivesMd[0]
    s = s[s.find('.')+len('.'):s.rfind('.')]
    self.title = s[s.find('.')+1 :  ]
    self.img = getImageFile ('./' + name + '/img/main')  
    if self.img:
      self.fullImgPath = topicFolder + self.img[1:]
示例#13
0
    def __init__(self, folder):
        checkFileExists('topic.md')
        root, self.folder = path.split(getcwd())
        self.content = parse_markdown('topic.md')
        self.title = getHeadder('topic.md')
        self.topicElements = []
        self.topicFolder = folder
        pdfList = glob('./pdf/*.pdf')
        for pdf in pdfList:
            elementName, type = path.splitext(path.basename(pdf))
            self.topicElements.append(
                TopicElement(self.topicFolder, elementName))

        self.bookList = []
        books = glob('./book*')
        for lab in books:
            self.bookList.append(
                BookSummary(self.topicFolder, path.basename(lab), ""))
示例#14
0
    def __init__(self, topicFolder, name, objectives):
        self.topicFolder = topicFolder
        self.folder = name
        objectivesMd = glob('./' + name + '/0*.md')
        if len(objectivesMd) == 0:
            print('Cannot locate lab steps in ' + self.folder +
                  '. Lab steps must be named 0X.XX.md')
            exit()

        self.objectives = parse_markdown(objectivesMd[0])
        self.objectivesWithoutHeadder = parse_markdown_without_header(
            objectivesMd[0])

        s = objectivesMd[0]
        s = s[s.find('.') + len('.'):s.rfind('.')]
        self.title = s[s.find('.') + 1:]
        self.img = getImageFile('./' + name + '/img/main')
        if self.img:
            self.fullImgPath = topicFolder + self.img[1:]