コード例 #1
0
ファイル: ruin.py プロジェクト: mattfister/ruindogs
 def render(self):
     ruin_save_name = self.name.replace(" ", "-")
     ruin_map_file_name = ruin_save_name + ".png"
     grapher.save_graph(self, ruin_map_file_name)
     md_writer.print_title("Ruin Dogs")
     md_writer.print_sub_title(self.name)
     md_writer.print_chapter_heading("Overview")
     md_writer.print_chapter_sentence(self.location_description)
     md_writer.print_chapter_sentence(self.parts_description)
     md_writer.print_chapter_sentence(self.circumstances_description)
     md_writer.print_chapter_sentence(self.race_description)
     md_writer.print_chapter_sentence(self.villain_sentence)
     md_writer.print_chapter_sentence(self.race_villain_relation_sentence)
     md_writer.print_chapter_sentence(self.villain.motivation_description)
     md_writer.end_paragraph()
     md_writer.end_chapter()
     md_writer.print_chapter_heading("Artifact")
     self.artifact.render()
     md_writer.end_paragraph()
     md_writer.end_chapter()
     md_writer.print_chapter_heading("Locations")
     md_writer.end_chapter()
     md_writer.insert_image('../'+md_writer.output_folder+'/images/' + ruin_map_file_name, 'layout')
     for room in self.rooms:
         room.render()
         md_writer.end_paragraph()
     md_writer.end_novel(css='http://mattfister.github.io/ruindogs/base.css')
コード例 #2
0
ファイル: ruin_generator.py プロジェクト: mattfister/ruindogs
from ruin import Ruin
from freezeword import md_writer
from os import listdir
from os.path import isfile, join
import random

__author__ = "Matt Fister"


if __name__ == '__main__':
    for i in range(10):
        ruin = Ruin()
        md_writer.new_file(ruin.name.replace(" ", "-"))
        ruin.render()
    only_files = [f for f in listdir(md_writer.output_folder) if isfile(join(md_writer.output_folder, f))]
    md_writer.new_file('index')
    random.shuffle(only_files)
    md_writer.print_title("Ruin Dogs")
    md_writer.print_sub_title("V2 - Ruin Index")
    for file in only_files:

        if file.endswith('.html') and file != 'index.html':
            ruin_name = file.split('.html')[0].replace('-',' ').title()
            md_writer.print_chapter_heading(md_writer.phrase_with_link(ruin_name, '../'+md_writer.output_folder+'/'+file))
    md_writer.end_novel(css='http://mattfister.github.io/ruindogs/base.css')