From 221cb7409b6be1f0e80192588f28e5181c878b11 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 03:53:56 -0400 Subject: [PATCH 01/74] Initial commit --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..12d0b3b --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Dialogue Tree CLI Tool + +This tool allows for easy creation and use of dialogue trees. + +A dialogue tree is a series of dialogues which follow sequentially, though with +branching options. Examples include "Choose Your Own Adventure" games, or the +dialogues seen in many video games. + +## Structure + +A dialogue tree can be broken down into three distinct parts: the trunk, +branches, and leafs. The trunk is the beginning of the dialogue. Generally +speaking, it is a branch, with the exception that it has no previous options. A +branch represents a choice taken in the dialogue. Branches flow to each other +through leafs, which are the actual choices. A leaf is a data point, allowing +for specific configuration of what information gets passed to the next branch, +or even an end to the entire tree. + +## Building a New Tree + +To build a new tree, you have two options. You can manually edit a configuration +file, or go through the construction wizard. Either way, the end result is a +plain-text configuration file, which can be easily shared, edited, and viewed. + +### Manual Edit + +1. Open your preferred text editor. +2. Refer to the Configuration File documentation (docs/config\_file.md) +3. Make your changes. +4. Save your changes. + +### Automatic Edit + +1. Run the configuration editor: `sapling --editor [--new][--file FILE]` +2. If you choose to create a new dialogue, `sapling` will generate a new file in + your current directory. +3. If you choose to modify an existing file, `sapling` will show you the basic + overview of the tree, and prompt you where you wish to edit. +4. Make your changes. +5. Save your changes. From 2e216abdd38a0597e94e4ef1552763250e71e6e1 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 03:55:15 -0400 Subject: [PATCH 02/74] Add some initial and basic documentation --- docs/.config_file.md.un~ | Bin 0 -> 56690 bytes docs/.config_file_example.yaml.un~ | Bin 0 -> 74484 bytes docs/config_file.md | 45 +++++++++++++++++++++++++++++ docs/config_file_example.yaml | 41 ++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 docs/.config_file.md.un~ create mode 100644 docs/.config_file_example.yaml.un~ create mode 100644 docs/config_file.md create mode 100644 docs/config_file_example.yaml diff --git a/docs/.config_file.md.un~ b/docs/.config_file.md.un~ new file mode 100644 index 0000000000000000000000000000000000000000..e803cc39f97de875118721f3706d0cd06fa97c61 GIT binary patch literal 56690 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 literal 0 HcmV?d00001 diff --git a/docs/.config_file_example.yaml.un~ b/docs/.config_file_example.yaml.un~ new file mode 100644 index 0000000000000000000000000000000000000000..df2881a7855e2e0f86c54eff58746d7643d07926 GIT binary patch literal 74484 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

evT-8k~6?NZ> z!|9R~6&SLUlN_zp5|MS4!OH$v)p>)|L~Ex{kB{$l+-@nkRi>8>`n=+y0qH|*;RS$I z!jPeG&ul`%q!gzzdHucGTxjEI$;%XVmcDRl_9 z@^=hPj!#0eCO0^J#5Cc48$y$=g+KWthGQ=)+zZ)T3hGBIih$0^H^K?dUmVQ#Uil! z+ui!xvc-BHd9OFM0`rrm@qp&WEVqb}gQ>Ahj2Z&>Sqqm1B?c7=H|pEVK2HVZr%bEC z3|5k*obO}QA0SsZaM0ZT{-sTKYH6ZoPN|a35Lus z-{hgCF-o)=!m;-76P*rFjy<7O=hWf!8PhHp;@8>#j8UT15N=<#{>P{TX38x%MTOf> zn0CUHgJl0RMu}EKIR3fihzqF@M|=G5gilG~^jY0fY8b-JNlr=C5|K6T#DE^Dyg_t3 zM65j?r7}HxxOJ@BD;^qhA{lR6czY#z#Kr;A}MtU)4y{8^l<5RxRXlX z0ICTLoW7u2N)1D|p2%xCfMSINaaX_Jzw!q8+Xm2owjEz(dUkRFwDyV*pg{T}TX+HB zgcN4yGBk{kA|cRf-z_fWYzL*Zq~L7s%Z_??sow1dqo0(b0>492@+6E}B&7~v_6_T3 z@WT8E%&yZ;PilFV>e=?<;{0+o^9ihb+Cy0g0Ee|%uMm|1EUi=CyFxnspL8IF&wp#5nn zDque>B`2q9k(4?B^(#BApWZ5GyG@FsuDhf%@HZeu4fdl3lwnrS<^Ha-YzBkoH0tY8p5so{-;klVRlrCa*G-e!tgcIX83YY z*P1-AFqVl?Lzv!beGzxMLy9u(@kJdF!s&I>Bp9-zlgv#m5m{qNolygYax??NSB^Mt zx0S;`Tt>~$O;g*-Je8qFm9qM-u*_LWOMBqzbg6Yn+0KC;l{)9KSR+*|T=af$?{{#I zlyJFEZMzg8lgCb$aNYmRu$76dB(0jt&J-6`7tgKCcNQlntHH^F?5VOS%0($Vq>S-m z_E@ZtAgtD_pkrACk9E2{9Pq0)(gGBJBIyL`J_A)$ofpt}`-p6!@=j6SA!V}^7bP-1 zHBDqqaMRT%pr{T#rwhG@Ej@@4XGuNLAN4;VKew{--13>@$Cp=R8l0bAnO*3-IC-vf z@%Zzr?PWZ2`S_`O@44s1iPOjDIxn`)cUtqU=VrunTQjXoGZzRX@lqu-li8rbabf-^`kJcveh{NjF_+I^|ah_PmuNDH*3XnNv_GW99 zSRG3$%t2uP&3W@x^$wPe@n#2BZZ~hgv~s3 Date: Sat, 6 May 2017 03:56:00 -0400 Subject: [PATCH 03/74] Add gitignore file --- .gitignore | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fbcb054 --- /dev/null +++ b/.gitignore @@ -0,0 +1,54 @@ +# Global gitignore file +# bill_niblock@yahoo.com + +## +# Stolen from octocat: https://gist.github.com/octocat/9257657 +## + +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +## +# Additions +## + +# Vim Related # +############### +*.swp +.netrwhist +*.un~ From 4baca51880fc1269463a6c27532d4c4fde655aed Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 03:56:59 -0400 Subject: [PATCH 04/74] Remove undo files --- docs/.config_file.md.un~ | Bin 56690 -> 0 bytes docs/.config_file_example.yaml.un~ | Bin 74484 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/.config_file.md.un~ delete mode 100644 docs/.config_file_example.yaml.un~ diff --git a/docs/.config_file.md.un~ b/docs/.config_file.md.un~ deleted file mode 100644 index e803cc39f97de875118721f3706d0cd06fa97c61..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 56690 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 diff --git a/docs/.config_file_example.yaml.un~ b/docs/.config_file_example.yaml.un~ deleted file mode 100644 index df2881a7855e2e0f86c54eff58746d7643d07926..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 74484 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

evT-8k~6?NZ> z!|9R~6&SLUlN_zp5|MS4!OH$v)p>)|L~Ex{kB{$l+-@nkRi>8>`n=+y0qH|*;RS$I z!jPeG&ul`%q!gzzdHucGTxjEI$;%XVmcDRl_9 z@^=hPj!#0eCO0^J#5Cc48$y$=g+KWthGQ=)+zZ)T3hGBIih$0^H^K?dUmVQ#Uil! z+ui!xvc-BHd9OFM0`rrm@qp&WEVqb}gQ>Ahj2Z&>Sqqm1B?c7=H|pEVK2HVZr%bEC z3|5k*obO}QA0SsZaM0ZT{-sTKYH6ZoPN|a35Lus z-{hgCF-o)=!m;-76P*rFjy<7O=hWf!8PhHp;@8>#j8UT15N=<#{>P{TX38x%MTOf> zn0CUHgJl0RMu}EKIR3fihzqF@M|=G5gilG~^jY0fY8b-JNlr=C5|K6T#DE^Dyg_t3 zM65j?r7}HxxOJ@BD;^qhA{lR6czY#z#Kr;A}MtU)4y{8^l<5RxRXlX z0ICTLoW7u2N)1D|p2%xCfMSINaaX_Jzw!q8+Xm2owjEz(dUkRFwDyV*pg{T}TX+HB zgcN4yGBk{kA|cRf-z_fWYzL*Zq~L7s%Z_??sow1dqo0(b0>492@+6E}B&7~v_6_T3 z@WT8E%&yZ;PilFV>e=?<;{0+o^9ihb+Cy0g0Ee|%uMm|1EUi=CyFxnspL8IF&wp#5nn zDque>B`2q9k(4?B^(#BApWZ5GyG@FsuDhf%@HZeu4fdl3lwnrS<^Ha-YzBkoH0tY8p5so{-;klVRlrCa*G-e!tgcIX83YY z*P1-AFqVl?Lzv!beGzxMLy9u(@kJdF!s&I>Bp9-zlgv#m5m{qNolygYax??NSB^Mt zx0S;`Tt>~$O;g*-Je8qFm9qM-u*_LWOMBqzbg6Yn+0KC;l{)9KSR+*|T=af$?{{#I zlyJFEZMzg8lgCb$aNYmRu$76dB(0jt&J-6`7tgKCcNQlntHH^F?5VOS%0($Vq>S-m z_E@ZtAgtD_pkrACk9E2{9Pq0)(gGBJBIyL`J_A)$ofpt}`-p6!@=j6SA!V}^7bP-1 zHBDqqaMRT%pr{T#rwhG@Ej@@4XGuNLAN4;VKew{--13>@$Cp=R8l0bAnO*3-IC-vf z@%Zzr?PWZ2`S_`O@44s1iPOjDIxn`)cUtqU=VrunTQjXoGZzRX@lqu-li8rbabf-^`kJcveh{NjF_+I^|ah_PmuNDH*3XnNv_GW99 zSRG3$%t2uP&3W@x^$wPe@n#2BZZ~hgv~s3 Date: Sat, 6 May 2017 03:57:28 -0400 Subject: [PATCH 05/74] sapling.rb: A dialogue tree utility --- lib/sapling.rb | 245 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 lib/sapling.rb diff --git a/lib/sapling.rb b/lib/sapling.rb new file mode 100644 index 0000000..98a4bb2 --- /dev/null +++ b/lib/sapling.rb @@ -0,0 +1,245 @@ +#!/usr/bin/env ruby + +require 'optparse' +require 'yaml' + +# Gardner is the module for working with a dialogue tree file +module Gardner + + # Parse the branch + # + # @param tree [Array] The dialogue tree + # @return branches [Array] The array of options on the branch. + def self.prune_branches(tree) + branches = { 0 => { "desc" => "Thanks for using Sapling!" } } + tree.each do |b| + branches[b["branch"]["number"]] = { + "desc" => b["branch"]["text"], + "options" => prune_leaves(b["branch"]["leaf"]) } + end + + return branches + + end + + # Parse the options + # + # @param leaves [Array] The option of leaf hashes + # @return options [Hash] A has of options + def self.prune_leaves(leaves) + x = 1 + options = {} + leaves.each do |l| + options[x] = { l["text"] => l["branch"] } + x += 1 + end + + return options + + end + + # Parse the trunk + # The trunk is like the introduction to the tree. + # + # @param tree [Hash] The entire tree + # @return tree [Hash] The tree without the trunk + def self.prune_trunk(tree) + trunk = tree.shift + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" + 40.times { print "-" } + puts "\n#{trunk["trunk"]}" + 40.times { print "-" } + puts "\n" + + return tree + + end + + # The main method for Sapling. From here, the tree is grown. + # + # @param file [File] The dialogue tree file + # @return branches [Hash] The final, constructed data set + def self.grow(file) + tree = YAML.load_file(file[0]) + tree = Gardner.prune_trunk(tree) + branches = Gardner.prune_branches(tree) + + return branches + end + + # Verify that a file is a dialogue tree file. + # + # @param file [File] The provided file + # @return status [Boolean] True if the file is a tree; false otherwise + def self.verify_tree(file) + results = [] + begin + tree = YAML.load_file(file) + results << tree[0].keys.include?("trunk") + results << tree[1]["branch"].keys.include?("number") + results << tree[1]["branch"].keys.include?("text") + results << tree[1]["branch"].keys.include?("leaf") + rescue + puts "Sorry chummer, I don't think this is a tree." + puts "Verify your YAML file is formatted properly." + results << false + end + + results.include?(false) ? false : true + + end + +end + +# Dialogue is the module for traversing an existing tree. +module Dialogue + + class Speaker + attr_accessor :file + + def initialize + @file = "" + end + + # Scribe generates the new data set, which provides properly organized + # branches and choices + def scribe + tree = Gardner.grow(@file) + conversation(tree) + end + + # Conversation handles navigating the tree, until the option to end is + # reached. + # + # @param tree [Hash] The data set of branches and associated choices + def conversation(tree) + 10.times { print "*" } + next_branch = talk(tree[1]) + until next_branch == 0 do + next_branch = talk(tree[next_branch]) + end + + puts tree[0]["desc"] + exit + end + + # Talk displays a branch, the options, and prompts for a response + # + # @param branch [Hash] A branch data set + # @return response [Integer] The number of the next branch + def talk(branch) + puts "\n#{branch["desc"]}\n\n" + branch["options"].each_pair do |k,v| + puts "\t#{k}: #{v.keys[0]}" + end + + print "> " + STDOUT.flush + response = STDIN.gets.chomp.to_i + + puts "\n" + 10.times { print "*" } + puts "\n(Your choice: #{branch["options"][response].keys[0]})" + return branch["options"][response].values[0].to_i + end + + end + +end + +# Planter is the module for creating or editing a tree. +module Planter + +end + +# Parsing is the class for option parsing, and the gateway to the program +class Parsing + + # Option parsing, and gateway to either reading and traversing a tree, or + # editing/creating a tree. + # + # @params file [String] The location of the file to read, or write. + def talk(options) + opt_parser = OptionParser.new do |opt| + opt.banner = "Usage: sapling [-t][-e] FILE" \ + + opt.on_tail("-h", "--help", "Show this menu") do + puts opt + exit + end + + opt.on("-t", "--talk", + "Begin traversing the provided dialogue tree") do + + if ARGV.empty? + puts opt_parser + exit + end + + unless Gardner.verify_tree(ARGV[0]) + puts "\n#{opt}\n" + exit + end + + speaker = Dialogue::Speaker.new + speaker.file = ARGV + speaker.scribe + end + + opt.on("-e", "--edit", + "Create or edit a dialogue tree") do + puts "We gonna make a tree!" + end + + end + opt_parser.parse!(options) + + if ARGV.empty? + puts opt_parser + exit + end + + end + +end + +Parsing.new.talk(ARGV) + +=begin + +For a given tree: + +tree[0] is the trunk. We want to display this, then pull it out of the array. +With the trunk gone, the remaining tree top-level elements are branches. +Now, we can parse each branch by doing tree.each { |b| parse_branch(b) } +parse_branch puts each branch into an array, at the location of it's number +At branch[0], it puts logic to end the program. +Now, we have a convenient way of moving around: when a leaf points to a branch, +we just reference branch[n] to get to that branch. + +Traversing the tree thus goes like such: +- Start the loop by pulling in the appropriate branch. If the branch called is [0], +then we're done. End the program. +- Display all relevant information, formatted to display the text, followed by a +blank line, followed by the options, 1 per line, and numbered accordingly. At the +bottom is a prompt. +- The prompt expects a number. Anything not a number just displays another prompt +on the next line. +- Upon choosing that option, restart the loop with the new branch. + +Parsing a branch: +- Format is tree[x] = branch element + tree[x]["branch"]["number"] is the branch number, aka the @branches array place + tree[x]["branch"]["text"] is the branch text + branches[tree[x]["branch"]["number"] = { + "desc" => tree[x]["branch"]["text"], + "options" => options_hash } + options_hash = {} + + { branch_number => + { "desc" => branch_text, + "options" => { + { 1 => { leaf_text => next_branch }, + 2 => { leaf_text => next_branch }} + +=end From 508b1f70c0cc66931b64b39109092da969d10395 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 14:37:10 -0400 Subject: [PATCH 06/74] docs/editor.md: Skeleton editor documentation --- docs/editor.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/editor.md diff --git a/docs/editor.md b/docs/editor.md new file mode 100644 index 0000000..29fe5d9 --- /dev/null +++ b/docs/editor.md @@ -0,0 +1,12 @@ +# Sapling Editor + +Sapling provides an editor for creating and modifying dialogue trees. The editor +allows for editing all parts of a tree, from the trunk to the leaves. + +## Creating a new tree + +Pending + +## Editing an existing tree + +Pending From 593b45ce14f6797afdbbdb3ec35a45c48c52ac00 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 14:38:53 -0400 Subject: [PATCH 07/74] lib/sapling.rb: Improve branch handling - Show viable options in prompt. - If a user does not select a viable option, inform them, and prompt again. - Allow for terimnal branches. A terminal branch has no options. More details in the Configuration File documentation. --- lib/sapling.rb | 77 +++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 98a4bb2..fdb28ca 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -29,6 +29,9 @@ module Gardner def self.prune_leaves(leaves) x = 1 options = {} + + return options if leaves.nil? + leaves.each do |l| options[x] = { l["text"] => l["branch"] } x += 1 @@ -101,18 +104,12 @@ module Dialogue @file = "" end - # Scribe generates the new data set, which provides properly organized - # branches and choices - def scribe - tree = Gardner.grow(@file) - conversation(tree) - end - # Conversation handles navigating the tree, until the option to end is # reached. # - # @param tree [Hash] The data set of branches and associated choices - def conversation(tree) + def conversation() + tree = Gardner.grow(@file) + 10.times { print "*" } next_branch = talk(tree[1]) until next_branch == 0 do @@ -128,15 +125,31 @@ module Dialogue # @param branch [Hash] A branch data set # @return response [Integer] The number of the next branch def talk(branch) + # If there are no options on this branch, we assume it's a terminal + # branch. Return 0, and end the program. + if branch["options"].empty? + puts "\n#{branch["desc"]}\n\n" + return 0 + end + + valid_options = branch["options"].keys.join(", ") + puts "\n#{branch["desc"]}\n\n" branch["options"].each_pair do |k,v| puts "\t#{k}: #{v.keys[0]}" end - print "> " + print "\n[#{valid_options}]> " STDOUT.flush response = STDIN.gets.chomp.to_i + until branch["options"].keys.include?(response) + print "[## Invalid options. " + print "Valid options are #{valid_options}, or 0 to exit." + print "\n[#{valid_options}]> " + response = STDIN.gets.chomp.to_i + end + puts "\n" 10.times { print "*" } puts "\n(Your choice: #{branch["options"][response].keys[0]})" @@ -161,7 +174,8 @@ class Parsing # @params file [String] The location of the file to read, or write. def talk(options) opt_parser = OptionParser.new do |opt| - opt.banner = "Usage: sapling [-t][-e] FILE" \ + opt.banner = "Usage: sapling -t FILE\n" \ + "Usage: sapling -e [FILE]" opt.on_tail("-h", "--help", "Show this menu") do puts opt @@ -183,7 +197,7 @@ class Parsing speaker = Dialogue::Speaker.new speaker.file = ARGV - speaker.scribe + speaker.conversation end opt.on("-e", "--edit", @@ -204,42 +218,3 @@ class Parsing end Parsing.new.talk(ARGV) - -=begin - -For a given tree: - -tree[0] is the trunk. We want to display this, then pull it out of the array. -With the trunk gone, the remaining tree top-level elements are branches. -Now, we can parse each branch by doing tree.each { |b| parse_branch(b) } -parse_branch puts each branch into an array, at the location of it's number -At branch[0], it puts logic to end the program. -Now, we have a convenient way of moving around: when a leaf points to a branch, -we just reference branch[n] to get to that branch. - -Traversing the tree thus goes like such: -- Start the loop by pulling in the appropriate branch. If the branch called is [0], -then we're done. End the program. -- Display all relevant information, formatted to display the text, followed by a -blank line, followed by the options, 1 per line, and numbered accordingly. At the -bottom is a prompt. -- The prompt expects a number. Anything not a number just displays another prompt -on the next line. -- Upon choosing that option, restart the loop with the new branch. - -Parsing a branch: -- Format is tree[x] = branch element - tree[x]["branch"]["number"] is the branch number, aka the @branches array place - tree[x]["branch"]["text"] is the branch text - branches[tree[x]["branch"]["number"] = { - "desc" => tree[x]["branch"]["text"], - "options" => options_hash } - options_hash = {} - - { branch_number => - { "desc" => branch_text, - "options" => { - { 1 => { leaf_text => next_branch }, - 2 => { leaf_text => next_branch }} - -=end From 0e7b80c7404fd68e9117a12e678ae63a6c932864 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:12:11 -0400 Subject: [PATCH 08/74] docs/config_file_example.yaml: Self-document! - Change the example configuration file from a tree to a self-documented reference. You can still run it in sapling, but it's pretty boring. - Moved previous example configuration to "Example Quest", in the trees directory. --- docs/config_file_example.yaml | 51 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/docs/config_file_example.yaml b/docs/config_file_example.yaml index 4bf0d59..03a1ce2 100644 --- a/docs/config_file_example.yaml +++ b/docs/config_file_example.yaml @@ -1,41 +1,36 @@ --- -- trunk: "Example Quest: Learn what it looks like to use Sapling!" +# The trunk is a general introduction to the tree. It shouldn't include any +# thematic details, rather a one-liner to let the user know what they're getting +# into. +- trunk: "This is a general introduction to the dialogue tree." +# Branches are the content of a dialogue tree. Each branch is numbered, and that +# number is used as the primary means of navigation. The text of a branch is the +# story provided to the user; the result of getting to the branch. The leaves +# (the section titled leaf) represent the options. Options are displayed in the +# order they appear. Within a leaf, the text is what the option says, and the +# branch is the branch number which this option will lead to. Leading to branch +# number 0 will immediately exit the program. +# +# You can have as many branches and leaves as you wish, though having too many +# leaves may lead to both display problems, and paralyzing indecision. - branch: number: 1 - text: "You stumble upon the first branch of a dialogue tree. - You find yourself at a junction..." + text: "The first branch. Displayed first, by default." leaf: - - text: "Go to the next branch." + text: "The first option for this branch. It leads to branch 2" branch: 2 - - text: "Leave this silly place." + text: "The second branch. It immediately exits the program." branch: 0 + +# A terminal branch is a branch which has no leaves. This represents an ending. +# Once a user hits a terminal branch, the program will display the branch text, +# and then redirect the user to branch 0, to exit. - branch: number: 2 - text: "Ye find yeself at branch 2. Your options are north, south - or Dennis." - leaf: - - - text: "North" - branch: 3 - - - text: "South (back the way you came)" - branch: 1 - - - text: "Dennis" - branch: 0 -- - branch: - number: 3 - text: "It's cold up here. You decide to go someplace else!" - leaf: - - - text: "Head on home." - branch: 0 - - - text: "Head south (back the way you came)" - branch: 2 + text: "This is a terminal branch. After displaying this text, + the program will exit." From ada5787f8dc81120e0df91a756d58eba9901d32c Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:13:13 -0400 Subject: [PATCH 09/74] trees/example_quest.yaml: Example Quest! Adventure! - Example Quest is a meta dialogue, designed to walk the user through understanding what sapling is, and how it works. - Used to be the configuration file example, but now it's all grown up and ready for big-boy pants. --- trees/example_quest.yaml | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 trees/example_quest.yaml diff --git a/trees/example_quest.yaml b/trees/example_quest.yaml new file mode 100644 index 0000000..48735c3 --- /dev/null +++ b/trees/example_quest.yaml @@ -0,0 +1,45 @@ +--- +- trunk: "Example Quest: Learn what it looks like to use Sapling!" + +- + branch: + number: 1 + text: "You stumble upon the first branch of a dialogue tree. + You find yourself at a junction..." + leaf: + - + text: "Go to the next branch." + branch: 2 + - + text: "Leave this silly place." + branch: 0 +- + branch: + number: 2 + text: "Ye find yeself at branch 2. Your options are north, south + or Dennis." + leaf: + - + text: "North" + branch: 3 + - + text: "South (back the way you came)" + branch: 1 + - + text: "Dennis" + branch: 0 +- + branch: + number: 3 + text: "It's cold up here. You decide to go someplace else!" + leaf: + - + text: "Head on home." + branch: 4 + - + text: "Head south (back the way you came)" + branch: 2 +- + branch: + number: 4 + text: "You head on home!" From df8a24b506e4774911cf8eb4a45f96f3ad236933 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:20:17 -0400 Subject: [PATCH 10/74] trees/example_quest.yaml: Finish the quest! --- trees/example_quest.yaml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/trees/example_quest.yaml b/trees/example_quest.yaml index 48735c3..6c79dd1 100644 --- a/trees/example_quest.yaml +++ b/trees/example_quest.yaml @@ -11,7 +11,14 @@ text: "Go to the next branch." branch: 2 - - text: "Leave this silly place." + text: "Go to the frigid northlands, because there's always a + frigid northlands." + branch: 3 + - + text: "Leave this silly place, but with a reason." + branch: 5 + - + text: "Leave this silly place immediately, without any reason." branch: 0 - branch: @@ -20,14 +27,14 @@ or Dennis." leaf: - - text: "North" + text: "North, to frigidity!" branch: 3 - - text: "South (back the way you came)" + text: "South, back the way you came!" branch: 1 - text: "Dennis" - branch: 0 + branch: 6 - branch: number: 3 @@ -42,4 +49,21 @@ - branch: number: 4 - text: "You head on home!" + text: "You head on home! Bye bye!" +- + branch: + number: 5 + text: "You leave the dialogue tree, and all its textual glory, behind + and go find a nice GUI to settle down with." +- + branch: + number: 6 + text: "Dennis appreciates your interest, but is really just trying to + hangout and play video games." + leaf: + - + text: "Join Dennis, and play video games with him." + branch: 7 + - + text: "Reconsider your options." + branch: 2 From 9cc77d6321ec56b3fc60f8008c865bbcfd869d02 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:38:52 -0400 Subject: [PATCH 11/74] LICENSE: Add MIT license --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8469e54 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Bill Niblock + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From d02bf204cc0e4d2b33ee919b29531c063f0f46a1 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:39:15 -0400 Subject: [PATCH 12/74] CONTRIBUTING.md: Contribution guidelines --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5d002c4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Contributing to Sapling + +If you actually want to contribute to this software, first off: Thanks! Sapling +is just a side-project, unintended for any significant use. + +Sapling is written in Ruby, and adheres to the standard Rubocop rules. So long +as your code passes those rules, it should be good. At time of writing, Sapling +has no testing, because I honestly have very little experience writing tests. +Hopefully this changes soon! + +If you don't know how to program in Ruby, but wish to improve this software, +feel free to submit an issue or reach out to me directly. + +Thanks again for your interest in Sapling! From 562aeb2437e0b52048bcefbe5ca029f4dc948f12 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 15:39:33 -0400 Subject: [PATCH 13/74] README.md: Update to most current correct info --- README.md | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 12d0b3b..7009c49 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Dialogue Tree CLI Tool +# Sapling: A Dialogue Tree CLI Utility -This tool allows for easy creation and use of dialogue trees. +Sapling allows for easy creation and use of dialogue trees. A dialogue tree is a series of dialogues which follow sequentially, though with branching options. Examples include "Choose Your Own Adventure" games, or the @@ -9,32 +9,59 @@ dialogues seen in many video games. ## Structure A dialogue tree can be broken down into three distinct parts: the trunk, -branches, and leafs. The trunk is the beginning of the dialogue. Generally -speaking, it is a branch, with the exception that it has no previous options. A +branches, and leafs. The trunk represents the main structure of the tree. Unlike +a branch, which displays content and options, the trunk provides metadata. +Generally speaking, it is a branch, with the exception that it has no options. A branch represents a choice taken in the dialogue. Branches flow to each other -through leafs, which are the actual choices. A leaf is a data point, allowing -for specific configuration of what information gets passed to the next branch, -or even an end to the entire tree. +through leafs, which are the actual choices. + +You can experience this yourself, by loading "Example Quest! - A Meta Dialogue +Tree!". You can find the tree itself at [trees/example\_quest.yaml]( +trees/example_quest.yaml). To run it, just type `sapling -t +trees/example_quest.yaml`. ## Building a New Tree To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. +For more details on the configuration file itself, check out the [Configuration + File documentation](docs/config_file.md), or the self-documented [configuration + file example](docs/config_file_example.yaml). Alternatively, you can checkout +[Example Quest](trees/example_quest.yaml) for a complete treel ### Manual Edit 1. Open your preferred text editor. -2. Refer to the Configuration File documentation (docs/config\_file.md) +2. Refer to the [Configuration File documentation](docs/config_file.md) 3. Make your changes. 4. Save your changes. -### Automatic Edit +### Automatic Edit -- Coming Soon(tm)! -1. Run the configuration editor: `sapling --editor [--new][--file FILE]` +1. Run the configuration editor: `sapling --edit [--new][--file FILE]` 2. If you choose to create a new dialogue, `sapling` will generate a new file in your current directory. -3. If you choose to modify an existing file, `sapling` will show you the basic - overview of the tree, and prompt you where you wish to edit. +3. If you choose to modify an existing file, `sapling` will open the tree at the + trunk, and show you the first branch. 4. Make your changes. 5. Save your changes. + +More details on the editor can be found in the [Editor +documentation](docs/editor.md). + +## Contributing + +You can contribute to Sapling by following these instructions: +1. Fork this repository. +2. In your fork, make your changes. +3. Make sure your changes respect the [contribution + guidelines](CONTRIBUTING.md). +4. Submit a pull request. + +## License + +Sapling is licensed under the MIT license. The full text can be found in +[LICENSE](LICENSE). + +(c) 2017 Bill Niblock From 19fdb26cb76d69e9ca9e60ce0fc3821273b5ea65 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 16:18:52 -0400 Subject: [PATCH 14/74] trees/example_quest.yaml: Video games! - Add branch 7, to actually finish the entire tree. Nice! --- trees/example_quest.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/trees/example_quest.yaml b/trees/example_quest.yaml index 6c79dd1..e27b566 100644 --- a/trees/example_quest.yaml +++ b/trees/example_quest.yaml @@ -11,8 +11,8 @@ text: "Go to the next branch." branch: 2 - - text: "Go to the frigid northlands, because there's always a - frigid northlands." + text: "Go to the frigid north-lands, because there's always a + frigid north-lands." branch: 3 - text: "Leave this silly place, but with a reason." @@ -23,7 +23,7 @@ - branch: number: 2 - text: "Ye find yeself at branch 2. Your options are north, south + text: "Ye find ye-self at branch 2. Your options are north, south or Dennis." leaf: - @@ -67,3 +67,8 @@ - text: "Reconsider your options." branch: 2 +- + branch: + number: 7 + text: "You sit down next to Dennis, and together you conquer all sorts of + realms and wizards and stuff. Nice!" From 893c71ea51f77662f6c4a6af3eb3f56eabe5c005 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 17:29:47 -0400 Subject: [PATCH 15/74] Start using Bundler - Add Gemfile - Add auto-generated Gemfile.lock --- Gemfile | 6 ++++++ Gemfile.lock | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..c33ed34 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +# frozen_string_literal: true +source "https://rubygems.org" + +gem "rubocop" +gem "yard" +gem "yard-ghpages" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..f5ca927 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,35 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.3.0) + git (1.3.0) + parser (2.4.0.0) + ast (~> 2.2) + powerpack (0.1.1) + rainbow (2.2.2) + rake + rake (11.3.0) + rubocop (0.48.1) + parser (>= 2.3.3.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + unicode-display_width (1.2.1) + yard (0.9.9) + yard-ghpages (0.0.2) + git (~> 1.3) + rake (~> 11.1) + yard (~> 0.8) + +PLATFORMS + ruby + +DEPENDENCIES + rubocop + yard + yard-ghpages + +BUNDLED WITH + 1.13.7 From c729916f9dba44300361337847d1dd0b99265fd7 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 17:34:19 -0400 Subject: [PATCH 16/74] Start using Yard - Add yard to Gemfile - Configure .yardopts to pull in proper files - Update custom docs to include yard metadata --- .yardopts | 9 +++ README.md | 5 ++ docs/config_file.md | 5 ++ docs/config_file_example.md | 42 +++++++++++++ docs/config_file_example.yaml | 1 + docs/editor.md | 4 ++ lib/sapling.rb | 107 +++++++++++++++++----------------- 7 files changed, 121 insertions(+), 52 deletions(-) create mode 100644 .yardopts create mode 100644 docs/config_file_example.md diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000..6ccae4b --- /dev/null +++ b/.yardopts @@ -0,0 +1,9 @@ +--title "Sapling Documentation" +- +README.md +docs/config_file.md +docs/config_file_example.md +docs/editor.md +CONTRIBUTING.md +LICENSE +lib/**.*.rb diff --git a/README.md b/README.md index 7009c49..af8be4b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Sapling: A Dialogue Tree CLI Utility Sapling allows for easy creation and use of dialogue trees. diff --git a/docs/config_file.md b/docs/config_file.md index d0ad949..bc72f3a 100644 --- a/docs/config_file.md +++ b/docs/config_file.md @@ -1,3 +1,8 @@ + + # Configuration File Documentation The configuration file for `sapling` is a standard YAML file. The general diff --git a/docs/config_file_example.md b/docs/config_file_example.md new file mode 100644 index 0000000..8a9acdd --- /dev/null +++ b/docs/config_file_example.md @@ -0,0 +1,42 @@ + +# Example Dialogue Tree + --- + # The trunk is a general introduction to the tree. It shouldn't include any + # thematic details, rather a one-liner to let the user know what they're getting + # into. + - + trunk: "This is a general introduction to the dialogue tree." + + # Branches are the content of a dialogue tree. Each branch is numbered, and that + # number is used as the primary means of navigation. The text of a branch is the + # story provided to the user; the result of getting to the branch. The leaves + # (the section titled leaf) represent the options. Options are displayed in the + # order they appear. Within a leaf, the text is what the option says, and the + # branch is the branch number which this option will lead to. Leading to branch + # number 0 will immediately exit the program. + # + # You can have as many branches and leaves as you wish, though having too many + # leaves may lead to both display problems, and paralyzing indecision. + - + branch: + number: 1 + text: "The first branch. Displayed first, by default." + leaf: + - + text: "The first option for this branch. It leads to branch 2" + branch: 2 + - + text: "The second branch. It immediately exits the program." + branch: 0 + + # A terminal branch is a branch which has no leaves. This represents an ending. + # Once a user hits a terminal branch, the program will display the branch text, + # and then redirect the user to branch 0, to exit. + - + branch: + number: 2 + text: "This is a terminal branch. After displaying this text, + the program will exit." diff --git a/docs/config_file_example.yaml b/docs/config_file_example.yaml index 03a1ce2..1a6551e 100644 --- a/docs/config_file_example.yaml +++ b/docs/config_file_example.yaml @@ -1,3 +1,4 @@ +# @title Example YAML File --- # The trunk is a general introduction to the tree. It shouldn't include any # thematic details, rather a one-liner to let the user know what they're getting diff --git a/docs/editor.md b/docs/editor.md index 29fe5d9..5b4106e 100644 --- a/docs/editor.md +++ b/docs/editor.md @@ -1,3 +1,7 @@ + # Sapling Editor Sapling provides an editor for creating and modifying dialogue trees. The editor diff --git a/lib/sapling.rb b/lib/sapling.rb index fdb28ca..a7348dc 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -9,7 +9,7 @@ module Gardner # Parse the branch # # @param tree [Array] The dialogue tree - # @return branches [Array] The array of options on the branch. + # @return [Array] The array of options on the branch. def self.prune_branches(tree) branches = { 0 => { "desc" => "Thanks for using Sapling!" } } tree.each do |b| @@ -25,7 +25,7 @@ module Gardner # Parse the options # # @param leaves [Array] The option of leaf hashes - # @return options [Hash] A has of options + # @return [Hash] A has of options def self.prune_leaves(leaves) x = 1 options = {} @@ -45,7 +45,7 @@ module Gardner # The trunk is like the introduction to the tree. # # @param tree [Hash] The entire tree - # @return tree [Hash] The tree without the trunk + # @return [Hash] The tree without the trunk def self.prune_trunk(tree) trunk = tree.shift puts "Welcome to Sapling, a Dialogue Tree Utility.\n" @@ -61,7 +61,7 @@ module Gardner # The main method for Sapling. From here, the tree is grown. # # @param file [File] The dialogue tree file - # @return branches [Hash] The final, constructed data set + # @return [Hash] The final, constructed data set def self.grow(file) tree = YAML.load_file(file[0]) tree = Gardner.prune_trunk(tree) @@ -73,7 +73,7 @@ module Gardner # Verify that a file is a dialogue tree file. # # @param file [File] The provided file - # @return status [Boolean] True if the file is a tree; false otherwise + # @return [Boolean] True if the file is a tree; false otherwise def self.verify_tree(file) results = [] begin @@ -97,7 +97,10 @@ end # Dialogue is the module for traversing an existing tree. module Dialogue + # Spealer holds the functionality for viewing and going through a dialogue + # tree. class Speaker + # The file, which should be a dialogue tree YAML file. attr_accessor :file def initialize @@ -106,7 +109,6 @@ module Dialogue # Conversation handles navigating the tree, until the option to end is # reached. - # def conversation() tree = Gardner.grow(@file) @@ -123,7 +125,7 @@ module Dialogue # Talk displays a branch, the options, and prompts for a response # # @param branch [Hash] A branch data set - # @return response [Integer] The number of the next branch + # @return [Integer] The number of the next branch def talk(branch) # If there are no options on this branch, we assume it's a terminal # branch. Return 0, and end the program. @@ -165,56 +167,57 @@ module Planter end -# Parsing is the class for option parsing, and the gateway to the program -class Parsing +# Sapling is the main module for the program. From here, the rest of the world +# starts building. +module Sapling - # Option parsing, and gateway to either reading and traversing a tree, or - # editing/creating a tree. - # - # @params file [String] The location of the file to read, or write. - def talk(options) - opt_parser = OptionParser.new do |opt| - opt.banner = "Usage: sapling -t FILE\n" \ - "Usage: sapling -e [FILE]" + # CLI is the class for option parsing, and the gateway to the program + class CLI - opt.on_tail("-h", "--help", "Show this menu") do - puts opt + # Option parsing, and gateway to either reading and traversing a tree, or + # editing/creating a tree. + def talk(options) + opt_parser = OptionParser.new do |opt| + opt.banner = "Usage: sapling -t FILE\n" \ + "Usage: sapling -e [FILE]" + + opt.on_tail("-h", "--help", "Show this menu") do + puts opt + exit + end + + opt.on("-t", "--talk", + "Begin traversing the provided dialogue tree") do + + if ARGV.empty? + puts opt_parser + exit + end + + unless Gardner.verify_tree(ARGV[0]) + puts "\n#{opt}\n" + exit + end + + speaker = Dialogue::Speaker.new + speaker.file = ARGV + speaker.conversation + end + + opt.on("-e", "--edit", + "Create or edit a dialogue tree") do + puts "We gonna make a tree!" + end + + end + opt_parser.parse!(options) + + if ARGV.empty? + puts opt_parser exit end - - opt.on("-t", "--talk", - "Begin traversing the provided dialogue tree") do - - if ARGV.empty? - puts opt_parser - exit - end - - unless Gardner.verify_tree(ARGV[0]) - puts "\n#{opt}\n" - exit - end - - speaker = Dialogue::Speaker.new - speaker.file = ARGV - speaker.conversation - end - - opt.on("-e", "--edit", - "Create or edit a dialogue tree") do - puts "We gonna make a tree!" - end - end - opt_parser.parse!(options) - - if ARGV.empty? - puts opt_parser - exit - end - end - end -Parsing.new.talk(ARGV) +Sapling::CLI.new.talk(ARGV) From c240b494fce1181af2a90791312c0a06227526dc Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 17:35:37 -0400 Subject: [PATCH 17/74] Auto-publish docs to gh-pages with yard-ghpages - Add yard-ghpages to Gemfile - Create Rakefile with yard-ghpages tasks for publishing to gh-pages --- Rakefile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..84a15c3 --- /dev/null +++ b/Rakefile @@ -0,0 +1,3 @@ +require 'yard-ghpages' + +Yard::GHPages::Tasks.install_tasks From a10e53d6897809a15cedb12fd7195943096943bd Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 17:37:29 -0400 Subject: [PATCH 18/74] .gitignore: Update for YARD --- .gitignore | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fbcb054..fadeed9 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,7 @@ .Spotlight-V100 .Trashes ehthumbs.db -Thumbs.db +Thumbs.db ## # Additions @@ -52,3 +52,11 @@ Thumbs.db *.swp .netrwhist *.un~ + +# YARD Related # +################ +# doc/ is the generated documentation for Yard, which can easily be generated +# locally with yardoc +# .yardoc/ is yard metadata, not necessary to be uploaded to GH +doc/ +.yardoc/ From edcccc1869ae55107014b50f506470d216e43ac7 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 17:41:40 -0400 Subject: [PATCH 19/74] Update yard docs --- Gemfile | 7 ++++++- Gemfile.lock | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c33ed34..fb9733d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,11 @@ # frozen_string_literal: true source "https://rubygems.org" -gem "rubocop" +# Documentation +gem "rdoc" +gem "redcarpet" gem "yard" gem "yard-ghpages" + +# Testing +gem "rubocop" diff --git a/Gemfile.lock b/Gemfile.lock index f5ca927..8830853 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,8 @@ GEM rainbow (2.2.2) rake rake (11.3.0) + rdoc (5.1.0) + redcarpet (3.4.0) rubocop (0.48.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) @@ -27,6 +29,8 @@ PLATFORMS ruby DEPENDENCIES + rdoc + redcarpet rubocop yard yard-ghpages From ee682ece5d5d39fe71a02259ef17aebd2dd6bfd7 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 18:06:00 -0400 Subject: [PATCH 20/74] Update formatting - README.md: Remove unnecessary copyright line - docs/config_file.md: Update the example YAML file to actually be proper. - docs/config_file.md: Expand information to cover entire configuration file. --- README.md | 2 -- docs/config_file.md | 66 ++++++++++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index af8be4b..2bc1415 100644 --- a/README.md +++ b/README.md @@ -68,5 +68,3 @@ You can contribute to Sapling by following these instructions: Sapling is licensed under the MIT license. The full text can be found in [LICENSE](LICENSE). - -(c) 2017 Bill Niblock diff --git a/docs/config_file.md b/docs/config_file.md index bc72f3a..689a591 100644 --- a/docs/config_file.md +++ b/docs/config_file.md @@ -9,42 +9,58 @@ The configuration file for `sapling` is a standard YAML file. The general outline looks something like this: --- - trunk: - desc: This is a description of the dialogue tree. - - branch: + - + trunk: "This is a description of the dialogue tree." + - + branch: number: 1 text: "This is the overall text for the branch." - - leaf: 1 - text: "This is option 1." - branch: 2 - - leaf: 2 - text: "This is option 2." - branch: 3 - - branch: + leaf: + - + text: "This is option 1." + branch: 2 + - + text: "This is option 2." + branch: 3 + - + branch: number: 2 text: "This is the overall text for the branch." - - leaf: 1 - text: "This is option 1, on branch 2!" - branch: 3 - - branch: + leaf: + - + text: "This is option 1." + branch: 1 + - + text: "This is option 2." + branch: 3 + - + branch: number: 3 text: "This is the overall text for the branch." - - leaf: 1 - text: "This is option 3, branch 3" - branch: 0 ## Outline -Each branch has the following options: +#### Trunk -- `number`: The branch number. This is a number, but must be unique. -- `text`: The text provided by getting to this branch. The first branch is - shown by default when the tree is opened. -- `leaf`: Each leaf represents an option on the branch. The value of the leaf is - the number of the option shown. For example, `leaf: 1` represents the first - listed option. +The `trunk` is a metadata list. Currently, the only information we really care +about is a general description for the tree. Because of this, `trunk` is the +key, and the description is the value. -Each leaf has the following options: +#### Branch + +Branches are the content of a dialogue tree. Each `branch` has the following +options: + +- `number`: The branch number. This is how leaves get around. It must be unique. +- `text`: The text provided by getting to this branch. The first branch is shown + by default when the tree is opened. +- `leaf`: [Optional] The list of options for the branch. Details for leaves are + below. If no leaves are provided, the branch is considered a "terminal + branch", and the program will end after reaching it. + +#### Leaf + +Leaves are the options of a branch. Each `leaf` has the following options: - `text`: The text shown as the option. - `branch`: The branch this option takes the user to. From 04b52c13fcf1019f6c875cc20b87dee10f36f2c9 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 18:12:33 -0400 Subject: [PATCH 21/74] Repo organizing - Add doc/ directory, so publishing to gh-pages is a bit easier. - Update .gitignore to not ignore the doc/ directory. - Move manual documentation directory into new var directory (var/docs) - Move example dialogue tree into new var directory (var/trees) - Update YARD to find manual documentation in new var directory --- .gitignore | 1 - .yardopts | 6 +- doc/Dialogue.html | 126 +++++ doc/Dialogue/Speaker.html | 545 ++++++++++++++++++++++ doc/Gardner.html | 738 ++++++++++++++++++++++++++++++ doc/Planter.html | 116 +++++ doc/Sapling.html | 127 +++++ doc/Sapling/CLI.html | 292 ++++++++++++ doc/_index.html | 183 ++++++++ doc/class_list.html | 51 +++ doc/css/common.css | 1 + doc/css/full_list.css | 58 +++ doc/css/style.css | 492 ++++++++++++++++++++ doc/file.CONTRIBUTING.html | 84 ++++ doc/file.LICENSE.html | 92 ++++ doc/file.README.html | 141 ++++++ doc/file.config_file.html | 136 ++++++ doc/file.config_file_example.html | 110 +++++ doc/file.editor.html | 82 ++++ doc/file_list.html | 81 ++++ doc/frames.html | 17 + doc/index.html | 141 ++++++ doc/js/app.js | 248 ++++++++++ doc/js/full_list.js | 216 +++++++++ doc/js/jquery.js | 4 + doc/method_list.html | 131 ++++++ doc/top-level-namespace.html | 110 +++++ var/docs/config_file.md | 66 +++ var/docs/config_file_example.md | 42 ++ var/docs/config_file_example.yaml | 37 ++ var/docs/editor.md | 16 + var/trees/example_quest.yaml | 74 +++ 32 files changed, 4560 insertions(+), 4 deletions(-) create mode 100644 doc/Dialogue.html create mode 100644 doc/Dialogue/Speaker.html create mode 100644 doc/Gardner.html create mode 100644 doc/Planter.html create mode 100644 doc/Sapling.html create mode 100644 doc/Sapling/CLI.html create mode 100644 doc/_index.html create mode 100644 doc/class_list.html create mode 100644 doc/css/common.css create mode 100644 doc/css/full_list.css create mode 100644 doc/css/style.css create mode 100644 doc/file.CONTRIBUTING.html create mode 100644 doc/file.LICENSE.html create mode 100644 doc/file.README.html create mode 100644 doc/file.config_file.html create mode 100644 doc/file.config_file_example.html create mode 100644 doc/file.editor.html create mode 100644 doc/file_list.html create mode 100644 doc/frames.html create mode 100644 doc/index.html create mode 100644 doc/js/app.js create mode 100644 doc/js/full_list.js create mode 100644 doc/js/jquery.js create mode 100644 doc/method_list.html create mode 100644 doc/top-level-namespace.html create mode 100644 var/docs/config_file.md create mode 100644 var/docs/config_file_example.md create mode 100644 var/docs/config_file_example.yaml create mode 100644 var/docs/editor.md create mode 100644 var/trees/example_quest.yaml diff --git a/.gitignore b/.gitignore index fadeed9..3a20835 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,4 @@ Thumbs.db # doc/ is the generated documentation for Yard, which can easily be generated # locally with yardoc # .yardoc/ is yard metadata, not necessary to be uploaded to GH -doc/ .yardoc/ diff --git a/.yardopts b/.yardopts index 6ccae4b..bd3f342 100644 --- a/.yardopts +++ b/.yardopts @@ -1,9 +1,9 @@ --title "Sapling Documentation" - README.md -docs/config_file.md -docs/config_file_example.md -docs/editor.md +var/docs/config_file.md +var/docs/config_file_example.md +var/docs/editor.md CONTRIBUTING.md LICENSE lib/**.*.rb diff --git a/doc/Dialogue.html b/doc/Dialogue.html new file mode 100644 index 0000000..66a5468 --- /dev/null +++ b/doc/Dialogue.html @@ -0,0 +1,126 @@ + + + + + + + Module: Dialogue + + — Sapling Documentation + + + + + + + + + + + + + + + + + +

+ +
+ + +

Module: Dialogue + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

Dialogue is the module for traversing an existing tree.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: Speaker + + +

+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/doc/Dialogue/Speaker.html b/doc/Dialogue/Speaker.html new file mode 100644 index 0000000..541b5ec --- /dev/null +++ b/doc/Dialogue/Speaker.html @@ -0,0 +1,545 @@ + + + + + + + Class: Dialogue::Speaker + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Dialogue::Speaker + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

Spealer holds the functionality for viewing and going through a dialogue +tree.

+ + +
+
+
+ + +
+ + + +

Instance Attribute Summary collapse

+
    + +
  • + + + #file ⇒ Object + + + + + + + + + + + + + + + + +
    +

    The file, which should be a dialogue tree YAML file.

    +
    + +
  • + + +
+ + + + + +

+ Instance Method Summary + collapse +

+ +
    + +
  • + + + #conversation ⇒ Object + + + + + + + + + + + + + +
    +

    Conversation handles navigating the tree, until the option to end is +reached.

    +
    + +
  • + + +
  • + + + #initialize ⇒ Speaker + + + + + + + constructor + + + + + + + + +
    +

    A new instance of Speaker.

    +
    + +
  • + + +
  • + + + #talk(branch) ⇒ Integer + + + + + + + + + + + + + +
    +

    Talk displays a branch, the options, and prompts for a response.

    +
    + +
  • + + +
+ + +
+

Constructor Details

+ +
+

+ + #initializeSpeaker + + + + + +

+
+ +

Returns a new instance of Speaker

+ + +
+
+
+ + +
+ + + + +
+
+
+
+106
+107
+108
+
+
# File 'lib/sapling.rb', line 106
+
+def initialize
+  @file = ""
+end
+
+
+ +
+ +
+

Instance Attribute Details

+ + + +
+

+ + #fileObject + + + + + +

+
+ +

The file, which should be a dialogue tree YAML file.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+104
+105
+106
+
+
# File 'lib/sapling.rb', line 104
+
+def file
+  @file
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + #conversationObject + + + + + +

+
+ +

Conversation handles navigating the tree, until the option to end is +reached.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+
+
# File 'lib/sapling.rb', line 112
+
+def conversation()
+  tree = Gardner.grow(@file)
+
+  10.times { print "*" }
+  next_branch = talk(tree[1])
+  until next_branch == 0 do
+    next_branch = talk(tree[next_branch])
+  end
+
+  puts tree[0]["desc"]
+  exit
+end
+
+
+ +
+

+ + #talk(branch) ⇒ Integer + + + + + +

+
+ +

Talk displays a branch, the options, and prompts for a response

+ + +
+
+
+

Parameters:

+
    + +
  • + + branch + + + (Hash) + + + + — +
    +

    A branch data set

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Integer) + + + + — +
    +

    The number of the next branch

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+
+
# File 'lib/sapling.rb', line 129
+
+def talk(branch)
+  # If there are no options on this branch, we assume it's a terminal
+  # branch. Return 0, and end the program.
+  if branch["options"].empty?
+    puts "\n#{branch["desc"]}\n\n"
+    return 0
+  end
+
+  valid_options = branch["options"].keys.join(", ")
+
+  puts "\n#{branch["desc"]}\n\n"
+  branch["options"].each_pair do |k,v|
+    puts "\t#{k}: #{v.keys[0]}"
+  end
+
+  print "\n[#{valid_options}]> "
+  STDOUT.flush
+  response = STDIN.gets.chomp.to_i
+
+  until branch["options"].keys.include?(response)
+    print "[## Invalid options. "
+    print "Valid options are #{valid_options}, or 0 to exit."
+    print "\n[#{valid_options}]> "
+    response = STDIN.gets.chomp.to_i
+  end
+
+  puts "\n"
+  10.times { print "*" }
+  puts "\n(Your choice: #{branch["options"][response].keys[0]})"
+  return branch["options"][response].values[0].to_i
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/doc/Gardner.html b/doc/Gardner.html new file mode 100644 index 0000000..ff1c492 --- /dev/null +++ b/doc/Gardner.html @@ -0,0 +1,738 @@ + + + + + + + Module: Gardner + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Gardner + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

Gardner is the module for working with a dialogue tree file

+ + +
+
+
+ + +
+ + + + + + + +

+ Class Method Summary + collapse +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + .grow(file) ⇒ Hash + + + + + +

+
+ +

The main method for Sapling. From here, the tree is grown.

+ + +
+
+
+

Parameters:

+
    + +
  • + + file + + + (File) + + + + — +
    +

    The dialogue tree file

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +
    +

    The final, constructed data set

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+65
+66
+67
+68
+69
+70
+71
+
+
# File 'lib/sapling.rb', line 65
+
+def self.grow(file)
+    tree = YAML.load_file(file[0])
+    tree = Gardner.prune_trunk(tree)
+    branches = Gardner.prune_branches(tree)
+
+    return branches
+end
+
+
+ +
+

+ + .prune_branches(tree) ⇒ Array + + + + + +

+
+ +

Parse the branch

+ + +
+
+
+

Parameters:

+
    + +
  • + + tree + + + (Array) + + + + — +
    +

    The dialogue tree

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Array) + + + + — +
    +

    The array of options on the branch.

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+
+
# File 'lib/sapling.rb', line 13
+
+def self.prune_branches(tree)
+  branches = { 0 => { "desc" => "Thanks for using Sapling!" } }
+  tree.each do |b|
+    branches[b["branch"]["number"]] = {
+      "desc" => b["branch"]["text"],
+      "options" => prune_leaves(b["branch"]["leaf"]) }
+  end
+
+  return branches
+
+end
+
+
+ +
+

+ + .prune_leaves(leaves) ⇒ Hash + + + + + +

+
+ +

Parse the options

+ + +
+
+
+

Parameters:

+
    + +
  • + + leaves + + + (Array) + + + + — +
    +

    The option of leaf hashes

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +
    +

    A has of options

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+
+
# File 'lib/sapling.rb', line 29
+
+def self.prune_leaves(leaves)
+  x = 1
+  options = {}
+
+  return options if leaves.nil?
+
+  leaves.each do |l|
+    options[x] = { l["text"] => l["branch"] }
+    x += 1
+  end
+
+  return options
+
+end
+
+
+ +
+

+ + .prune_trunk(tree) ⇒ Hash + + + + + +

+
+ +

Parse the trunk The trunk is like the introduction to the tree.

+ + +
+
+
+

Parameters:

+
    + +
  • + + tree + + + (Hash) + + + + — +
    +

    The entire tree

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +
    +

    The tree without the trunk

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+
+
# File 'lib/sapling.rb', line 49
+
+def self.prune_trunk(tree)
+  trunk = tree.shift
+  puts "Welcome to Sapling, a Dialogue Tree Utility.\n"
+  40.times { print "-" }
+  puts "\n#{trunk["trunk"]}"
+  40.times { print "-" }
+  puts "\n"
+
+  return tree
+
+end
+
+
+ +
+

+ + .verify_tree(file) ⇒ Boolean + + + + + +

+
+ +

Verify that a file is a dialogue tree file.

+ + +
+
+
+

Parameters:

+
    + +
  • + + file + + + (File) + + + + — +
    +

    The provided file

    +
    + +
  • + +
+ +

Returns:

+
    + +
  • + + + (Boolean) + + + + — +
    +

    True if the file is a tree; false otherwise

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+
+
# File 'lib/sapling.rb', line 77
+
+def self.verify_tree(file)
+  results = []
+  begin
+    tree = YAML.load_file(file)
+    results << tree[0].keys.include?("trunk")
+    results << tree[1]["branch"].keys.include?("number")
+    results << tree[1]["branch"].keys.include?("text")
+    results << tree[1]["branch"].keys.include?("leaf")
+  rescue
+    puts "Sorry chummer, I don't think this is a tree."
+    puts "Verify your YAML file is formatted properly."
+    results << false
+  end
+
+  results.include?(false) ? false : true
+
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/doc/Planter.html b/doc/Planter.html new file mode 100644 index 0000000..933e3e9 --- /dev/null +++ b/doc/Planter.html @@ -0,0 +1,116 @@ + + + + + + + Module: Planter + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Planter + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

Planter is the module for creating or editing a tree.

+ + +
+
+
+ + +
+ + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/doc/Sapling.html b/doc/Sapling.html new file mode 100644 index 0000000..d0cdff2 --- /dev/null +++ b/doc/Sapling.html @@ -0,0 +1,127 @@ + + + + + + + Module: Sapling + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Module: Sapling + + + +

+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

Sapling is the main module for the program. From here, the rest of the +world starts building.

+ + +
+
+
+ + +

Defined Under Namespace

+

+ + + + + Classes: CLI + + +

+ + + + + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/doc/Sapling/CLI.html b/doc/Sapling/CLI.html new file mode 100644 index 0000000..e2405ee --- /dev/null +++ b/doc/Sapling/CLI.html @@ -0,0 +1,292 @@ + + + + + + + Class: Sapling::CLI + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Class: Sapling::CLI + + + +

+
+ +
+
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+
+ + + + + + + + + + + +
+
Defined in:
+
lib/sapling.rb
+
+ +
+ +

Overview

+
+ +

CLI is the class for option parsing, and the gateway to the program

+ + +
+
+
+ + +
+ + + + + + + +

+ Instance Method Summary + collapse +

+ +
    + +
  • + + + #talk(options) ⇒ Object + + + + + + + + + + + + + +
    +

    Option parsing, and gateway to either reading and traversing a tree, or +editing/creating a tree.

    +
    + +
  • + + +
+ + + + +
+

Instance Method Details

+ + +
+

+ + #talk(options) ⇒ Object + + + + + +

+
+ +

Option parsing, and gateway to either reading and traversing a tree, or +editing/creating a tree.

+ + +
+
+
+ + +
+ + + + +
+
+
+
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+
+
# File 'lib/sapling.rb', line 179
+
+def talk(options)
+  opt_parser = OptionParser.new do |opt|
+    opt.banner = "Usage: sapling -t FILE\n" \
+                 "Usage: sapling -e [FILE]"
+
+    opt.on_tail("-h", "--help", "Show this menu") do
+      puts opt
+      exit
+    end
+
+    opt.on("-t", "--talk",
+           "Begin traversing the provided dialogue tree") do
+
+      if ARGV.empty?
+        puts opt_parser
+        exit
+      end
+
+      unless Gardner.verify_tree(ARGV[0])
+        puts "\n#{opt}\n"
+        exit
+      end
+
+      speaker = Dialogue::Speaker.new
+      speaker.file = ARGV
+      speaker.conversation
+    end
+
+    opt.on("-e", "--edit",
+           "Create or edit a dialogue tree") do
+      puts "We gonna make a tree!"
+    end
+
+  end
+  opt_parser.parse!(options)
+
+  if ARGV.empty?
+    puts opt_parser
+    exit
+  end
+end
+
+
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..5ca7088 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,183 @@ + + + + + + + Sapling Documentation + + + + + + + + + + + + + + + + + + + +
+ + +

Sapling Documentation

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • C
  • +
      + +
    • + CLI + + (Sapling) + +
    • + +
    +
+ + + + + + + + + + + + + +
+ +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html new file mode 100644 index 0000000..1fed642 --- /dev/null +++ b/doc/class_list.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + Class List + + + +
+
+

Class List

+ + + +
+ + +
+ + diff --git a/doc/css/common.css b/doc/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/doc/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css new file mode 100644 index 0000000..fa35982 --- /dev/null +++ b/doc/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 0000000..f682a69 --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,492 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
    */ +#filecontents li > p, .docstring li > p { margin: 0px; } +#filecontents ul, .docstring ul { padding-left: 20px; } +/* style for
    */ +#filecontents dl, .docstring dl { border: 1px solid #ccc; } +#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } +#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } +#filecontents dd > p, .docstring dd > p { margin: 0px; } + +.note { + color: #222; + margin: 20px 0; + padding: 10px; + border: 1px solid #eee; + border-radius: 3px; + display: block; +} +.docstring .note { + border-left-color: #ccc; + border-left-width: 5px; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.title.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { padding: 3px 6px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +.summary_signature + .note.title { margin-left: 7px; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title { background: #efefef; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } +.note.title.not_defined_here { background: transparent; border: none; font-style: italic; } +.discussion .note { margin-top: 6px; } +.discussion .note:first-child { margin-top: 0; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +.box_info dl { + margin: 0; + border: 0; + width: 100%; + font-size: 1em; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} +.box_info dl dt { + flex-shrink: 0; + -webkit-flex-shrink: 1; + -ms-flex-shrink: 1; + width: 100px; + text-align: right; + font-weight: bold; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +.box_info dl dd { + flex-grow: 1; + -webkit-flex-grow: 1; + -ms-flex: 1; + max-width: 420px; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; + overflow: hidden; + position: relative; +} +.box_info dl:last-child > * { + border-bottom: 1px solid #aaa; +} +.box_info dl:nth-child(odd) > * { background: #eee; } +.box_info dl:nth-child(even) > * { background: #fff; } +.box_info dl > * { margin: 0; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +.index_inline_list { padding-left: 0; font-size: 1.1em; } + +.index_inline_list li { + list-style: none; + display: inline-block; + padding: 0 12px; + line-height: 30px; + margin-bottom: 5px; +} + +dl.constants { margin-left: 10px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } +dl.constants .docstring .note:first-child { margin-top: 5px; } + +.summary_desc { + margin-left: 32px; + display: block; + font-family: sans-serif; + font-size: 1.1em; + margin-top: 8px; + line-height: 1.5145em; + margin-bottom: 0.8em; +} +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #ccc; margin-top: 25px; padding-top: 0; } +.method_details.first { border: 0; margin-top: 5px; } +.method_details.first h3.signature { margin-top: 1em; } +p.signature, h3.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 1em; + background: #E8F4FF; border: 1px solid #d8d8e5; border-radius: 5px; +} +p.signature tt, +h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload, +h3.signature .overload { display: block; } +p.signature .extras, +h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .not_defined_here, +h3.signature .not_defined_here, +p.signature .aliases, +h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names, +h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags .tag_title { font-size: 1.05em; margin-bottom: 0; font-weight: bold; } +.tags .tag_title tt { color: initial; padding: initial; background: initial; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; } +.tags .examples .inline p { padding: 0; margin: 0; font-weight: bold; font-size: 1em; } +.tags .examples .inline p:before { content: "▸"; font-size: 1em; margin-right: 5px; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #F1F8FF; border: 1px solid #d8d8e5; border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a, .showSource a:visited { text-decoration: none; color: #666; } + +#content a, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; + padding-left: 0px; +} +ul.summary a, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 4px 8px; + background: #f8f8f8; + border: 1px solid #f0f0f0; + border-radius: 5px; +} +.summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; } +ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a, +#content .summary_signature:hover a:visited { + background: transparent; + color: #049; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,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) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 12px; top: 0px; z-index: 9000; } +#search a { + display: block; float: left; + padding: 4px 8px; text-decoration: none; color: #05a; fill: #05a; + border: 1px solid #d8d8e5; + border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; + background: #F1F8FF; + box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; fill: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; fill: #fff; + border: 1px solid #457; + border-top-left-radius: 5px; border-top-right-radius: 5px; +} +#search a.inactive { color: #999; fill: #999; } +.inheritanceTree, .toggleDefines { + float: right; + border-left: 1px solid #aaa; + position: absolute; top: 0; right: 0; + height: 100%; + background: #f6f6f6; + padding: 5px; + min-width: 55px; + text-align: center; +} + +#menu { font-size: 1.3em; color: #bbb; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#content ul.summary li.deprecated .summary_signature a, +#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + position: relative; + float: right; + overflow-x: auto; + right: -3px; + margin-left: 20px; + margin-bottom: 20px; + padding: 20px; padding-right: 30px; + max-width: 300px; + z-index: 5000; + background: #fefefe; + border: 1px solid #ddd; + box-shadow: -2px 2px 6px #bbb; +} +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; } +#toc.hidden:hover { background: #fafafa; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } +@media (max-width: 560px) { + #toc { + margin-left: 0; + margin-top: 16px; + float: none; + max-width: none; + } +} + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags pre.example { + padding: 9px 14px; + margin-top: 4px; + border: 1px solid #e1e1e8; + background: #f7f7f9; + border-radius: 4px; + font-size: 1em; + overflow-x: auto; + line-height: 1.2em; +} +pre.code { color: #000; tab-size: 2; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, pre.code .qwords_sep, +pre.code .words_beg, pre.code .words_end, pre.code .words_sep, +pre.code .qsymbols_beg, pre.code .qsymbols_end, pre.code .qsymbols_sep, +pre.code .symbols_beg, pre.code .symbols_end, pre.code .symbols_sep, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s, +pre.code .rubyid_to_sym, pre.code .rubyid_to_f, +pre.code .dot + pre.code .id, +pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .label, +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .rubyid_require, +pre.code .rubyid_extend, +pre.code .rubyid_include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .rubyid_backref, +pre.code .rubyid_nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } + +/* Color fix for links */ +#content .summary_desc pre.code .id > .object_link a, /* identifier */ +#content .docstring pre.code .id > .object_link a { color: #0085FF; } +#content .summary_desc pre.code .const > .object_link a, /* constant */ +#content .docstring pre.code .const > .object_link a { color: #585CF6; } diff --git a/doc/file.CONTRIBUTING.html b/doc/file.CONTRIBUTING.html new file mode 100644 index 0000000..a9c599c --- /dev/null +++ b/doc/file.CONTRIBUTING.html @@ -0,0 +1,84 @@ + + + + + + + File: CONTRIBUTING + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Contributing to Sapling

    + +

    If you actually want to contribute to this software, first off: Thanks! Sapling +is just a side-project, unintended for any significant use.

    + +

    Sapling is written in Ruby, and adheres to the standard Rubocop rules. So long +as your code passes those rules, it should be good. At time of writing, Sapling +has no testing, because I honestly have very little experience writing tests. +Hopefully this changes soon!

    + +

    If you don't know how to program in Ruby, but wish to improve this software, +feel free to submit an issue or reach out to me directly.

    + +

    Thanks again for your interest in Sapling!

    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html new file mode 100644 index 0000000..6cdece4 --- /dev/null +++ b/doc/file.LICENSE.html @@ -0,0 +1,92 @@ + + + + + + + File: LICENSE + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +
    +

    MIT License

    + +

    Copyright © 2017 Bill Niblock

    + +

    Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the “Software”), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:

    + +

    The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

    + +

    THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE.

    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file.README.html b/doc/file.README.html new file mode 100644 index 0000000..1f05369 --- /dev/null +++ b/doc/file.README.html @@ -0,0 +1,141 @@ + + + + + + + File: README + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Sapling: A Dialogue Tree CLI Utility

    + +

    Sapling allows for easy creation and use of dialogue trees.

    + +

    A dialogue tree is a series of dialogues which follow sequentially, though with +branching options. Examples include "Choose Your Own Adventure" games, or the +dialogues seen in many video games.

    + +

    Structure

    + +

    A dialogue tree can be broken down into three distinct parts: the trunk, +branches, and leafs. The trunk represents the main structure of the tree. Unlike +a branch, which displays content and options, the trunk provides metadata. +Generally speaking, it is a branch, with the exception that it has no options. A +branch represents a choice taken in the dialogue. Branches flow to each other +through leafs, which are the actual choices.

    + +

    You can experience this yourself, by loading "Example Quest! - A Meta Dialogue +Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t +trees/example_quest.yaml.

    + +

    Building a New Tree

    + +

    To build a new tree, you have two options. You can manually edit a configuration +file, or go through the construction wizard. Either way, the end result is a +plain-text configuration file, which can be easily shared, edited, and viewed. +For more details on the configuration file itself, check out the Configuration + File documentation, or the self-documented configuration + file example. Alternatively, you can checkout +Example Quest for a complete treel

    + +

    Manual Edit

    + +
      +
    1. Open your preferred text editor.
    2. +
    3. Refer to the Configuration File documentation
    4. +
    5. Make your changes.
    6. +
    7. Save your changes.
    8. +
    + +

    Automatic Edit -- Coming Soon(tm)!

    + +
      +
    1. Run the configuration editor: sapling --edit [--new][--file FILE]
    2. +
    3. If you choose to create a new dialogue, sapling will generate a new file in +your current directory.
    4. +
    5. If you choose to modify an existing file, sapling will open the tree at the +trunk, and show you the first branch.
    6. +
    7. Make your changes.
    8. +
    9. Save your changes.
    10. +
    + +

    More details on the editor can be found in the Editor +documentation.

    + +

    Contributing

    + +

    You can contribute to Sapling by following these instructions:

    + +
      +
    1. Fork this repository.
    2. +
    3. In your fork, make your changes.
    4. +
    5. Make sure your changes respect the contribution +guidelines.
    6. +
    7. Submit a pull request.
    8. +
    + +

    License

    + +

    Sapling is licensed under the MIT license. The full text can be found in +LICENSE.

    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file.config_file.html b/doc/file.config_file.html new file mode 100644 index 0000000..d00eccb --- /dev/null +++ b/doc/file.config_file.html @@ -0,0 +1,136 @@ + + + + + + + File: Configuration File + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Configuration File Documentation

    + +

    The configuration file for sapling is a standard YAML file. The general +outline looks something like this:

    + +
        ---
    +    -
    +      trunk: "This is a description of the dialogue tree."
    +    -
    +      branch:
    +        number: 1
    +        text: "This is the overall text for the branch."
    +        leaf:
    +          -
    +            text: "This is option 1."
    +            branch: 2
    +          -
    +            text: "This is option 2."
    +            branch: 3
    +    -
    +      branch:
    +        number: 2
    +        text: "This is the overall text for the branch."
    +        leaf:
    +          -
    +            text: "This is option 1."
    +            branch: 1
    +          -
    +            text: "This is option 2."
    +            branch: 3
    +    -
    +      branch:
    +        number: 3
    +        text: "This is the overall text for the branch."
    +
    + +

    Outline

    + +

    Trunk

    + +

    The trunk is a metadata list. Currently, the only information we really care +about is a general description for the tree. Because of this, trunk is the +key, and the description is the value.

    + +

    Branch

    + +

    Branches are the content of a dialogue tree. Each branch has the following +options:

    + +
      +
    • number: The branch number. This is how leaves get around. It must be unique.
    • +
    • text: The text provided by getting to this branch. The first branch is shown +by default when the tree is opened.
    • +
    • leaf: [Optional] The list of options for the branch. Details for leaves are +below. If no leaves are provided, the branch is considered a "terminal +branch", and the program will end after reaching it.
    • +
    + +

    Leaf

    + +

    Leaves are the options of a branch. Each leaf has the following options:

    + +
      +
    • text: The text shown as the option.
    • +
    • branch: The branch this option takes the user to.
    • +
    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file.config_file_example.html b/doc/file.config_file_example.html new file mode 100644 index 0000000..b1e305c --- /dev/null +++ b/doc/file.config_file_example.html @@ -0,0 +1,110 @@ + + + + + + + File: Example YAML File + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Example Dialogue Tree

    + +
    ---
    +# The trunk is a general introduction to the tree. It shouldn't include any
    +# thematic details, rather a one-liner to let the user know what they're getting
    +# into.
    +-
    +  trunk: "This is a general introduction to the dialogue tree."
    +
    +# Branches are the content of a dialogue tree. Each branch is numbered, and that
    +# number is used as the primary means of navigation. The text of a branch is the
    +# story provided to the user; the result of getting to the branch. The leaves
    +# (the section titled leaf) represent the options. Options are displayed in the
    +# order they appear. Within a leaf, the text is what the option says, and the
    +# branch is the branch number which this option will lead to. Leading to branch
    +# number 0 will immediately exit the program.
    +#
    +# You can have as many branches and leaves as you wish, though having too many
    +# leaves may lead to both display problems, and paralyzing indecision.
    +-
    +  branch:
    +    number: 1
    +    text: "The first branch. Displayed first, by default."
    +    leaf:
    +      -
    +        text: "The first option for this branch. It leads to branch 2"
    +        branch: 2
    +      -
    +        text: "The second branch. It immediately exits the program."
    +        branch: 0
    +
    +# A terminal branch is a branch which has no leaves. This represents an ending.
    +# Once a user hits a terminal branch, the program will display the branch text,
    +# and then redirect the user to branch 0, to exit.
    +-
    +  branch:
    +    number: 2
    +    text: "This is a terminal branch. After displaying this text,
    +      the program will exit."
    +
    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file.editor.html b/doc/file.editor.html new file mode 100644 index 0000000..a87198b --- /dev/null +++ b/doc/file.editor.html @@ -0,0 +1,82 @@ + + + + + + + File: Using the Editor + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Sapling Editor

    + +

    Sapling provides an editor for creating and modifying dialogue trees. The editor +allows for editing all parts of a tree, from the trunk to the leaves.

    + +

    Creating a new tree

    + +

    Pending

    + +

    Editing an existing tree

    + +

    Pending

    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/file_list.html b/doc/file_list.html new file mode 100644 index 0000000..edb69c0 --- /dev/null +++ b/doc/file_list.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + File List + + + +
    +
    +

    File List

    + + + +
    + + +
    + + diff --git a/doc/frames.html b/doc/frames.html new file mode 100644 index 0000000..6d0f27e --- /dev/null +++ b/doc/frames.html @@ -0,0 +1,17 @@ + + + + + Sapling Documentation + + + + diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..7f33759 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,141 @@ + + + + + + + File: README + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Sapling: A Dialogue Tree CLI Utility

    + +

    Sapling allows for easy creation and use of dialogue trees.

    + +

    A dialogue tree is a series of dialogues which follow sequentially, though with +branching options. Examples include "Choose Your Own Adventure" games, or the +dialogues seen in many video games.

    + +

    Structure

    + +

    A dialogue tree can be broken down into three distinct parts: the trunk, +branches, and leafs. The trunk represents the main structure of the tree. Unlike +a branch, which displays content and options, the trunk provides metadata. +Generally speaking, it is a branch, with the exception that it has no options. A +branch represents a choice taken in the dialogue. Branches flow to each other +through leafs, which are the actual choices.

    + +

    You can experience this yourself, by loading "Example Quest! - A Meta Dialogue +Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t +trees/example_quest.yaml.

    + +

    Building a New Tree

    + +

    To build a new tree, you have two options. You can manually edit a configuration +file, or go through the construction wizard. Either way, the end result is a +plain-text configuration file, which can be easily shared, edited, and viewed. +For more details on the configuration file itself, check out the Configuration + File documentation, or the self-documented configuration + file example. Alternatively, you can checkout +Example Quest for a complete treel

    + +

    Manual Edit

    + +
      +
    1. Open your preferred text editor.
    2. +
    3. Refer to the Configuration File documentation
    4. +
    5. Make your changes.
    6. +
    7. Save your changes.
    8. +
    + +

    Automatic Edit -- Coming Soon(tm)!

    + +
      +
    1. Run the configuration editor: sapling --edit [--new][--file FILE]
    2. +
    3. If you choose to create a new dialogue, sapling will generate a new file in +your current directory.
    4. +
    5. If you choose to modify an existing file, sapling will open the tree at the +trunk, and show you the first branch.
    6. +
    7. Make your changes.
    8. +
    9. Save your changes.
    10. +
    + +

    More details on the editor can be found in the Editor +documentation.

    + +

    Contributing

    + +

    You can contribute to Sapling by following these instructions:

    + +
      +
    1. Fork this repository.
    2. +
    3. In your fork, make your changes.
    4. +
    5. Make sure your changes respect the contribution +guidelines.
    6. +
    7. Submit a pull request.
    8. +
    + +

    License

    + +

    Sapling is licensed under the MIT license. The full text can be found in +LICENSE.

    +
    + + + +
    + + \ No newline at end of file diff --git a/doc/js/app.js b/doc/js/app.js new file mode 100644 index 0000000..b9f2120 --- /dev/null +++ b/doc/js/app.js @@ -0,0 +1,248 @@ +(function() { + +var localStorage = {}, sessionStorage = {}; +try { localStorage = window.localStorage; } catch (e) { } +try { sessionStorage = window.sessionStorage; } catch (e) { } + +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().css('display', 'inline'); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function searchFrameButtons() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); + window.addEventListener('message', function(e) { + if (e.data === 'navEscape') { + $('#nav').slideUp(100); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); + + $(window).resize(function() { + if ($('#search:visible').length === 0) { + $('#nav').removeAttr('style'); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#nav'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') === link && frame.css('display') !== "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + if (frame.attr('src') !== link) frame.attr('src', link); + frame.slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function(e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('
      '); + list.html(next.html()); + list.find('.summary_desc, .note').remove(); + list.find('a').each(function() { + $(this).html($(this).find('strong').html()); + $(this).parent().html($(this)[0].outerHTML); + }); + next.before(list); + next.toggle(); + } + }); + return false; + }); + if (localStorage.summaryCollapsed == "collapse") { + $('.summary_toggle').first().click(); + } else { localStorage.summaryCollapsed = "expand"; } +} + +function generateTOC() { + if ($('#filecontents').length === 0) return; + var _toc = $('
        '); + var show = false; + var toc = _toc; + var counter = 0; + var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; + var i; + if ($('#filecontents h1').length > 1) tags.unshift('h1'); + for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } + var lastTag = parseInt(tags[0][1], 10); + $(tags.join(', ')).each(function() { + if ($(this).parents('.method_details .docstring').length != 0) return; + if (this.id == "filecontents") return; + show = true; + var thisTag = parseInt(this.tagName[1], 10); + if (this.id.length === 0) { + var proposedId = $(this).attr('toc-id'); + if (typeof(proposedId) != "undefined") this.id = proposedId; + else { + var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); + if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } + this.id = proposedId; + } + } + if (thisTag > lastTag) { + for (i = 0; i < thisTag - lastTag; i++) { + var tmp = $('
          '); toc.append(tmp); toc = tmp; + } + } + if (thisTag < lastTag) { + for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); + } + var title = $(this).attr('toc-title'); + if (typeof(title) == "undefined") title = $(this).text(); + toc.append('
        1. ' + title + '
        2. '); + lastTag = thisTag; + }); + if (!show) return; + html = ''; + $('#content').prepend(html); + $('#toc').append(_toc); + $('#toc .hide_toc').toggle(function() { + $('#toc .top').slideUp('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }, function() { + $('#toc .top').slideDown('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }); +} + +function navResizeFn(e) { + if (e.which !== 1) { + navResizeFnStop(); + return; + } + + sessionStorage.navWidth = e.pageX.toString(); + $('.nav_wrap').css('width', e.pageX); + $('.nav_wrap').css('-ms-flex', 'inherit'); +} + +function navResizeFnStop() { + $(window).unbind('mousemove', navResizeFn); + window.removeEventListener('message', navMessageFn, false); +} + +function navMessageFn(e) { + if (e.data.action === 'mousemove') navResizeFn(e.data.event); + if (e.data.action === 'mouseup') navResizeFnStop(); +} + +function navResizer() { + $('#resizer').mousedown(function(e) { + e.preventDefault(); + $(window).mousemove(navResizeFn); + window.addEventListener('message', navMessageFn, false); + }); + $(window).mouseup(navResizeFnStop); + + if (sessionStorage.navWidth) { + navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)}); + } +} + +function navExpander() { + var done = false, timer = setTimeout(postMessage, 500); + function postMessage() { + if (done) return; + clearTimeout(timer); + var opts = { action: 'expand', path: pathId }; + document.getElementById('nav').contentWindow.postMessage(opts, '*'); + done = true; + } + + window.addEventListener('message', function(event) { + if (event.data === 'navReady') postMessage(); + return false; + }, false); +} + +function mainFocus() { + var hash = window.location.hash; + if (hash !== '' && $(hash)[0]) { + $(hash)[0].scrollIntoView(); + } + + setTimeout(function() { $('#main').focus(); }, 10); +} + +$(document).ready(function() { + navResizer(); + navExpander(); + createSourceLinks(); + createDefineLinks(); + createFullTreeLinks(); + searchFrameButtons(); + linkSummaries(); + summaryToggle(); + generateTOC(); + mainFocus(); +}); + +})(); diff --git a/doc/js/full_list.js b/doc/js/full_list.js new file mode 100644 index 0000000..59069c5 --- /dev/null +++ b/doc/js/full_list.js @@ -0,0 +1,216 @@ +(function() { + +var $clicked = $(null); +var searchTimeout = null; +var searchCache = []; +var caseSensitiveMatch = false; +var ignoreKeyCodeMin = 8; +var ignoreKeyCodeMax = 46; +var commandKey = 91; + +RegExp.escape = function(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); +} + +function escapeShortcut() { + $(document).keydown(function(evt) { + if (evt.which == 27) { + window.parent.postMessage('navEscape', '*'); + } + }); +} + +function navResizer() { + $(window).mousemove(function(e) { + window.parent.postMessage({ + action: 'mousemove', event: {pageX: e.pageX, which: e.which} + }, '*'); + }).mouseup(function(e) { + window.parent.postMessage({action: 'mouseup'}, '*'); + }); + window.parent.postMessage("navReady", "*"); +} + +function clearSearchTimeout() { + clearTimeout(searchTimeout); + searchTimeout = null; +} + +function enableLinks() { + // load the target page in the parent window + $('#full_list li').on('click', function(evt) { + $('#full_list li').removeClass('clicked'); + $clicked = $(this); + $clicked.addClass('clicked'); + evt.stopPropagation(); + + if (evt.target.tagName === 'A') return true; + + var elem = $clicked.find('> .item .object_link a')[0]; + var e = evt.originalEvent; + var newEvent = new MouseEvent(evt.originalEvent.type); + newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); + elem.dispatchEvent(newEvent); + evt.preventDefault(); + return false; + }); +} + +function enableToggles() { + // show/hide nested classes on toggle click + $('#full_list a.toggle').on('click', function(evt) { + evt.stopPropagation(); + evt.preventDefault(); + $(this).parent().parent().toggleClass('collapsed'); + highlight(); + }); +} + +function populateSearchCache() { + $('#full_list li .item').each(function() { + var $node = $(this); + var $link = $node.find('.object_link a'); + if ($link.length > 0) { + searchCache.push({ + node: $node, + link: $link, + name: $link.text(), + fullName: $link.attr('title').split(' ')[0] + }); + } + }); +} + +function enableSearch() { + $('#search input').keyup(function(event) { + if (ignoredKeyPress(event)) return; + if (this.value === "") { + clearSearch(); + } else { + performSearch(this.value); + } + }); + + $('#full_list').after(""); +} + +function ignoredKeyPress(event) { + if ( + (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) || + (event.keyCode == commandKey) + ) { + return true; + } else { + return false; + } +} + +function clearSearch() { + clearSearchTimeout(); + $('#full_list .found').removeClass('found').each(function() { + var $link = $(this).find('.object_link a'); + $link.text($link.text()); + }); + $('#full_list, #content').removeClass('insearch'); + $clicked.parents().removeClass('collapsed'); + highlight(); +} + +function performSearch(searchString) { + clearSearchTimeout(); + $('#full_list, #content').addClass('insearch'); + $('#noresults').text('').hide(); + partialSearch(searchString, 0); +} + +function partialSearch(searchString, offset) { + var lastRowClass = ''; + var i = null; + for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) { + var item = searchCache[i]; + var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var matchString = buildMatchString(searchString); + var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); + if (searchName.match(matchRegexp) == null) { + item.node.removeClass('found'); + item.link.text(item.link.text()); + } + else { + item.node.addClass('found'); + item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); + lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; + item.link.html(item.name.replace(matchRegexp, "$&")); + } + } + if(i == searchCache.length) { + searchDone(); + } else { + searchTimeout = setTimeout(function() { + partialSearch(searchString, i); + }, 0); + } +} + +function searchDone() { + searchTimeout = null; + highlight(); + if ($('#full_list li:visible').size() === 0) { + $('#noresults').text('No results were found.').hide().fadeIn(); + } else { + $('#noresults').text('').hide(); + } + $('#content').removeClass('insearch'); +} + +function buildMatchString(searchString, event) { + caseSensitiveMatch = searchString.match(/[A-Z]/) != null; + var regexSearchString = RegExp.escape(searchString); + if (caseSensitiveMatch) { + regexSearchString += "|" + + $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). + join('.+?'); + } + return regexSearchString; +} + +function highlight() { + $('#full_list li:visible').each(function(n) { + $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even'); + }); +} + +/** + * Expands the tree to the target element and its immediate + * children. + */ +function expandTo(path) { + var $target = $(document.getElementById('object_' + path)); + $target.addClass('clicked'); + $target.removeClass('collapsed'); + $target.parentsUntil('#full_list', 'li').removeClass('collapsed'); + if($target[0]) { + window.scrollTo(window.scrollX, $target.offset().top - 250); + highlight(); + } +} + +function windowEvents(event) { + var msg = event.data; + if (msg.action === "expand") { + expandTo(msg.path); + } + return false; +} + +window.addEventListener("message", windowEvents, false); + +$(document).ready(function() { + escapeShortcut(); + navResizer(); + enableLinks(); + enableToggles(); + populateSearchCache(); + enableSearch(); +}); + +})(); diff --git a/doc/js/jquery.js b/doc/js/jquery.js new file mode 100644 index 0000000..198b3ff --- /dev/null +++ b/doc/js/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
    "+""+"
    ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
    t
    ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
    ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/doc/method_list.html b/doc/method_list.html new file mode 100644 index 0000000..b23b782 --- /dev/null +++ b/doc/method_list.html @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + Method List + + + +
    +
    +

    Method List

    + + + +
    + + +
    + + diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html new file mode 100644 index 0000000..0e0f006 --- /dev/null +++ b/doc/top-level-namespace.html @@ -0,0 +1,110 @@ + + + + + + + Top Level Namespace + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Top Level Namespace + + + +

    +
    + + + + + + + + + + + +
    + +

    Defined Under Namespace

    +

    + + + Modules: Dialogue, Gardner, Planter, Sapling + + + + +

    + + + + + + + + + +
    + + + +
    + + \ No newline at end of file diff --git a/var/docs/config_file.md b/var/docs/config_file.md new file mode 100644 index 0000000..689a591 --- /dev/null +++ b/var/docs/config_file.md @@ -0,0 +1,66 @@ + + +# Configuration File Documentation + +The configuration file for `sapling` is a standard YAML file. The general +outline looks something like this: + + --- + - + trunk: "This is a description of the dialogue tree." + - + branch: + number: 1 + text: "This is the overall text for the branch." + leaf: + - + text: "This is option 1." + branch: 2 + - + text: "This is option 2." + branch: 3 + - + branch: + number: 2 + text: "This is the overall text for the branch." + leaf: + - + text: "This is option 1." + branch: 1 + - + text: "This is option 2." + branch: 3 + - + branch: + number: 3 + text: "This is the overall text for the branch." + +## Outline + +#### Trunk + +The `trunk` is a metadata list. Currently, the only information we really care +about is a general description for the tree. Because of this, `trunk` is the +key, and the description is the value. + +#### Branch + +Branches are the content of a dialogue tree. Each `branch` has the following +options: + +- `number`: The branch number. This is how leaves get around. It must be unique. +- `text`: The text provided by getting to this branch. The first branch is shown + by default when the tree is opened. +- `leaf`: [Optional] The list of options for the branch. Details for leaves are + below. If no leaves are provided, the branch is considered a "terminal + branch", and the program will end after reaching it. + +#### Leaf + +Leaves are the options of a branch. Each `leaf` has the following options: + +- `text`: The text shown as the option. +- `branch`: The branch this option takes the user to. diff --git a/var/docs/config_file_example.md b/var/docs/config_file_example.md new file mode 100644 index 0000000..8a9acdd --- /dev/null +++ b/var/docs/config_file_example.md @@ -0,0 +1,42 @@ + +# Example Dialogue Tree + --- + # The trunk is a general introduction to the tree. It shouldn't include any + # thematic details, rather a one-liner to let the user know what they're getting + # into. + - + trunk: "This is a general introduction to the dialogue tree." + + # Branches are the content of a dialogue tree. Each branch is numbered, and that + # number is used as the primary means of navigation. The text of a branch is the + # story provided to the user; the result of getting to the branch. The leaves + # (the section titled leaf) represent the options. Options are displayed in the + # order they appear. Within a leaf, the text is what the option says, and the + # branch is the branch number which this option will lead to. Leading to branch + # number 0 will immediately exit the program. + # + # You can have as many branches and leaves as you wish, though having too many + # leaves may lead to both display problems, and paralyzing indecision. + - + branch: + number: 1 + text: "The first branch. Displayed first, by default." + leaf: + - + text: "The first option for this branch. It leads to branch 2" + branch: 2 + - + text: "The second branch. It immediately exits the program." + branch: 0 + + # A terminal branch is a branch which has no leaves. This represents an ending. + # Once a user hits a terminal branch, the program will display the branch text, + # and then redirect the user to branch 0, to exit. + - + branch: + number: 2 + text: "This is a terminal branch. After displaying this text, + the program will exit." diff --git a/var/docs/config_file_example.yaml b/var/docs/config_file_example.yaml new file mode 100644 index 0000000..1a6551e --- /dev/null +++ b/var/docs/config_file_example.yaml @@ -0,0 +1,37 @@ +# @title Example YAML File +--- +# The trunk is a general introduction to the tree. It shouldn't include any +# thematic details, rather a one-liner to let the user know what they're getting +# into. +- trunk: "This is a general introduction to the dialogue tree." + +# Branches are the content of a dialogue tree. Each branch is numbered, and that +# number is used as the primary means of navigation. The text of a branch is the +# story provided to the user; the result of getting to the branch. The leaves +# (the section titled leaf) represent the options. Options are displayed in the +# order they appear. Within a leaf, the text is what the option says, and the +# branch is the branch number which this option will lead to. Leading to branch +# number 0 will immediately exit the program. +# +# You can have as many branches and leaves as you wish, though having too many +# leaves may lead to both display problems, and paralyzing indecision. +- + branch: + number: 1 + text: "The first branch. Displayed first, by default." + leaf: + - + text: "The first option for this branch. It leads to branch 2" + branch: 2 + - + text: "The second branch. It immediately exits the program." + branch: 0 + +# A terminal branch is a branch which has no leaves. This represents an ending. +# Once a user hits a terminal branch, the program will display the branch text, +# and then redirect the user to branch 0, to exit. +- + branch: + number: 2 + text: "This is a terminal branch. After displaying this text, + the program will exit." diff --git a/var/docs/editor.md b/var/docs/editor.md new file mode 100644 index 0000000..5b4106e --- /dev/null +++ b/var/docs/editor.md @@ -0,0 +1,16 @@ + +# Sapling Editor + +Sapling provides an editor for creating and modifying dialogue trees. The editor +allows for editing all parts of a tree, from the trunk to the leaves. + +## Creating a new tree + +Pending + +## Editing an existing tree + +Pending diff --git a/var/trees/example_quest.yaml b/var/trees/example_quest.yaml new file mode 100644 index 0000000..e27b566 --- /dev/null +++ b/var/trees/example_quest.yaml @@ -0,0 +1,74 @@ +--- +- trunk: "Example Quest: Learn what it looks like to use Sapling!" + +- + branch: + number: 1 + text: "You stumble upon the first branch of a dialogue tree. + You find yourself at a junction..." + leaf: + - + text: "Go to the next branch." + branch: 2 + - + text: "Go to the frigid north-lands, because there's always a + frigid north-lands." + branch: 3 + - + text: "Leave this silly place, but with a reason." + branch: 5 + - + text: "Leave this silly place immediately, without any reason." + branch: 0 +- + branch: + number: 2 + text: "Ye find ye-self at branch 2. Your options are north, south + or Dennis." + leaf: + - + text: "North, to frigidity!" + branch: 3 + - + text: "South, back the way you came!" + branch: 1 + - + text: "Dennis" + branch: 6 +- + branch: + number: 3 + text: "It's cold up here. You decide to go someplace else!" + leaf: + - + text: "Head on home." + branch: 4 + - + text: "Head south (back the way you came)" + branch: 2 +- + branch: + number: 4 + text: "You head on home! Bye bye!" +- + branch: + number: 5 + text: "You leave the dialogue tree, and all its textual glory, behind + and go find a nice GUI to settle down with." +- + branch: + number: 6 + text: "Dennis appreciates your interest, but is really just trying to + hangout and play video games." + leaf: + - + text: "Join Dennis, and play video games with him." + branch: 7 + - + text: "Reconsider your options." + branch: 2 +- + branch: + number: 7 + text: "You sit down next to Dennis, and together you conquer all sorts of + realms and wizards and stuff. Nice!" From 13683a35b46e8d319b20318a46db4d7dff89249e Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 6 May 2017 18:16:22 -0400 Subject: [PATCH 22/74] Update documentation --- doc/Dialogue.html | 2 +- doc/Dialogue/Speaker.html | 2 +- doc/Gardner.html | 2 +- doc/Planter.html | 2 +- doc/Sapling.html | 2 +- doc/Sapling/CLI.html | 2 +- doc/_index.html | 2 +- doc/file.CONTRIBUTING.html | 2 +- doc/file.LICENSE.html | 2 +- doc/file.README.html | 2 +- doc/file.config_file.html | 2 +- doc/file.config_file_example.html | 2 +- doc/file.editor.html | 2 +- doc/index.html | 2 +- doc/top-level-namespace.html | 2 +- docs/config_file.md | 66 --------------------------- docs/config_file_example.md | 42 ------------------ docs/config_file_example.yaml | 37 ---------------- docs/editor.md | 16 ------- trees/example_quest.yaml | 74 ------------------------------- 20 files changed, 15 insertions(+), 250 deletions(-) delete mode 100644 docs/config_file.md delete mode 100644 docs/config_file_example.md delete mode 100644 docs/config_file_example.yaml delete mode 100644 docs/editor.md delete mode 100644 trees/example_quest.yaml diff --git a/doc/Dialogue.html b/doc/Dialogue.html index 66a5468..8e05121 100644 --- a/doc/Dialogue.html +++ b/doc/Dialogue.html @@ -116,7 +116,7 @@
    diff --git a/doc/Dialogue/Speaker.html b/doc/Dialogue/Speaker.html index 541b5ec..92b7f7a 100644 --- a/doc/Dialogue/Speaker.html +++ b/doc/Dialogue/Speaker.html @@ -535,7 +535,7 @@ reached.

    diff --git a/doc/Gardner.html b/doc/Gardner.html index ff1c492..5ca76ef 100644 --- a/doc/Gardner.html +++ b/doc/Gardner.html @@ -728,7 +728,7 @@ diff --git a/doc/Planter.html b/doc/Planter.html index 933e3e9..7b82fd1 100644 --- a/doc/Planter.html +++ b/doc/Planter.html @@ -106,7 +106,7 @@ diff --git a/doc/Sapling.html b/doc/Sapling.html index d0cdff2..e5a4e99 100644 --- a/doc/Sapling.html +++ b/doc/Sapling.html @@ -117,7 +117,7 @@ world starts building.

    diff --git a/doc/Sapling/CLI.html b/doc/Sapling/CLI.html index e2405ee..51e6c10 100644 --- a/doc/Sapling/CLI.html +++ b/doc/Sapling/CLI.html @@ -282,7 +282,7 @@ editing/creating a tree.

    diff --git a/doc/_index.html b/doc/_index.html index 5ca7088..0ad8a13 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -173,7 +173,7 @@ diff --git a/doc/file.CONTRIBUTING.html b/doc/file.CONTRIBUTING.html index a9c599c..fb05c4f 100644 --- a/doc/file.CONTRIBUTING.html +++ b/doc/file.CONTRIBUTING.html @@ -74,7 +74,7 @@ feel free to submit an issue or reach out to me directly.

    diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html index 6cdece4..75a1ae6 100644 --- a/doc/file.LICENSE.html +++ b/doc/file.LICENSE.html @@ -82,7 +82,7 @@ DEALINGS IN THE SOFTWARE.

    diff --git a/doc/file.README.html b/doc/file.README.html index 1f05369..4468c94 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -131,7 +131,7 @@ guidelines. diff --git a/doc/file.config_file.html b/doc/file.config_file.html index d00eccb..12013e7 100644 --- a/doc/file.config_file.html +++ b/doc/file.config_file.html @@ -126,7 +126,7 @@ branch", and the program will end after reaching it. diff --git a/doc/file.config_file_example.html b/doc/file.config_file_example.html index b1e305c..3a46390 100644 --- a/doc/file.config_file_example.html +++ b/doc/file.config_file_example.html @@ -100,7 +100,7 @@ diff --git a/doc/file.editor.html b/doc/file.editor.html index a87198b..3a42c19 100644 --- a/doc/file.editor.html +++ b/doc/file.editor.html @@ -72,7 +72,7 @@ allows for editing all parts of a tree, from the trunk to the leaves.

    diff --git a/doc/index.html b/doc/index.html index 7f33759..6476ee2 100644 --- a/doc/index.html +++ b/doc/index.html @@ -131,7 +131,7 @@ guidelines. diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 0e0f006..33af615 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -100,7 +100,7 @@ diff --git a/docs/config_file.md b/docs/config_file.md deleted file mode 100644 index 689a591..0000000 --- a/docs/config_file.md +++ /dev/null @@ -1,66 +0,0 @@ - - -# Configuration File Documentation - -The configuration file for `sapling` is a standard YAML file. The general -outline looks something like this: - - --- - - - trunk: "This is a description of the dialogue tree." - - - branch: - number: 1 - text: "This is the overall text for the branch." - leaf: - - - text: "This is option 1." - branch: 2 - - - text: "This is option 2." - branch: 3 - - - branch: - number: 2 - text: "This is the overall text for the branch." - leaf: - - - text: "This is option 1." - branch: 1 - - - text: "This is option 2." - branch: 3 - - - branch: - number: 3 - text: "This is the overall text for the branch." - -## Outline - -#### Trunk - -The `trunk` is a metadata list. Currently, the only information we really care -about is a general description for the tree. Because of this, `trunk` is the -key, and the description is the value. - -#### Branch - -Branches are the content of a dialogue tree. Each `branch` has the following -options: - -- `number`: The branch number. This is how leaves get around. It must be unique. -- `text`: The text provided by getting to this branch. The first branch is shown - by default when the tree is opened. -- `leaf`: [Optional] The list of options for the branch. Details for leaves are - below. If no leaves are provided, the branch is considered a "terminal - branch", and the program will end after reaching it. - -#### Leaf - -Leaves are the options of a branch. Each `leaf` has the following options: - -- `text`: The text shown as the option. -- `branch`: The branch this option takes the user to. diff --git a/docs/config_file_example.md b/docs/config_file_example.md deleted file mode 100644 index 8a9acdd..0000000 --- a/docs/config_file_example.md +++ /dev/null @@ -1,42 +0,0 @@ - -# Example Dialogue Tree - --- - # The trunk is a general introduction to the tree. It shouldn't include any - # thematic details, rather a one-liner to let the user know what they're getting - # into. - - - trunk: "This is a general introduction to the dialogue tree." - - # Branches are the content of a dialogue tree. Each branch is numbered, and that - # number is used as the primary means of navigation. The text of a branch is the - # story provided to the user; the result of getting to the branch. The leaves - # (the section titled leaf) represent the options. Options are displayed in the - # order they appear. Within a leaf, the text is what the option says, and the - # branch is the branch number which this option will lead to. Leading to branch - # number 0 will immediately exit the program. - # - # You can have as many branches and leaves as you wish, though having too many - # leaves may lead to both display problems, and paralyzing indecision. - - - branch: - number: 1 - text: "The first branch. Displayed first, by default." - leaf: - - - text: "The first option for this branch. It leads to branch 2" - branch: 2 - - - text: "The second branch. It immediately exits the program." - branch: 0 - - # A terminal branch is a branch which has no leaves. This represents an ending. - # Once a user hits a terminal branch, the program will display the branch text, - # and then redirect the user to branch 0, to exit. - - - branch: - number: 2 - text: "This is a terminal branch. After displaying this text, - the program will exit." diff --git a/docs/config_file_example.yaml b/docs/config_file_example.yaml deleted file mode 100644 index 1a6551e..0000000 --- a/docs/config_file_example.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# @title Example YAML File ---- -# The trunk is a general introduction to the tree. It shouldn't include any -# thematic details, rather a one-liner to let the user know what they're getting -# into. -- trunk: "This is a general introduction to the dialogue tree." - -# Branches are the content of a dialogue tree. Each branch is numbered, and that -# number is used as the primary means of navigation. The text of a branch is the -# story provided to the user; the result of getting to the branch. The leaves -# (the section titled leaf) represent the options. Options are displayed in the -# order they appear. Within a leaf, the text is what the option says, and the -# branch is the branch number which this option will lead to. Leading to branch -# number 0 will immediately exit the program. -# -# You can have as many branches and leaves as you wish, though having too many -# leaves may lead to both display problems, and paralyzing indecision. -- - branch: - number: 1 - text: "The first branch. Displayed first, by default." - leaf: - - - text: "The first option for this branch. It leads to branch 2" - branch: 2 - - - text: "The second branch. It immediately exits the program." - branch: 0 - -# A terminal branch is a branch which has no leaves. This represents an ending. -# Once a user hits a terminal branch, the program will display the branch text, -# and then redirect the user to branch 0, to exit. -- - branch: - number: 2 - text: "This is a terminal branch. After displaying this text, - the program will exit." diff --git a/docs/editor.md b/docs/editor.md deleted file mode 100644 index 5b4106e..0000000 --- a/docs/editor.md +++ /dev/null @@ -1,16 +0,0 @@ - -# Sapling Editor - -Sapling provides an editor for creating and modifying dialogue trees. The editor -allows for editing all parts of a tree, from the trunk to the leaves. - -## Creating a new tree - -Pending - -## Editing an existing tree - -Pending diff --git a/trees/example_quest.yaml b/trees/example_quest.yaml deleted file mode 100644 index e27b566..0000000 --- a/trees/example_quest.yaml +++ /dev/null @@ -1,74 +0,0 @@ ---- -- trunk: "Example Quest: Learn what it looks like to use Sapling!" - -- - branch: - number: 1 - text: "You stumble upon the first branch of a dialogue tree. - You find yourself at a junction..." - leaf: - - - text: "Go to the next branch." - branch: 2 - - - text: "Go to the frigid north-lands, because there's always a - frigid north-lands." - branch: 3 - - - text: "Leave this silly place, but with a reason." - branch: 5 - - - text: "Leave this silly place immediately, without any reason." - branch: 0 -- - branch: - number: 2 - text: "Ye find ye-self at branch 2. Your options are north, south - or Dennis." - leaf: - - - text: "North, to frigidity!" - branch: 3 - - - text: "South, back the way you came!" - branch: 1 - - - text: "Dennis" - branch: 6 -- - branch: - number: 3 - text: "It's cold up here. You decide to go someplace else!" - leaf: - - - text: "Head on home." - branch: 4 - - - text: "Head south (back the way you came)" - branch: 2 -- - branch: - number: 4 - text: "You head on home! Bye bye!" -- - branch: - number: 5 - text: "You leave the dialogue tree, and all its textual glory, behind - and go find a nice GUI to settle down with." -- - branch: - number: 6 - text: "Dennis appreciates your interest, but is really just trying to - hangout and play video games." - leaf: - - - text: "Join Dennis, and play video games with him." - branch: 7 - - - text: "Reconsider your options." - branch: 2 -- - branch: - number: 7 - text: "You sit down next to Dennis, and together you conquer all sorts of - realms and wizards and stuff. Nice!" From 36c9f0d3ca601867a8bbd469b6f4f232b58386a1 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 12:59:36 -0400 Subject: [PATCH 23/74] Abstract sapling modules into individual modules - module gardner -> lib/sapling/gardner.rb - module dialogue -> lib/sapling/dialogue.rb - module planter -> lib/sapling/planter.rb - remove duplicate code from lib/sapling.rb --- lib/sapling.rb | 169 ++-------------------------------------- lib/sapling/dialogue.rb | 69 ++++++++++++++++ lib/sapling/gardner.rb | 92 ++++++++++++++++++++++ lib/sapling/planter.rb | 4 + 4 files changed, 170 insertions(+), 164 deletions(-) create mode 100644 lib/sapling/dialogue.rb create mode 100644 lib/sapling/gardner.rb create mode 100644 lib/sapling/planter.rb diff --git a/lib/sapling.rb b/lib/sapling.rb index a7348dc..7bfba7b 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -3,175 +3,16 @@ require 'optparse' require 'yaml' -# Gardner is the module for working with a dialogue tree file -module Gardner - - # Parse the branch - # - # @param tree [Array] The dialogue tree - # @return [Array] The array of options on the branch. - def self.prune_branches(tree) - branches = { 0 => { "desc" => "Thanks for using Sapling!" } } - tree.each do |b| - branches[b["branch"]["number"]] = { - "desc" => b["branch"]["text"], - "options" => prune_leaves(b["branch"]["leaf"]) } - end - - return branches - - end - - # Parse the options - # - # @param leaves [Array] The option of leaf hashes - # @return [Hash] A has of options - def self.prune_leaves(leaves) - x = 1 - options = {} - - return options if leaves.nil? - - leaves.each do |l| - options[x] = { l["text"] => l["branch"] } - x += 1 - end - - return options - - end - - # Parse the trunk - # The trunk is like the introduction to the tree. - # - # @param tree [Hash] The entire tree - # @return [Hash] The tree without the trunk - def self.prune_trunk(tree) - trunk = tree.shift - puts "Welcome to Sapling, a Dialogue Tree Utility.\n" - 40.times { print "-" } - puts "\n#{trunk["trunk"]}" - 40.times { print "-" } - puts "\n" - - return tree - - end - - # The main method for Sapling. From here, the tree is grown. - # - # @param file [File] The dialogue tree file - # @return [Hash] The final, constructed data set - def self.grow(file) - tree = YAML.load_file(file[0]) - tree = Gardner.prune_trunk(tree) - branches = Gardner.prune_branches(tree) - - return branches - end - - # Verify that a file is a dialogue tree file. - # - # @param file [File] The provided file - # @return [Boolean] True if the file is a tree; false otherwise - def self.verify_tree(file) - results = [] - begin - tree = YAML.load_file(file) - results << tree[0].keys.include?("trunk") - results << tree[1]["branch"].keys.include?("number") - results << tree[1]["branch"].keys.include?("text") - results << tree[1]["branch"].keys.include?("leaf") - rescue - puts "Sorry chummer, I don't think this is a tree." - puts "Verify your YAML file is formatted properly." - results << false - end - - results.include?(false) ? false : true - - end - -end - -# Dialogue is the module for traversing an existing tree. -module Dialogue - - # Spealer holds the functionality for viewing and going through a dialogue - # tree. - class Speaker - # The file, which should be a dialogue tree YAML file. - attr_accessor :file - - def initialize - @file = "" - end - - # Conversation handles navigating the tree, until the option to end is - # reached. - def conversation() - tree = Gardner.grow(@file) - - 10.times { print "*" } - next_branch = talk(tree[1]) - until next_branch == 0 do - next_branch = talk(tree[next_branch]) - end - - puts tree[0]["desc"] - exit - end - - # Talk displays a branch, the options, and prompts for a response - # - # @param branch [Hash] A branch data set - # @return [Integer] The number of the next branch - def talk(branch) - # If there are no options on this branch, we assume it's a terminal - # branch. Return 0, and end the program. - if branch["options"].empty? - puts "\n#{branch["desc"]}\n\n" - return 0 - end - - valid_options = branch["options"].keys.join(", ") - - puts "\n#{branch["desc"]}\n\n" - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - end - - print "\n[#{valid_options}]> " - STDOUT.flush - response = STDIN.gets.chomp.to_i - - until branch["options"].keys.include?(response) - print "[## Invalid options. " - print "Valid options are #{valid_options}, or 0 to exit." - print "\n[#{valid_options}]> " - response = STDIN.gets.chomp.to_i - end - - puts "\n" - 10.times { print "*" } - puts "\n(Your choice: #{branch["options"][response].keys[0]})" - return branch["options"][response].values[0].to_i - end - - end - -end - -# Planter is the module for creating or editing a tree. -module Planter - -end +require_relative 'sapling/dialogue' +require_relative 'sapling/gardner' +require_relative 'sapling/planter' # Sapling is the main module for the program. From here, the rest of the world # starts building. module Sapling - # CLI is the class for option parsing, and the gateway to the program + # CLI is the class for option parsing, and the gateway to the program, on the + # command line class CLI # Option parsing, and gateway to either reading and traversing a tree, or diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb new file mode 100644 index 0000000..711717f --- /dev/null +++ b/lib/sapling/dialogue.rb @@ -0,0 +1,69 @@ +require_relative './gardner' + +# Dialogue is the module for traversing an existing tree. +module Dialogue + + # Spealer holds the functionality for viewing and going through a dialogue + # tree. + class Speaker + # The file, which should be a dialogue tree YAML file. + attr_accessor :file + + def initialize + @file = "" + end + + # Conversation handles navigating the tree, until the option to end is + # reached. + def conversation() + tree = Gardner.grow(@file) + + 10.times { print "*" } + next_branch = talk(tree[1]) + until next_branch == 0 do + next_branch = talk(tree[next_branch]) + end + + puts tree[0]["desc"] + exit + end + + # Talk displays a branch, the options, and prompts for a response + # + # @param branch [Hash] A branch data set + # @return [Integer] The number of the next branch + def talk(branch) + # If there are no options on this branch, we assume it's a terminal + # branch. Return 0, and end the program. + if branch["options"].empty? + puts "\n#{branch["desc"]}\n\n" + return 0 + end + + valid_options = branch["options"].keys.join(", ") + + puts "\n#{branch["desc"]}\n\n" + branch["options"].each_pair do |k,v| + puts "\t#{k}: #{v.keys[0]}" + end + + print "\n[#{valid_options}]> " + STDOUT.flush + response = STDIN.gets.chomp.to_i + + until branch["options"].keys.include?(response) + print "[## Invalid options. " + print "Valid options are #{valid_options}, or 0 to exit." + print "\n[#{valid_options}]> " + response = STDIN.gets.chomp.to_i + end + + puts "\n" + 10.times { print "*" } + puts "\n(Your choice: #{branch["options"][response].keys[0]})" + return branch["options"][response].values[0].to_i + end + + end + +end diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb new file mode 100644 index 0000000..4fe5894 --- /dev/null +++ b/lib/sapling/gardner.rb @@ -0,0 +1,92 @@ +require 'yaml' + +# Gardner is the module for working with a dialogue tree file +module Gardner + + # Parse the branch + # + # @param tree [Array] The dialogue tree + # @return [Array] The array of options on the branch. + def self.prune_branches(tree) + branches = { 0 => { "desc" => "Thanks for using Sapling!" } } + tree.each do |b| + branches[b["branch"]["number"]] = { + "desc" => b["branch"]["text"], + "options" => prune_leaves(b["branch"]["leaf"]) } + end + + return branches + + end + + # Parse the options + # + # @param leaves [Array] The option of leaf hashes + # @return [Hash] A has of options + def self.prune_leaves(leaves) + x = 1 + options = {} + + return options if leaves.nil? + + leaves.each do |l| + options[x] = { l["text"] => l["branch"] } + x += 1 + end + + return options + + end + + # Parse the trunk + # The trunk is like the introduction to the tree. + # + # @param tree [Hash] The entire tree + # @return [Hash] The tree without the trunk + def self.prune_trunk(tree) + trunk = tree.shift + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" + 40.times { print "-" } + puts "\n#{trunk["trunk"]}" + 40.times { print "-" } + puts "\n" + + return tree + + end + + # The main method for Sapling. From here, the tree is grown. + # + # @param file [File] The dialogue tree file + # @return [Hash] The final, constructed data set + def self.grow(file) + tree = YAML.load_file(file[0]) + tree = Gardner.prune_trunk(tree) + branches = Gardner.prune_branches(tree) + + return branches + end + + # Verify that a file is a dialogue tree file. + # + # @param file [File] The provided file + # @return [Boolean] True if the file is a tree; false otherwise + def self.verify_tree(file) + results = [] + begin + tree = YAML.load_file(file) + results << tree[0].keys.include?("trunk") + results << tree[1]["branch"].keys.include?("number") + results << tree[1]["branch"].keys.include?("text") + results << tree[1]["branch"].keys.include?("leaf") + rescue + puts "Sorry chummer, I don't think this is a tree." + puts "Verify your YAML file is formatted properly." + results << false + end + + results.include?(false) ? false : true + + end + +end diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb new file mode 100644 index 0000000..c8238ff --- /dev/null +++ b/lib/sapling/planter.rb @@ -0,0 +1,4 @@ +# Planter is the module for creating or editing a tree. +module Planter + +end From 9389816052ebcb685fff8542cfb1f586963458cc Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 13:00:09 -0400 Subject: [PATCH 24/74] README.md: Update links to respect new var dir --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2bc1415..e8f6073 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ through leafs, which are the actual choices. You can experience this yourself, by loading "Example Quest! - A Meta Dialogue Tree!". You can find the tree itself at [trees/example\_quest.yaml]( -trees/example_quest.yaml). To run it, just type `sapling -t +var/trees/example_quest.yaml). To run it, just type `sapling -t trees/example_quest.yaml`. ## Building a New Tree @@ -31,14 +31,15 @@ To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. For more details on the configuration file itself, check out the [Configuration - File documentation](docs/config_file.md), or the self-documented [configuration - file example](docs/config_file_example.yaml). Alternatively, you can checkout -[Example Quest](trees/example_quest.yaml) for a complete treel +File documentation](var/docs/config_file.md), or the self-documented +[configuration file example](var/docs/config_file_example.yaml). Alternatively, +you can checkout [Example Quest](var/trees/example_quest.yaml) for a complete +tree. ### Manual Edit 1. Open your preferred text editor. -2. Refer to the [Configuration File documentation](docs/config_file.md) +2. Refer to the [Configuration File documentation](var/docs/config_file.md) 3. Make your changes. 4. Save your changes. @@ -53,7 +54,7 @@ For more details on the configuration file itself, check out the [Configuration 5. Save your changes. More details on the editor can be found in the [Editor -documentation](docs/editor.md). +documentation](var/docs/editor.md). ## Contributing From 2d0f9a03185d27569d25a669c76950c668364a1e Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 13:00:57 -0400 Subject: [PATCH 25/74] .travis.yml: Travis-CI barebones config file --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d2bf887 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: ruby +sudo: false +rvm: + - 2.0 + - 2.1 + - 2.2 From 520aad9740c3cd8b087a33498286cee04d0ce0e5 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:43:57 -0400 Subject: [PATCH 26/74] utility.rb: Functionality shared across sapling - Added some constants, specifically those used for brand new trees - Moved the verify functionality into here --- lib/sapling/utility.rb | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 lib/sapling/utility.rb diff --git a/lib/sapling/utility.rb b/lib/sapling/utility.rb new file mode 100644 index 0000000..12b13f1 --- /dev/null +++ b/lib/sapling/utility.rb @@ -0,0 +1,59 @@ +# Utility functionality for all of Sapling to reference + +# Constants + +# A series of constants for handing a brand new tree. The skeleton tree provides +# a very basic introduction to Sapling. More details can be found in the +# documentation. + +# The default trunk text of a new tree +SKELE_TRUNK_TEXT = "Welcome to the Sapling Editor. For details, please see the +documentation!" + +# The default first-branch text of a new tree +SKELE_BRANCH_TEXT = "The first branch is always shown by default. It should act +as the introduction to the story. From here, the user enters your world!" + +# The default first-leaf text of the first branch of a new tree. The leaf points +# to it's own branch. The only way out of the program is to either force-quit or +# reply with option 0. +SKELE_LEAF_TEXT = "Each branch can have any number of leaves, which represent +the options a user has on that branch. Each leaf points to another branch, or +can point to branch 0 to immediately exit." + +# The final tree +SKELETON_TREE = [ + {"trunk" => "#{SKELE_TRUNK_TEXT}"}, + {"branch" => { + "number" => 1, + "text" => "#{SKELE_BRANCH_TEXT}", + "leaf" => [{ + "text" => "#{SKELE_LEAF_TEXT}", + "branch" => 1 + }] + } + } +] + + +# Verify that a file is a dialogue tree file. +# +# @param file [File] The provided file +# @return [Boolean] True if the file is a tree; false otherwise +def verify_tree(file) + results = [] + begin + tree = YAML.load_file(file) + results << tree[0].keys.include?("trunk") + results << tree[1]["branch"].keys.include?("number") + results << tree[1]["branch"].keys.include?("text") + results << tree[1]["branch"].keys.include?("leaf") + rescue + puts "Sorry chummer, I don't think this is a tree." + puts "Verify your YAML file is formatted properly." + results << false + end + + results.include?(false) ? false : true + +end From adecc3b1936251556f720139a5422cba8786d77a Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:47:05 -0400 Subject: [PATCH 27/74] dialogue.rb: Add debug mode and results - Dialogue can show some additional, generally hidden details about what's on screen. - New attribute :debug (Boolean) - Added debug information --- lib/sapling/dialogue.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 711717f..bbae8b9 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -9,8 +9,12 @@ module Dialogue # The file, which should be a dialogue tree YAML file. attr_accessor :file + # Status of verbose/debug mode. True = on; false = off. + attr_accessor :debug + def initialize @file = "" + @debug = false end # Conversation handles navigating the tree, until the option to end is @@ -19,12 +23,14 @@ module Dialogue tree = Gardner.grow(@file) 10.times { print "*" } + puts "\n[ Branch: 1 ]" if @debug next_branch = talk(tree[1]) until next_branch == 0 do + puts "\n[ Branch: #{next_branch} ]" if @debug next_branch = talk(tree[next_branch]) end - puts tree[0]["desc"] + puts "\n#{tree[0]["desc"]}" exit end @@ -33,6 +39,7 @@ module Dialogue # @param branch [Hash] A branch data set # @return [Integer] The number of the next branch def talk(branch) + # If there are no options on this branch, we assume it's a terminal # branch. Return 0, and end the program. if branch["options"].empty? @@ -45,21 +52,24 @@ module Dialogue puts "\n#{branch["desc"]}\n\n" branch["options"].each_pair do |k,v| puts "\t#{k}: #{v.keys[0]}" + puts "\t\t [ Goes to branch #{v.values[0]} ]" if @debug end print "\n[#{valid_options}]> " STDOUT.flush response = STDIN.gets.chomp.to_i - until branch["options"].keys.include?(response) + until branch["options"].keys.include?(response) or response == 0 print "[## Invalid options. " print "Valid options are #{valid_options}, or 0 to exit." print "\n[#{valid_options}]> " response = STDIN.gets.chomp.to_i end + puts "\n" 10.times { print "*" } + return 0 if response == 0 puts "\n(Your choice: #{branch["options"][response].keys[0]})" return branch["options"][response].values[0].to_i end From 4570ee37e6260eac001fcae2e0ef8fc8d9fce260 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:51:00 -0400 Subject: [PATCH 28/74] sapling.rb: Multiple fixes - Add logic for Planter, the editor module - Add logic for catching a bad switch, and reporting accordingly - Add logic for when no tree is included when required, and reporting accordingly - Move YAML file loading from Dialogue/Gardner to here --- lib/sapling.rb | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 7bfba7b..890f562 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -6,6 +6,7 @@ require 'yaml' require_relative 'sapling/dialogue' require_relative 'sapling/gardner' require_relative 'sapling/planter' +require_relative 'sapling/utility' # Sapling is the main module for the program. From here, the rest of the world # starts building. @@ -31,29 +32,50 @@ module Sapling "Begin traversing the provided dialogue tree") do if ARGV.empty? + puts "No tree file provided. Please provide a tree file." puts opt_parser exit end - unless Gardner.verify_tree(ARGV[0]) + unless verify_tree(ARGV[0]) puts "\n#{opt}\n" exit end + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" speaker = Dialogue::Speaker.new - speaker.file = ARGV + speaker.file = YAML.load_file(ARGV[0]) speaker.conversation end opt.on("-e", "--edit", "Create or edit a dialogue tree") do - puts "We gonna make a tree!" + + if ARGV.empty? + puts "Creating a new tree." + tree = SKELETON_TREE + else + puts "Using tree at #{ARGV[0]}." + unless verify_tree(ARGV[0]) + puts "\n#{opt}\n" + exit + end + tree = YAML.load_file(ARGV[0]) + end + + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" + gardner = Planter::Spade.new + gardner.file = tree + gardner.plant end end - opt_parser.parse!(options) - if ARGV.empty? + # Hacky way of dealing with bad options + begin + opt_parser.parse!(options) + rescue OptionParser::InvalidOption + puts "Invalid option." puts opt_parser exit end From bd69690272a197dd7e648800bd65c2e734120d73 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:53:16 -0400 Subject: [PATCH 29/74] gardner.rb: Refactoring - Move YAML file loading to sapling - Move tree verification to utility --- lib/sapling/gardner.rb | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index 4fe5894..a75c28e 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -45,7 +45,6 @@ module Gardner # @return [Hash] The tree without the trunk def self.prune_trunk(tree) trunk = tree.shift - puts "Welcome to Sapling, a Dialogue Tree Utility.\n" 40.times { print "-" } puts "\n#{trunk["trunk"]}" 40.times { print "-" } @@ -59,34 +58,11 @@ module Gardner # # @param file [File] The dialogue tree file # @return [Hash] The final, constructed data set - def self.grow(file) - tree = YAML.load_file(file[0]) - tree = Gardner.prune_trunk(tree) - branches = Gardner.prune_branches(tree) + def self.grow(tree) + trunk = Gardner.prune_trunk(tree) + branches = Gardner.prune_branches(trunk) return branches end - # Verify that a file is a dialogue tree file. - # - # @param file [File] The provided file - # @return [Boolean] True if the file is a tree; false otherwise - def self.verify_tree(file) - results = [] - begin - tree = YAML.load_file(file) - results << tree[0].keys.include?("trunk") - results << tree[1]["branch"].keys.include?("number") - results << tree[1]["branch"].keys.include?("text") - results << tree[1]["branch"].keys.include?("leaf") - rescue - puts "Sorry chummer, I don't think this is a tree." - puts "Verify your YAML file is formatted properly." - results << false - end - - results.include?(false) ? false : true - - end - end From 1740c759dfb99bccaffd6df63bb071406d018c7b Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:53:33 -0400 Subject: [PATCH 30/74] .travis.yml: Remove unnecessary Ruby versions --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d2bf887..a0d5e80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ language: ruby sudo: false rvm: - - 2.0 - - 2.1 - 2.2 From 29be7885de56f37a546476ed578ea387d23dc463 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:56:31 -0400 Subject: [PATCH 31/74] planter.rb: Start work on editor This should probably be on it's own branch, but too many of the changes I made were already committed. - Logic for a Plot, basically a data class - Logic for Spade, the main functionality of the class - Logic to load and parse the tree - Functionality for loading the first branch with debugging mode TO-DO - Abstract branch display properly into Dialogue - Abstract tree loading and parsing probably back into Gardner - Change Gardner to a different name. Like... Druid or something... - Actually build the editor --- lib/sapling/planter.rb | 113 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index c8238ff..7783d66 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -1,4 +1,117 @@ +require_relative './dialogue' +require_relative './gardner' +require_relative './utility' + # Planter is the module for creating or editing a tree. module Planter + class Plot + # The tree, trunk, and branches + attr_accessor :tree, :trunk, :branches + + end + + # Utilities for editing specific parts of a tree. + class Spade + + # The file we parse into a tree + attr_writer :file + + # Establish a new Plot, which is basically an object for storing information + # for us. From here, we start gardening. + def plant + @plot = Plot.new + @plot.tree = @file + @plot.trunk = @file.shift.values[0] + @plot.branches = Gardner.prune_branches(@file) + + dig(1) + end + + # Function for displaying a single branch in debug mode. We also always + # display the trunk, since otherwise it's displayed a single time then gone + # forever (until next time). + # + # @param branch [Integer] The number of the branch to be displayed. + def dig(branch_no) + branch = @plot.branches[branch_no] + + # Print the trunk + 40.times { print "-" } + puts "\n[ Trunk ]\n#{@plot.trunk}" + 40.times { print "-" } + puts "\n" + 10.times { print "*" } + + # Print the branch and options + puts "\n[ Branch: #{branch_no} ]" + puts "\n#{branch["desc"]}\n\n" + unless branch["options"].empty? + branch["options"].each_pair do |k,v| + puts "\t#{k}: #{v.keys[0]}" + puts "\t\t [ Goes to branch #{v.values[0]} ]" + end + end + end + + # Edit the trunk of the tree + def edit_trunk + + end + + # Edit a branch on the tree + # + # @param branch [Integer] The number of the branch to be edited. + def edit_branch(branch) + + end + + # Edit a leaf on a branch, grasshopper + # + # @param branch [Integer] The number of the branch to be edited. + # @param leaf [Hash] The leaf hash to be edited. + def edit_leaf(branch, leaf) + + end + + end + end + +=begin + +Process: +- User selects to create/edit a tree + - If the user presented a file, use it as the tree file + - If the user failed to provide a file, create a new tree file in the current directory + +- Check if the file is empty. + - If so, assume a new tree + - If not, verify formatting + +- If new tree, prompt for trunk +- If existing tree, display trunk and first branch + +- At this point, editing is the same + - Prompt provides options: + - B # - Go to Branch # + - T - Edit Trunk + - D - Edit Current Branch description + - X - Delete Current Branch + - L A - Add a new Leaf + - L # D - Edit Leaf # description + - L # B - Edit Leaf # branch destination + - L # X - Remove Leaf # + - S - Save Changes (write to the file) + - Q - Quit without saving + +Details: + +- Regardless of the file existing, the user will be editing a Hash, not the actual YAML file + - Use Gardner to build the tree (either existing or skeleton) + - Use Dialog to interact with the tree + - Overwrite prompt with Planter prompt + - On changes, re-build the tree, and restart dialogue from most recent branch +- After each edit option, display the current branch with the new changes. + +=end From d0b25e210cf18191cb0397ff4cc271faffa9008d Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:59:24 -0400 Subject: [PATCH 32/74] Fix documentation warnings --- lib/sapling/gardner.rb | 2 +- lib/sapling/planter.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index a75c28e..5437883 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -56,7 +56,7 @@ module Gardner # The main method for Sapling. From here, the tree is grown. # - # @param file [File] The dialogue tree file + # @param tree [File] The dialogue tree file # @return [Hash] The final, constructed data set def self.grow(tree) trunk = Gardner.prune_trunk(tree) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index 7783d66..4c30739 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -32,7 +32,7 @@ module Planter # display the trunk, since otherwise it's displayed a single time then gone # forever (until next time). # - # @param branch [Integer] The number of the branch to be displayed. + # @param branch_no [Integer] The number of the branch to be displayed. def dig(branch_no) branch = @plot.branches[branch_no] From 8d2da5c6c60316e701810e0cee6afbb7a1e4d210 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 16:59:34 -0400 Subject: [PATCH 33/74] Update documentation --- doc/Dialogue.html | 4 +- doc/Dialogue/Speaker.html | 202 ++++++--- doc/Gardner.html | 193 ++------- doc/Planter.html | 16 +- doc/Planter/Plot.html | 341 +++++++++++++++ doc/Planter/Spade.html | 680 ++++++++++++++++++++++++++++++ doc/Sapling.html | 2 +- doc/Sapling/CLI.html | 141 ++++--- doc/_index.html | 18 +- doc/class_list.html | 2 +- doc/file.CONTRIBUTING.html | 2 +- doc/file.LICENSE.html | 2 +- doc/file.README.html | 17 +- doc/file.config_file.html | 2 +- doc/file.config_file_example.html | 2 +- doc/file.editor.html | 2 +- doc/index.html | 17 +- doc/method_list.html | 88 +++- doc/top-level-namespace.html | 236 ++++++++++- 19 files changed, 1657 insertions(+), 310 deletions(-) create mode 100644 doc/Planter/Plot.html create mode 100644 doc/Planter/Spade.html diff --git a/doc/Dialogue.html b/doc/Dialogue.html index 8e05121..a236f14 100644 --- a/doc/Dialogue.html +++ b/doc/Dialogue.html @@ -78,7 +78,7 @@
    Defined in:
    -
    lib/sapling.rb
    +
    lib/sapling/dialogue.rb
    @@ -116,7 +116,7 @@ diff --git a/doc/Dialogue/Speaker.html b/doc/Dialogue/Speaker.html index 92b7f7a..3bd027f 100644 --- a/doc/Dialogue/Speaker.html +++ b/doc/Dialogue/Speaker.html @@ -94,7 +94,7 @@
    Defined in:
    -
    lib/sapling.rb
    +
    lib/sapling/dialogue.rb
    @@ -118,6 +118,33 @@ tree.

    Instance Attribute Summary collapse

      +
    • + + + #debug ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Status of verbose/debug mode.

      +
      + +
    • + +
    • @@ -265,15 +292,17 @@ reached.

       
       
      -106
      -107
      -108
      +15 +16 +17 +18
    @@ -286,9 +315,52 @@ reached.

    Instance Attribute Details

    - +
    -

    +

    + + #debugObject + + + + + +

    +
    + +

    Status of verbose/debug mode. True = on; false = off.

    + + +
    +
    +
    + + +
    -
    # File 'lib/sapling.rb', line 106
    +      
    # File 'lib/sapling/dialogue.rb', line 15
     
     def initialize
       @file = ""
    +  @debug = false
     end
    + + + + +
    +
    +
    +
    +13
    +14
    +15
    +
    +
    # File 'lib/sapling/dialogue.rb', line 13
    +
    +def debug
    +  @debug
    +end
    +
    + + + + +
    +

    #fileObject @@ -313,12 +385,12 @@ reached.

     
     
    -104
    -105
    -106
    +10 +11 +12 -
    # File 'lib/sapling.rb', line 104
    +      
    # File 'lib/sapling/dialogue.rb', line 10
     
     def file
       @file
    @@ -362,32 +434,36 @@ reached.

     
     
    -112
    -113
    -114
    -115
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
    +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35
    -
    # File 'lib/sapling.rb', line 112
    +      
    # File 'lib/sapling/dialogue.rb', line 22
     
     def conversation()
       tree = Gardner.grow(@file)
     
       10.times { print "*" }
    +  puts "\n[ Branch: 1 ]" if @debug
       next_branch = talk(tree[1])
       until next_branch == 0 do
    +    puts "\n[ Branch: #{next_branch} ]" if @debug
         next_branch = talk(tree[next_branch])
       end
     
    -  puts tree[0]["desc"]
    +  puts "\n#{tree[0]["desc"]}"
       exit
     end
    @@ -459,42 +535,47 @@ reached.

     
     
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    -137
    -138
    -139
    -140
    -141
    -142
    -143
    -144
    -145
    -146
    -147
    -148
    -149
    -150
    -151
    -152
    -153
    -154
    -155
    -156
    -157
    -158
    -159
    +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75
    -
    # File 'lib/sapling.rb', line 129
    +      
    # File 'lib/sapling/dialogue.rb', line 41
     
     def talk(branch)
    +
       # If there are no options on this branch, we assume it's a terminal
       # branch. Return 0, and end the program.
       if branch["options"].empty?
    @@ -507,21 +588,24 @@ reached.

    puts "\n#{branch["desc"]}\n\n" branch["options"].each_pair do |k,v| puts "\t#{k}: #{v.keys[0]}" + puts "\t\t [ Goes to branch #{v.values[0]} ]" if @debug end print "\n[#{valid_options}]> " STDOUT.flush response = STDIN.gets.chomp.to_i - until branch["options"].keys.include?(response) + until branch["options"].keys.include?(response) or response == 0 print "[## Invalid options. " print "Valid options are #{valid_options}, or 0 to exit." print "\n[#{valid_options}]> " response = STDIN.gets.chomp.to_i end + puts "\n" 10.times { print "*" } + return 0 if response == 0 puts "\n(Your choice: #{branch["options"][response].keys[0]})" return branch["options"][response].values[0].to_i end
    @@ -535,7 +619,7 @@ reached.

    diff --git a/doc/Gardner.html b/doc/Gardner.html index 5ca76ef..8934804 100644 --- a/doc/Gardner.html +++ b/doc/Gardner.html @@ -78,7 +78,7 @@
    Defined in:
    -
    lib/sapling.rb
    +
    lib/sapling/gardner.rb
    @@ -112,7 +112,7 @@
  • - .grow(file) ⇒ Hash + .grow(tree) ⇒ Hash @@ -202,30 +202,6 @@

    Parse the trunk The trunk is like the introduction to the tree.

    -
  • - - -
  • - - - .verify_tree(file) ⇒ Boolean - - - - - - - - - - - - - -
    -

    Verify that a file is a dialogue tree file.

    -
    -
  • @@ -241,7 +217,7 @@

    - .grow(file) ⇒ Hash + .grow(tree) ⇒ Hash @@ -261,7 +237,7 @@
  • - file + tree (File) @@ -302,21 +278,19 @@
     
     
    +61
    +62
    +63
    +64
     65
    -66
    -67
    -68
    -69
    -70
    -71
    +66 -
    # File 'lib/sapling.rb', line 65
    +      
    # File 'lib/sapling/gardner.rb', line 61
     
    -def self.grow(file)
    -    tree = YAML.load_file(file[0])
    -    tree = Gardner.prune_trunk(tree)
    -    branches = Gardner.prune_branches(tree)
    +def self.grow(tree)
    +    trunk = Gardner.prune_trunk(tree)
    +    branches = Gardner.prune_branches(trunk)
     
         return branches
     end
    @@ -389,6 +363,9 @@
     
     
    +10
    +11
    +12
     13
     14
     15
    @@ -396,13 +373,10 @@
     17
     18
     19
    -20
    -21
    -22
    -23
    +20
    -
    # File 'lib/sapling.rb', line 13
    +      
    # File 'lib/sapling/gardner.rb', line 10
     
     def self.prune_branches(tree)
       branches = { 0 => { "desc" => "Thanks for using Sapling!" } }
    @@ -484,6 +458,9 @@
           
     
     
    +26
    +27
    +28
     29
     30
     31
    @@ -494,13 +471,10 @@
     36
     37
     38
    -39
    -40
    -41
    -42
    +39
    -
    # File 'lib/sapling.rb', line 29
    +      
    # File 'lib/sapling/gardner.rb', line 26
     
     def self.prune_leaves(leaves)
       x = 1
    @@ -585,24 +559,22 @@
           
     
     
    +46
    +47
    +48
     49
     50
     51
     52
     53
     54
    -55
    -56
    -57
    -58
    -59
    +55
    -
    # File 'lib/sapling.rb', line 49
    +      
    # File 'lib/sapling/gardner.rb', line 46
     
     def self.prune_trunk(tree)
       trunk = tree.shift
    -  puts "Welcome to Sapling, a Dialogue Tree Utility.\n"
       40.times { print "-" }
       puts "\n#{trunk["trunk"]}"
       40.times { print "-" }
    @@ -610,113 +582,6 @@
     
       return tree
     
    -end
    - - - -
  • - -
    -

    - - .verify_tree(file) ⇒ Boolean - - - - - -

    -
    - -

    Verify that a file is a dialogue tree file.

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - file - - - (File) - - - - — -
      -

      The provided file

      -
      - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Boolean) - - - - — -
      -

      True if the file is a tree; false otherwise

      -
      - -
    • - -
    - -
    - - - @@ -728,7 +593,7 @@ diff --git a/doc/Planter.html b/doc/Planter.html index 7b82fd1..ae43cdd 100644 --- a/doc/Planter.html +++ b/doc/Planter.html @@ -78,7 +78,7 @@
    Defined in:
    -
    lib/sapling.rb
    +
    lib/sapling/planter.rb
    @@ -94,7 +94,17 @@
    -
    +

    Defined Under Namespace

    +

    + + + + + Classes: Plot, Spade + + +

    + @@ -106,7 +116,7 @@ diff --git a/doc/Planter/Plot.html b/doc/Planter/Plot.html new file mode 100644 index 0000000..d13ec89 --- /dev/null +++ b/doc/Planter/Plot.html @@ -0,0 +1,341 @@ + + + + + + + Class: Planter::Plot + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Planter::Plot + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/planter.rb
    +
    + +
    + + + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #branches ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    • + + + #tree ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    • + + + #trunk ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    + + + + + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #branchesObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    -
    -
    -
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    -92
    -93
    -
    -
    # File 'lib/sapling.rb', line 77
    -
    -def self.verify_tree(file)
    -  results = []
    -  begin
    -    tree = YAML.load_file(file)
    -    results << tree[0].keys.include?("trunk")
    -    results << tree[1]["branch"].keys.include?("number")
    -    results << tree[1]["branch"].keys.include?("text")
    -    results << tree[1]["branch"].keys.include?("leaf")
    -  rescue
    -    puts "Sorry chummer, I don't think this is a tree."
    -    puts "Verify your YAML file is formatted properly."
    -    results << false
    -  end
    -
    -  results.include?(false) ? false : true
    -
     end
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +
    +
    # File 'lib/sapling/planter.rb', line 10
    +
    +def branches
    +  @branches
    +end
    +
    +
    + + + +
    +

    + + #treeObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +
    +
    # File 'lib/sapling/planter.rb', line 10
    +
    +def tree
    +  @tree
    +end
    +
    +
    + + + +
    +

    + + #trunkObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +
    +
    # File 'lib/sapling/planter.rb', line 10
    +
    +def trunk
    +  @trunk
    +end
    +
    +
    + + + + + + + + + + + \ No newline at end of file diff --git a/doc/Planter/Spade.html b/doc/Planter/Spade.html new file mode 100644 index 0000000..39dce54 --- /dev/null +++ b/doc/Planter/Spade.html @@ -0,0 +1,680 @@ + + + + + + + Class: Planter::Spade + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Planter::Spade + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/planter.rb
    +
    + +
    + +

    Overview

    +
    + +

    Utilities for editing specific parts of a tree.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #file ⇒ Object + + + + + + + + + + writeonly + + + + + + + + +
      +

      The file we parse into a tree.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #file=(value) ⇒ Object (writeonly) + + + + + +

    +
    + +

    The file we parse into a tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +18
    +19
    +20
    +
    +
    # File 'lib/sapling/planter.rb', line 18
    +
    +def file=(value)
    +  @file = value
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #dig(branch_no) ⇒ Object + + + + + +

    +
    + +

    Function for displaying a single branch in debug mode. We also always +display the trunk, since otherwise it's displayed a single time then +gone forever (until next time).

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The number of the branch to be displayed.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +
    +
    # File 'lib/sapling/planter.rb', line 36
    +
    +def dig(branch_no)
    +  branch = @plot.branches[branch_no]
    +
    +  # Print the trunk
    +  40.times { print "-" }
    +  puts "\n[ Trunk ]\n#{@plot.trunk}"
    +  40.times { print "-" }
    +  puts "\n"
    +  10.times { print "*" }
    +
    +  # Print the branch and options
    +  puts "\n[ Branch: #{branch_no} ]"
    +  puts "\n#{branch["desc"]}\n\n"
    +  unless branch["options"].empty?
    +    branch["options"].each_pair do |k,v|
    +      puts "\t#{k}: #{v.keys[0]}"
    +      puts "\t\t [ Goes to branch #{v.values[0]} ]"
    +    end
    +  end
    +end
    +
    +
    + +
    +

    + + #edit_branch(branch) ⇒ Object + + + + + +

    +
    + +

    Edit a branch on the tree

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +65
    +66
    +67
    +
    +
    # File 'lib/sapling/planter.rb', line 65
    +
    +def edit_branch(branch)
    +
    +end
    +
    +
    + +
    +

    + + #edit_leaf(branch, leaf) ⇒ Object + + + + + +

    +
    + +

    Edit a leaf on a branch, grasshopper

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    • + + leaf + + + (Hash) + + + + — +
      +

      The leaf hash to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +73
    +74
    +75
    +
    +
    # File 'lib/sapling/planter.rb', line 73
    +
    +def edit_leaf(branch, leaf)
    +
    +end
    +
    +
    + +
    +

    + + #edit_trunkObject + + + + + +

    +
    + +

    Edit the trunk of the tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +58
    +59
    +60
    +
    +
    # File 'lib/sapling/planter.rb', line 58
    +
    +def edit_trunk
    +
    +end
    +
    +
    + +
    +

    + + #plantObject + + + + + +

    +
    + +

    Establish a new Plot, which is basically an object for storing information +for us. From here, we start gardening.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +
    +
    # File 'lib/sapling/planter.rb', line 22
    +
    +def plant
    +  @plot = Plot.new
    +  @plot.tree = @file
    +  @plot.trunk = @file.shift.values[0]
    +  @plot.branches = Gardner.prune_branches(@file)
    +
    +  dig(1)
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/doc/Sapling.html b/doc/Sapling.html index e5a4e99..70266ba 100644 --- a/doc/Sapling.html +++ b/doc/Sapling.html @@ -117,7 +117,7 @@ world starts building.

    diff --git a/doc/Sapling/CLI.html b/doc/Sapling/CLI.html index 51e6c10..72677c2 100644 --- a/doc/Sapling/CLI.html +++ b/doc/Sapling/CLI.html @@ -102,7 +102,8 @@

    Overview

    -

    CLI is the class for option parsing, and the gateway to the program

    +

    CLI is the class for option parsing, and the gateway to the program, on the +command line

    @@ -186,50 +187,71 @@ editing/creating a tree.

     
     
    -179
    -180
    -181
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
    -190
    -191
    -192
    -193
    -194
    -195
    -196
    -197
    -198
    -199
    -200
    -201
    -202
    -203
    -204
    -205
    -206
    -207
    -208
    -209
    -210
    -211
    -212
    -213
    -214
    -215
    -216
    -217
    -218
    -219
    +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 -
    # File 'lib/sapling.rb', line 179
    +      
    # File 'lib/sapling.rb', line 21
     
     def talk(options)
       opt_parser = OptionParser.new do |opt|
    @@ -245,29 +267,50 @@ editing/creating a tree.

    "Begin traversing the provided dialogue tree") do if ARGV.empty? + puts "No tree file provided. Please provide a tree file." puts opt_parser exit end - unless Gardner.verify_tree(ARGV[0]) + unless verify_tree(ARGV[0]) puts "\n#{opt}\n" exit end + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" speaker = Dialogue::Speaker.new - speaker.file = ARGV + speaker.file = YAML.load_file(ARGV[0]) speaker.conversation end opt.on("-e", "--edit", "Create or edit a dialogue tree") do - puts "We gonna make a tree!" + + if ARGV.empty? + puts "Creating a new tree." + tree = SKELETON_TREE + else + puts "Using tree at #{ARGV[0]}." + unless verify_tree(ARGV[0]) + puts "\n#{opt}\n" + exit + end + tree = YAML.load_file(ARGV[0]) + end + + puts "Welcome to Sapling, a Dialogue Tree Utility.\n" + gardner = Planter::Spade.new + gardner.file = tree + gardner.plant end end - opt_parser.parse!(options) - if ARGV.empty? + # Hacky way of dealing with bad options + begin + opt_parser.parse!(options) + rescue OptionParser::InvalidOption + puts "Invalid option." puts opt_parser exit end @@ -282,7 +325,7 @@ editing/creating a tree.

    diff --git a/doc/_index.html b/doc/_index.html index 0ad8a13..86da46c 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -84,6 +84,8 @@

    Namespace Listing A-Z

    + + @@ -141,6 +143,13 @@ +
  • + Plot + + (Planter) + +
  • + @@ -154,6 +163,13 @@ +
  • + Spade + + (Planter) + +
  • +
  • Speaker @@ -173,7 +189,7 @@ diff --git a/doc/class_list.html b/doc/class_list.html index 1fed642..4edf910 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -43,7 +43,7 @@ diff --git a/doc/file.CONTRIBUTING.html b/doc/file.CONTRIBUTING.html index fb05c4f..9b7f6a2 100644 --- a/doc/file.CONTRIBUTING.html +++ b/doc/file.CONTRIBUTING.html @@ -74,7 +74,7 @@ feel free to submit an issue or reach out to me directly.

    diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html index 75a1ae6..70625c3 100644 --- a/doc/file.LICENSE.html +++ b/doc/file.LICENSE.html @@ -82,7 +82,7 @@ DEALINGS IN THE SOFTWARE.

    diff --git a/doc/file.README.html b/doc/file.README.html index 4468c94..1ab7dc9 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -75,7 +75,7 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.

    You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t +Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t trees/example_quest.yaml.

    Building a New Tree

    @@ -83,16 +83,17 @@ trees/example_quest.yaml
    .

    To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the Configuration - File documentation, or the self-documented configuration - file example. Alternatively, you can checkout -Example Quest for a complete treel

    +For more details on the configuration file itself, check out the Configuration +File documentation, or the self-documented +configuration file example. Alternatively, +you can checkout Example Quest for a complete +tree.

    Manual Edit

    1. Open your preferred text editor.
    2. -
    3. Refer to the Configuration File documentation
    4. +
    5. Refer to the Configuration File documentation
    6. Make your changes.
    7. Save your changes.
    @@ -109,7 +110,7 @@ trunk, and show you the first branch.
  • Save your changes.
  • -

    More details on the editor can be found in the Editor +

    More details on the editor can be found in the Editor documentation.

    Contributing

    @@ -131,7 +132,7 @@ guidelines. diff --git a/doc/file.config_file.html b/doc/file.config_file.html index 12013e7..03a9d92 100644 --- a/doc/file.config_file.html +++ b/doc/file.config_file.html @@ -126,7 +126,7 @@ branch", and the program will end after reaching it. diff --git a/doc/file.config_file_example.html b/doc/file.config_file_example.html index 3a46390..9374e60 100644 --- a/doc/file.config_file_example.html +++ b/doc/file.config_file_example.html @@ -100,7 +100,7 @@ diff --git a/doc/file.editor.html b/doc/file.editor.html index 3a42c19..f2263ab 100644 --- a/doc/file.editor.html +++ b/doc/file.editor.html @@ -72,7 +72,7 @@ allows for editing all parts of a tree, from the trunk to the leaves.

    diff --git a/doc/index.html b/doc/index.html index 6476ee2..5348f78 100644 --- a/doc/index.html +++ b/doc/index.html @@ -75,7 +75,7 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.

    You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t +Tree!". You can find the tree itself at trees/example_quest.yaml. To run it, just type sapling -t trees/example_quest.yaml.

    Building a New Tree

    @@ -83,16 +83,17 @@ trees/example_quest.yaml.

    To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the Configuration - File documentation, or the self-documented configuration - file example. Alternatively, you can checkout -Example Quest for a complete treel

    +For more details on the configuration file itself, check out the Configuration +File documentation, or the self-documented +configuration file example. Alternatively, +you can checkout Example Quest for a complete +tree.

    Manual Edit

    1. Open your preferred text editor.
    2. -
    3. Refer to the Configuration File documentation
    4. +
    5. Refer to the Configuration File documentation
    6. Make your changes.
    7. Save your changes.
    @@ -109,7 +110,7 @@ trunk, and show you the first branch.
  • Save your changes.
  • -

    More details on the editor can be found in the Editor +

    More details on the editor can be found in the Editor documentation.

    Contributing

    @@ -131,7 +132,7 @@ guidelines. diff --git a/doc/method_list.html b/doc/method_list.html index b23b782..a22cb7c 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -45,6 +45,14 @@
  • +
    + #branches + Planter::Plot +
    +
  • + + +
  • #conversation Dialogue::Speaker @@ -52,6 +60,46 @@
  • +
  • +
    + #debug + Dialogue::Speaker +
    +
  • + + +
  • +
    + #dig + Planter::Spade +
    +
  • + + +
  • +
    + #edit_branch + Planter::Spade +
    +
  • + + +
  • +
    + #edit_leaf + Planter::Spade +
    +
  • + + +
  • +
    + #edit_trunk + Planter::Spade +
    +
  • + +
  • #file @@ -78,15 +126,15 @@
  • - prune_branches - Gardner + #plant + Planter::Spade
  • @@ -94,7 +142,7 @@
  • @@ -102,8 +150,8 @@
  • - #talk - Dialogue::Speaker + prune_trunk + Gardner
  • @@ -118,8 +166,32 @@
  • - verify_tree - Gardner + #talk + Dialogue::Speaker +
    +
  • + + +
  • +
    + #tree + Planter::Plot +
    +
  • + + +
  • +
    + #trunk + Planter::Plot +
    +
  • + + +
  • +
    + #verify_tree + Top Level Namespace
  • diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 33af615..3eae178 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -89,6 +89,91 @@

    +

    Constant Summary

    +
    + +
    SKELE_TRUNK_TEXT = +
    +
    + +

    The default trunk text of a new tree

    + + +
    +
    +
    + + +
    +
    +
    "Welcome to the Sapling Editor. For details, please see the
    +documentation!"
    + +
    SKELE_BRANCH_TEXT = +
    +
    + +

    The default first-branch text of a new tree

    + + +
    +
    +
    + + +
    +
    +
    "The first branch is always shown by default. It should act
    +as the introduction to the story. From here, the user enters your world!"
    + +
    SKELE_LEAF_TEXT = +
    +
    + +

    The default first-leaf text of the first branch of a new tree. The leaf +points to it's own branch. The only way out of the program is to either +force-quit or reply with option 0.

    + + +
    +
    +
    + + +
    +
    +
    "Each branch can have any number of leaves, which represent
    +the options a user has on that branch. Each leaf points to another branch, or
    +can point to branch 0 to immediately exit."
    + +
    SKELETON_TREE = +
    +
    + +

    The final tree

    + + +
    +
    +
    + + +
    +
    +
    [
    +  {"trunk" => "#{SKELE_TRUNK_TEXT}"},
    +  {"branch" => {
    +    "number" => 1,
    +    "text" => "#{SKELE_BRANCH_TEXT}",
    +    "leaf" => [{
    +      "text" => "#{SKELE_LEAF_TEXT}",
    +      "branch" => 1
    +      }]
    +    }
    +  }
    +]
    + +
    @@ -96,11 +181,160 @@ + +

    + Instance Method Summary + collapse +

    + + + + + + +
    +

    Instance Method Details

    + + +
    +

    + + #verify_tree(file) ⇒ Boolean + + + + + +

    +
    + +

    Verify that a file is a dialogue tree file.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + file + + + (File) + + + + — +
      +

      The provided file

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Boolean) + + + + — +
      +

      True if the file is a tree; false otherwise

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +
    +
    # File 'lib/sapling/utility.rb', line 43
    +
    +def verify_tree(file)
    +  results = []
    +  begin
    +    tree = YAML.load_file(file)
    +    results << tree[0].keys.include?("trunk")
    +    results << tree[1]["branch"].keys.include?("number")
    +    results << tree[1]["branch"].keys.include?("text")
    +    results << tree[1]["branch"].keys.include?("leaf")
    +  rescue
    +    puts "Sorry chummer, I don't think this is a tree."
    +    puts "Verify your YAML file is formatted properly."
    +    results << false
    +  end
    +
    +  results.include?(false) ? false : true
    +
    +end
    +
    + + + From 252ad93d5e4a1034167badfed67da2f1c6d7ed71 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 23:43:35 -0400 Subject: [PATCH 34/74] sapling/utility.rb: Minor style refactoring --- lib/sapling.rb | 4 +--- lib/sapling/utility.rb | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 890f562..c80903f 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -11,11 +11,9 @@ require_relative 'sapling/utility' # Sapling is the main module for the program. From here, the rest of the world # starts building. module Sapling - # CLI is the class for option parsing, and the gateway to the program, on the # command line class CLI - # Option parsing, and gateway to either reading and traversing a tree, or # editing/creating a tree. def talk(options) @@ -71,7 +69,7 @@ module Sapling end - # Hacky way of dealing with bad options + # Handle bad options gracefully begin opt_parser.parse!(options) rescue OptionParser::InvalidOption diff --git a/lib/sapling/utility.rb b/lib/sapling/utility.rb index 12b13f1..576122a 100644 --- a/lib/sapling/utility.rb +++ b/lib/sapling/utility.rb @@ -55,5 +55,4 @@ def verify_tree(file) end results.include?(false) ? false : true - end From e27cd43e7c3221eb0744b1ec584aeabca33be143 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 23:46:19 -0400 Subject: [PATCH 35/74] dialogue.rb: Refactor - Abstract functionality from talk into individual functions: - display_trunk: Displays the trunk of the branch. - display_branch: Displays the branch and option list - get_response: Displays the conversation prompt, and gets the response - Of note, this allows the editor to make use of talk functionality --- lib/sapling/dialogue.rb | 72 ++++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index bbae8b9..35acec9 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -2,13 +2,11 @@ require_relative './gardner' # Dialogue is the module for traversing an existing tree. module Dialogue - - # Spealer holds the functionality for viewing and going through a dialogue + # Speaker holds the functionality for viewing and going through a dialogue # tree. class Speaker # The file, which should be a dialogue tree YAML file. attr_accessor :file - # Status of verbose/debug mode. True = on; false = off. attr_accessor :debug @@ -20,26 +18,26 @@ module Dialogue # Conversation handles navigating the tree, until the option to end is # reached. def conversation() - tree = Gardner.grow(@file) + tree = Gardner.prune_trunk(@file) - 10.times { print "*" } - puts "\n[ Branch: 1 ]" if @debug - next_branch = talk(tree[1]) + display_trunk(tree[0]) + branches = Gardner.prune_branches(tree[1]) + + next_branch = 1 until next_branch == 0 do - puts "\n[ Branch: #{next_branch} ]" if @debug - next_branch = talk(tree[next_branch]) + next_branch = talk(branches[next_branch], next_branch) end - puts "\n#{tree[0]["desc"]}" + puts "\n#{branches[0]["desc"]}" exit end - # Talk displays a branch, the options, and prompts for a response + # Talk displays a branch, the options, and prompts for a response. # # @param branch [Hash] A branch data set + # @param branch_no [Integer] The branch number # @return [Integer] The number of the next branch - def talk(branch) - + def talk(branch, branch_no) # If there are no options on this branch, we assume it's a terminal # branch. Return 0, and end the program. if branch["options"].empty? @@ -47,13 +45,50 @@ module Dialogue return 0 end - valid_options = branch["options"].keys.join(", ") + display_branch(branch, branch_no) + response = get_response(branch) + + unless response == 0 + puts "\n" + 10.times { print "*" } + puts "\n(Your choice: #{branch["options"][response].keys[0]})" + response = branch["options"][response].values[0].to_i + end + + return response + end + + # Format and display the trunk + # + # @param trunk [Hash] The trunk hash + def display_trunk(trunk) + 40.times { print "-" } + puts "\n#{trunk["trunk"]}" + 40.times { print "-" } + puts "\n" + end + + # Format and display a branch + # + # @param branch [Hash] A branch data set + # @param branch_no [Integer] The branch number + def display_branch(branch, branch_no) + puts "\n[ Branch: #{branch_no} ]" if @debug puts "\n#{branch["desc"]}\n\n" + branch["options"].each_pair do |k,v| puts "\t#{k}: #{v.keys[0]}" puts "\t\t [ Goes to branch #{v.values[0]} ]" if @debug end + end + + # Get a response for the displayed branch + # + # @param branch [Hash] A branch data set + # @return [Integer] the next branch + def get_response(branch) + valid_options = branch["options"].keys.join(", ") print "\n[#{valid_options}]> " STDOUT.flush @@ -66,14 +101,7 @@ module Dialogue response = STDIN.gets.chomp.to_i end - - puts "\n" - 10.times { print "*" } - return 0 if response == 0 - puts "\n(Your choice: #{branch["options"][response].keys[0]})" - return branch["options"][response].values[0].to_i + return response end - end - end From a2dd7e3b1cd57623ae33fb341a30489d04c3dbdc Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 23:49:12 -0400 Subject: [PATCH 36/74] gardner.rb: Refactor - Remove functionality that doesn't belong in this module: - Move printing of trunk to the dialogue class - Remove tree generation entirely; let other modules generate trees as they need them - Style formatting --- lib/sapling/gardner.rb | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index 5437883..8ae7ccf 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -2,11 +2,10 @@ require 'yaml' # Gardner is the module for working with a dialogue tree file module Gardner - - # Parse the branch + # Parse the tree array into an array of numbered branches, and ordered leaves. # # @param tree [Array] The dialogue tree - # @return [Array] The array of options on the branch. + # @return [Array] An array of numbered branches, with numbered leaves def self.prune_branches(tree) branches = { 0 => { "desc" => "Thanks for using Sapling!" } } tree.each do |b| @@ -16,13 +15,12 @@ module Gardner end return branches - end - # Parse the options + # Parse the leaves of a branch into a numbered hash of options. # # @param leaves [Array] The option of leaf hashes - # @return [Hash] A has of options + # @return [Hash] A numbered hash of options def self.prune_leaves(leaves) x = 1 options = {} @@ -35,34 +33,15 @@ module Gardner end return options - end - # Parse the trunk - # The trunk is like the introduction to the tree. + # Parse the trunk of the tree. # # @param tree [Hash] The entire tree - # @return [Hash] The tree without the trunk + # @return [Array] The trunk, and the remainder of the tree def self.prune_trunk(tree) trunk = tree.shift - 40.times { print "-" } - puts "\n#{trunk["trunk"]}" - 40.times { print "-" } - puts "\n" - - return tree + return [trunk,tree] end - - # The main method for Sapling. From here, the tree is grown. - # - # @param tree [File] The dialogue tree file - # @return [Hash] The final, constructed data set - def self.grow(tree) - trunk = Gardner.prune_trunk(tree) - branches = Gardner.prune_branches(trunk) - - return branches - end - end From ccf8a3b5f68bc9f401f35834b18eefea6301ac03 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 7 May 2017 23:52:13 -0400 Subject: [PATCH 37/74] planter.rb: Style refactor updates --- lib/sapling/planter.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index 4c30739..ac1f82c 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -4,7 +4,7 @@ require_relative './utility' # Planter is the module for creating or editing a tree. module Planter - + # A data class class Plot # The tree, trunk, and branches attr_accessor :tree, :trunk, :branches @@ -13,7 +13,6 @@ module Planter # Utilities for editing specific parts of a tree. class Spade - # The file we parse into a tree attr_writer :file From 5f7da9d55a22865ba9e07c0050fee8f3e48aaf0c Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 14:59:16 -0400 Subject: [PATCH 38/74] dialogue.rb: Refactor display code - Dialogue should be responsible for the flow of a tree, not displaying parts of it. With the exception of the prompt, all display responsibilities fall to Gardner --- lib/sapling/dialogue.rb | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 35acec9..33060d8 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -20,7 +20,7 @@ module Dialogue def conversation() tree = Gardner.prune_trunk(@file) - display_trunk(tree[0]) + Gardner.display_trunk(tree[0]) branches = Gardner.prune_branches(tree[1]) next_branch = 1 @@ -45,7 +45,7 @@ module Dialogue return 0 end - display_branch(branch, branch_no) + Gardner.display_branch(branch, branch_no, @debug) response = get_response(branch) @@ -59,30 +59,6 @@ module Dialogue return response end - # Format and display the trunk - # - # @param trunk [Hash] The trunk hash - def display_trunk(trunk) - 40.times { print "-" } - puts "\n#{trunk["trunk"]}" - 40.times { print "-" } - puts "\n" - end - - # Format and display a branch - # - # @param branch [Hash] A branch data set - # @param branch_no [Integer] The branch number - def display_branch(branch, branch_no) - puts "\n[ Branch: #{branch_no} ]" if @debug - puts "\n#{branch["desc"]}\n\n" - - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - puts "\t\t [ Goes to branch #{v.values[0]} ]" if @debug - end - end - # Get a response for the displayed branch # # @param branch [Hash] A branch data set From 280d016d38ce6efff59726737147a3212ae660b1 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 15:00:36 -0400 Subject: [PATCH 39/74] gardner.rb: Move display code from dialogue --- lib/sapling/gardner.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index 8ae7ccf..c09a759 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -44,4 +44,29 @@ module Gardner return [trunk,tree] end + + # Format and display the trunk + # + # @param trunk [Hash] The trunk hash + def self.display_trunk(trunk) + 40.times { print "-" } + puts "\n#{trunk["trunk"]}" + 40.times { print "-" } + puts "\n" + end + + # Format and display a branch and the options + # + # @param branch [Hash] A branch data set + # @param branch_no [Integer] The branch number + # @param debug [Boolean] Status of showing debug information + def self.display_branch(branch, branch_no, debug) + puts "\n[ Branch: #{branch_no} ]" if debug + puts "\n#{branch["desc"]}\n\n" + + branch["options"].each_pair do |k,v| + puts "\t#{k}: #{v.keys[0]}" + puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug + end + end end From 802074a5130aa286c3dd6deac87b3626b0cf30ff Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 15:01:28 -0400 Subject: [PATCH 40/74] planter.rb: Utilize display code now in Gardner --- lib/sapling/planter.rb | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index ac1f82c..3c3138d 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -21,7 +21,7 @@ module Planter def plant @plot = Plot.new @plot.tree = @file - @plot.trunk = @file.shift.values[0] + @plot.trunk = @file.shift @plot.branches = Gardner.prune_branches(@file) dig(1) @@ -35,22 +35,9 @@ module Planter def dig(branch_no) branch = @plot.branches[branch_no] - # Print the trunk - 40.times { print "-" } - puts "\n[ Trunk ]\n#{@plot.trunk}" - 40.times { print "-" } - puts "\n" - 10.times { print "*" } + Gardner.display_trunk(@plot.trunk) + Gardner.display_branch(branch, branch_no, true) - # Print the branch and options - puts "\n[ Branch: #{branch_no} ]" - puts "\n#{branch["desc"]}\n\n" - unless branch["options"].empty? - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - puts "\t\t [ Goes to branch #{v.values[0]} ]" - end - end end # Edit the trunk of the tree From 2e2fea9e58a7736f23f6e90af9dfbb07141fe049 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 15:55:33 -0400 Subject: [PATCH 41/74] dialogue.rb: Update comment --- lib/sapling/dialogue.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 33060d8..6de064c 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -2,8 +2,7 @@ require_relative './gardner' # Dialogue is the module for traversing an existing tree. module Dialogue - # Speaker holds the functionality for viewing and going through a dialogue - # tree. + # Speaker holds the functionality for going through a dialogue tree. class Speaker # The file, which should be a dialogue tree YAML file. attr_accessor :file From 4c726b079d71db604775e3b70e70c423420503ff Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 19:42:42 -0400 Subject: [PATCH 42/74] sapling.rb: Modify start options - Reduce some LOC by moving some assignments into the initialize functions of both Dialogue and Planter --- lib/sapling.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index c80903f..254b35e 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -41,8 +41,7 @@ module Sapling end puts "Welcome to Sapling, a Dialogue Tree Utility.\n" - speaker = Dialogue::Speaker.new - speaker.file = YAML.load_file(ARGV[0]) + speaker = Dialogue::Speaker.new(YAML.load_file(ARGV[0]),false) speaker.conversation end @@ -62,8 +61,7 @@ module Sapling end puts "Welcome to Sapling, a Dialogue Tree Utility.\n" - gardner = Planter::Spade.new - gardner.file = tree + gardner = Planter::Spade.new(tree) gardner.plant end From 1c6206c3cd10703679466db3769904d1710ec8cf Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 19:43:48 -0400 Subject: [PATCH 43/74] dialogue.rb: Move assignments into initialize --- lib/sapling/dialogue.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 6de064c..641b4f1 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -9,9 +9,9 @@ module Dialogue # Status of verbose/debug mode. True = on; false = off. attr_accessor :debug - def initialize - @file = "" - @debug = false + def initialize(file="", debug=false) + @file = file + @debug = debug end # Conversation handles navigating the tree, until the option to end is From 4b33abcd757a2526390220b120a77fbaaadd39f9 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 13 May 2017 19:45:19 -0400 Subject: [PATCH 44/74] planter.rb: Implement editor logic - Added flow for working with editor: - Allow for changing branches - Recognize all options, with ease of implementing more - Allow for exiting the editor - Move assignment into initialize --- lib/sapling/planter.rb | 139 ++++++++++++++++++++++++++++++++--------- 1 file changed, 109 insertions(+), 30 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index 3c3138d..aa67dd6 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -4,11 +4,30 @@ require_relative './utility' # Planter is the module for creating or editing a tree. module Planter - # A data class + # In-memory tree class Plot # The tree, trunk, and branches attr_accessor :tree, :trunk, :branches + # Edit the trunk of the tree + def edit_trunk + puts "Edit trunk" + end + + # Edit a branch on the tree + # + # @param branch [Integer] The number of the branch to be edited. + def edit_branch(branch) + puts "Edit current branch" + end + + # Edit a leaf on a branch, grasshopper + # + # @param branch [Integer] The number of the branch to be edited. + # @param leaf [Hash] The leaf hash to be edited. + def edit_leaf(branch, leaf) + + end end # Utilities for editing specific parts of a tree. @@ -16,15 +35,25 @@ module Planter # The file we parse into a tree attr_writer :file - # Establish a new Plot, which is basically an object for storing information - # for us. From here, we start gardening. + def initialize(file) + @file=file + end + + # Establish and populate a new Plot (in-memory tree), then control the flow + # of editing the Plot def plant @plot = Plot.new @plot.tree = @file @plot.trunk = @file.shift @plot.branches = Gardner.prune_branches(@file) - dig(1) + next_branch = dig(1) + until next_branch == 0 do + next_branch = dig(next_branch) + end + + puts "\n#{@plot.branches[0]["desc"]}" + exit end # Function for displaying a single branch in debug mode. We also always @@ -38,28 +67,76 @@ module Planter Gardner.display_trunk(@plot.trunk) Gardner.display_branch(branch, branch_no, true) + response = get_response(branch) + to_branch = parse_response(response, branch_no) + + return to_branch end - # Edit the trunk of the tree - def edit_trunk - - end - - # Edit a branch on the tree + # Get a response for the displayed branch # - # @param branch [Integer] The number of the branch to be edited. - def edit_branch(branch) + # @param branch [Hash] A branch data set + # @return [Integer] the next branch + def get_response(branch) + total_branches = @plot.branches.count - 1 + valid_options = ["1-#{total_branches}","t","a","b","x","l","s","q"] + print_options = valid_options.join(",") + print "\n[#{print_options}]> " + STDOUT.flush + response = STDIN.gets.chomp.to_s.downcase + + until valid_options.include?(response) or response.to_i.between?(1,total_branches) + print "[## Invalid response. " + print "Valid options are #{print_options}" + print "\n[#{print_options}]> " + response = STDIN.gets.chomp.to_s.downcase + end + + return response end - # Edit a leaf on a branch, grasshopper + # Parse the response from get_response # - # @param branch [Integer] The number of the branch to be edited. - # @param leaf [Hash] The leaf hash to be edited. - def edit_leaf(branch, leaf) + # @param response [String] The option selected + # @param branch_no [Integer] The currently-displayed branch + # @return [Integer] the branch to display + def parse_response(response, branch_no) + return response.to_i if response.to_i >= 1 + case response.to_s.downcase + when "t" + @plot.edit_trunk + return branch_no + when "a" + puts "Add new branch" + return branch_no + when "b" + @plot.edit_branch(branch_no) + return branch_no + when "x" + puts "Delete current branch" + return branch_no + when "l" + puts "Edit leaves" + return branch_no + when "s" + puts "Save changes" + return branch_no + when "q" + print "Unsaved changes will be lost. Still quit? [y/n]> " + verify = STDIN.gets.chomp.to_s.downcase + + return 0 if verify == "y" + + return branch_no + else + puts "Something else!" + return branch_no + end end + end end @@ -80,24 +157,26 @@ Process: - At this point, editing is the same - Prompt provides options: - - B # - Go to Branch # - - T - Edit Trunk - - D - Edit Current Branch description - - X - Delete Current Branch - - L A - Add a new Leaf - - L # D - Edit Leaf # description - - L # B - Edit Leaf # branch destination - - L # X - Remove Leaf # - - S - Save Changes (write to the file) - - Q - Quit without saving + - #: Go to that branch number + - T: Modify the tree trunk + - A: Add a new branch (append to list of branches) + - B: Modify the current branch description + - X: Delete the current branch (does this renumber branches?) + - L: Modify the current leaves, respond with leaf prompt + - S: Save changes + - Q: Quit + +- Example prompt: + [ 0-5,T,A,B,X,L,S,Q ]> +- Leaf prompt: + [ Leaves: Details: - Regardless of the file existing, the user will be editing a Hash, not the actual YAML file - - Use Gardner to build the tree (either existing or skeleton) - - Use Dialog to interact with the tree - - Overwrite prompt with Planter prompt - - On changes, re-build the tree, and restart dialogue from most recent branch +- Use Gardner to build and interact with the tree +- Use Planter to modify the tree "in memory" (aka, the hash) +- Use Dialog to interact with the tree "in memory", to test-run it - After each edit option, display the current branch with the new changes. =end From 03d09105f3e5a09c05b54ae5f5d7bbc45cc18ddc Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 14 May 2017 14:12:32 -0400 Subject: [PATCH 45/74] gardner.rb: Add debug options and information --- lib/sapling/gardner.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index c09a759..3a75dbb 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -48,8 +48,10 @@ module Gardner # Format and display the trunk # # @param trunk [Hash] The trunk hash - def self.display_trunk(trunk) + # @param debug [Boolean] The status of showing debug information + def self.display_trunk(trunk, debug=false) 40.times { print "-" } + puts "\n[ Trunk ]\n" if debug puts "\n#{trunk["trunk"]}" 40.times { print "-" } puts "\n" @@ -60,7 +62,7 @@ module Gardner # @param branch [Hash] A branch data set # @param branch_no [Integer] The branch number # @param debug [Boolean] Status of showing debug information - def self.display_branch(branch, branch_no, debug) + def self.display_branch(branch, branch_no, debug=false) puts "\n[ Branch: #{branch_no} ]" if debug puts "\n#{branch["desc"]}\n\n" From 78f9837b5a92dea26f4b3c756106c3f5ae4f1d46 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 14 May 2017 14:13:20 -0400 Subject: [PATCH 46/74] dialogue.rb: Add debug value for Gardner --- lib/sapling/dialogue.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 641b4f1..0e6823c 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -19,7 +19,7 @@ module Dialogue def conversation() tree = Gardner.prune_trunk(@file) - Gardner.display_trunk(tree[0]) + Gardner.display_trunk(tree[0], false) branches = Gardner.prune_branches(tree[1]) next_branch = 1 From 1af5c9a53c1f987b3667c82c0f8ce1a9373540b5 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 14 May 2017 14:13:50 -0400 Subject: [PATCH 47/74] planter.rb: Improve editor and options - Editor: Enable trunk editing - General: Add value for Gardner debug mode - General: Improve visability of option chosen - General: Improve display --- lib/sapling/planter.rb | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index aa67dd6..e24f681 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -11,7 +11,17 @@ module Planter # Edit the trunk of the tree def edit_trunk - puts "Edit trunk" + puts "Current Trunk:\n" + Gardner.display_trunk(@trunk, true) + print "[ =EDITING= ](CTRL-C to abort)> " + STDOUT.flush + begin + new_trunk = STDIN.gets.to_s + rescue Interrupt + puts "\n**Aborting edit**\n\n" + new_trunk = @trunk["trunk"] + end + @trunk["trunk"] = new_trunk end # Edit a branch on the tree @@ -64,7 +74,7 @@ module Planter def dig(branch_no) branch = @plot.branches[branch_no] - Gardner.display_trunk(@plot.trunk) + Gardner.display_trunk(@plot.trunk, true) Gardner.display_branch(branch, branch_no, true) response = get_response(branch) @@ -102,28 +112,38 @@ module Planter # @param branch_no [Integer] The currently-displayed branch # @return [Integer] the branch to display def parse_response(response, branch_no) - return response.to_i if response.to_i >= 1 + 10.times { print "*" } + print "\n(Your choice: " + + if response.to_i >= 1 + print "Change to branch #{response.to_i})\n\n" + return response.to_i + + end case response.to_s.downcase when "t" + print "Edit the trunk.)\n\n" @plot.edit_trunk return branch_no when "a" - puts "Add new branch" + print "Add a new branch.)\n\n" return branch_no when "b" + print "Edit the current branch.)\n\n" @plot.edit_branch(branch_no) return branch_no when "x" - puts "Delete current branch" + print "Delete the current branch.)\n\n" return branch_no when "l" - puts "Edit leaves" + print "Edit leaves of current branch.)\n\n" return branch_no when "s" - puts "Save changes" + print "Save changes.)\n\n" return branch_no when "q" + print "Quit without saving.)\n\n" print "Unsaved changes will be lost. Still quit? [y/n]> " verify = STDIN.gets.chomp.to_s.downcase @@ -131,14 +151,11 @@ module Planter return branch_no else - puts "Something else!" + print "Unknown option. Returning to current branch.)\n\n" return branch_no end end - - end - end =begin @@ -169,7 +186,6 @@ Process: - Example prompt: [ 0-5,T,A,B,X,L,S,Q ]> - Leaf prompt: - [ Leaves: Details: From 7b1b0541c16aaa7bbfbd2f9107d8e1f253fc5488 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sun, 21 May 2017 15:56:12 -0400 Subject: [PATCH 48/74] planter.rb: Implement branch desc. editing --- lib/sapling/planter.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index e24f681..abaeb64 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -13,7 +13,7 @@ module Planter def edit_trunk puts "Current Trunk:\n" Gardner.display_trunk(@trunk, true) - print "[ =EDITING= ](CTRL-C to abort)> " + print "\n[ =EDITING= ](CTRL-C to abort)> " STDOUT.flush begin new_trunk = STDIN.gets.to_s @@ -27,8 +27,18 @@ module Planter # Edit a branch on the tree # # @param branch [Integer] The number of the branch to be edited. - def edit_branch(branch) - puts "Edit current branch" + def edit_branch(branch_no) + puts "Current Branch:\n" + Gardner.display_branch(@branches[branch_no], branch_no, true) + print "\n[ =EDITING= ](CTRL-C to abort)> " + STDOUT.flush + begin + new_branch = STDIN.gets.to_s + rescue Interrupt + puts "\n**Aborting edit**\n\n" + new_branch = @branches[branch_no]["desc"] + end + @branches[branch_no]["desc"] = new_branch end # Edit a leaf on a branch, grasshopper @@ -46,7 +56,7 @@ module Planter attr_writer :file def initialize(file) - @file=file + @file = file end # Establish and populate a new Plot (in-memory tree), then control the flow From d0ebc379238576a4c7247dd370cae13ffa5e4487 Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 14:38:19 -0400 Subject: [PATCH 49/74] Dialogue: Move display back in --- lib/sapling/dialogue.rb | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 0e6823c..5ccc010 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -2,6 +2,34 @@ require_relative './gardner' # Dialogue is the module for traversing an existing tree. module Dialogue + + # Format and display the trunk + # + # @param trunk [Hash] The trunk hash + # @param debug [Boolean] The status of showing debug information + def self.display_trunk(trunk, debug=false) + 40.times { print "-" } + puts "\n[ Trunk ]\n" if debug + puts "\n#{trunk["trunk"]}" + 40.times { print "-" } + puts "\n" + end + + # Format and display a branch and the options + # + # @param branch [Hash] A branch data set + # @param branch_no [Integer] The branch number + # @param debug [Boolean] Status of showing debug information + def self.display_branch(branch, branch_no, debug=false) + puts "\n[ Branch: #{branch_no} ]" if debug + puts "\n#{branch["desc"]}\n\n" + + branch["options"].each_pair do |k,v| + puts "\t#{k}: #{v.keys[0]}" + puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug + end + end + # Speaker holds the functionality for going through a dialogue tree. class Speaker # The file, which should be a dialogue tree YAML file. @@ -19,7 +47,7 @@ module Dialogue def conversation() tree = Gardner.prune_trunk(@file) - Gardner.display_trunk(tree[0], false) + Dialogue.display_trunk(tree[0], false) branches = Gardner.prune_branches(tree[1]) next_branch = 1 @@ -44,7 +72,7 @@ module Dialogue return 0 end - Gardner.display_branch(branch, branch_no, @debug) + Dialogue.display_branch(branch, branch_no, @debug) response = get_response(branch) From 783fb886fd16376b63a07e1fe4c0921443d4e854 Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 14:38:41 -0400 Subject: [PATCH 50/74] Gardner: Remove display functionality --- lib/sapling/gardner.rb | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index 3a75dbb..e6184bf 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -2,6 +2,7 @@ require 'yaml' # Gardner is the module for working with a dialogue tree file module Gardner + # Parse the tree array into an array of numbered branches, and ordered leaves. # # @param tree [Array] The dialogue tree @@ -44,31 +45,4 @@ module Gardner return [trunk,tree] end - - # Format and display the trunk - # - # @param trunk [Hash] The trunk hash - # @param debug [Boolean] The status of showing debug information - def self.display_trunk(trunk, debug=false) - 40.times { print "-" } - puts "\n[ Trunk ]\n" if debug - puts "\n#{trunk["trunk"]}" - 40.times { print "-" } - puts "\n" - end - - # Format and display a branch and the options - # - # @param branch [Hash] A branch data set - # @param branch_no [Integer] The branch number - # @param debug [Boolean] Status of showing debug information - def self.display_branch(branch, branch_no, debug=false) - puts "\n[ Branch: #{branch_no} ]" if debug - puts "\n#{branch["desc"]}\n\n" - - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug - end - end end From dfc41175272a8065d21658da2a52da37e20eb692 Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 14:39:11 -0400 Subject: [PATCH 51/74] Planter: Gardner to Dialogue --- lib/sapling/planter.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/sapling/planter.rb b/lib/sapling/planter.rb index abaeb64..8881117 100644 --- a/lib/sapling/planter.rb +++ b/lib/sapling/planter.rb @@ -4,15 +4,17 @@ require_relative './utility' # Planter is the module for creating or editing a tree. module Planter + # In-memory tree class Plot + # The tree, trunk, and branches attr_accessor :tree, :trunk, :branches # Edit the trunk of the tree def edit_trunk puts "Current Trunk:\n" - Gardner.display_trunk(@trunk, true) + Dialogue.display_trunk(@trunk, true) print "\n[ =EDITING= ](CTRL-C to abort)> " STDOUT.flush begin @@ -29,7 +31,7 @@ module Planter # @param branch [Integer] The number of the branch to be edited. def edit_branch(branch_no) puts "Current Branch:\n" - Gardner.display_branch(@branches[branch_no], branch_no, true) + Dialogue.display_branch(@branches[branch_no], branch_no, true) print "\n[ =EDITING= ](CTRL-C to abort)> " STDOUT.flush begin @@ -52,6 +54,7 @@ module Planter # Utilities for editing specific parts of a tree. class Spade + # The file we parse into a tree attr_writer :file @@ -84,8 +87,8 @@ module Planter def dig(branch_no) branch = @plot.branches[branch_no] - Gardner.display_trunk(@plot.trunk, true) - Gardner.display_branch(branch, branch_no, true) + Dialogue.display_trunk(@plot.trunk, true) + Dialogue.display_branch(branch, branch_no, true) response = get_response(branch) to_branch = parse_response(response, branch_no) @@ -157,9 +160,7 @@ module Planter print "Unsaved changes will be lost. Still quit? [y/n]> " verify = STDIN.gets.chomp.to_s.downcase - return 0 if verify == "y" - - return branch_no + return 0 if verify == "y" else branch_no else print "Unknown option. Returning to current branch.)\n\n" return branch_no From ca5ddf7bafe56c8a8c649e66e57c477f8dc0a9be Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 15:14:41 -0400 Subject: [PATCH 52/74] Re-organization --- lib/{sapling => }/dialogue.rb | 0 lib/{sapling => }/gardner.rb | 0 lib/{sapling => }/planter.rb | 0 lib/{sapling => }/utility.rb | 0 lib/sapling.rb => sapling.rb | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename lib/{sapling => }/dialogue.rb (100%) rename lib/{sapling => }/gardner.rb (100%) rename lib/{sapling => }/planter.rb (100%) rename lib/{sapling => }/utility.rb (100%) rename lib/sapling.rb => sapling.rb (100%) diff --git a/lib/sapling/dialogue.rb b/lib/dialogue.rb similarity index 100% rename from lib/sapling/dialogue.rb rename to lib/dialogue.rb diff --git a/lib/sapling/gardner.rb b/lib/gardner.rb similarity index 100% rename from lib/sapling/gardner.rb rename to lib/gardner.rb diff --git a/lib/sapling/planter.rb b/lib/planter.rb similarity index 100% rename from lib/sapling/planter.rb rename to lib/planter.rb diff --git a/lib/sapling/utility.rb b/lib/utility.rb similarity index 100% rename from lib/sapling/utility.rb rename to lib/utility.rb diff --git a/lib/sapling.rb b/sapling.rb similarity index 100% rename from lib/sapling.rb rename to sapling.rb From b7cea51f7aaa10be650bcc79d578126f94177997 Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 15:15:38 -0400 Subject: [PATCH 53/74] Planter: Modify conditional logic --- lib/planter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/planter.rb b/lib/planter.rb index 8881117..df38ee0 100644 --- a/lib/planter.rb +++ b/lib/planter.rb @@ -160,7 +160,8 @@ module Planter print "Unsaved changes will be lost. Still quit? [y/n]> " verify = STDIN.gets.chomp.to_s.downcase - return 0 if verify == "y" else branch_no + return 0 if verify == "y" + return branch_no else print "Unknown option. Returning to current branch.)\n\n" return branch_no From 4b930fb67b9e36f8aef987a9df363b0fe29af963 Mon Sep 17 00:00:00 2001 From: Bill Nibz Date: Sat, 14 Oct 2017 15:15:54 -0400 Subject: [PATCH 54/74] Sapling: Dynamic local requires --- sapling.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sapling.rb b/sapling.rb index 254b35e..5e3c9ae 100644 --- a/sapling.rb +++ b/sapling.rb @@ -3,10 +3,7 @@ require 'optparse' require 'yaml' -require_relative 'sapling/dialogue' -require_relative 'sapling/gardner' -require_relative 'sapling/planter' -require_relative 'sapling/utility' +Dir[File.join(__dir__, 'lib', '*.rb')].each { |file| require file } # Sapling is the main module for the program. From here, the rest of the world # starts building. From 9575160f29fd0b3497c3474bc7ca2972eee1d5cd Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 21:47:01 -0400 Subject: [PATCH 55/74] Implement Thor - Remove old sapling.rb file - Add new directory bin/ - Add new version of sapling.rb --- bin/sapling.rb | 45 ++++++++++++++++++++++++++++ sapling.rb | 79 -------------------------------------------------- 2 files changed, 45 insertions(+), 79 deletions(-) create mode 100644 bin/sapling.rb delete mode 100644 sapling.rb diff --git a/bin/sapling.rb b/bin/sapling.rb new file mode 100644 index 0000000..bcbc006 --- /dev/null +++ b/bin/sapling.rb @@ -0,0 +1,45 @@ +#!/usr/bin/env ruby + +require 'thor' +require 'yaml' + +Dir[File.join(__dir__, 'lib', '*.rb')].each { |file| require file } + +# The main Sapling interface. +class Sapling < Thor + desc 'read TREE', 'Load and traverse the TREE' + def read(tree) + exit if verify_tree(tree) + puts 'Welcome to Sapling, a Dialogue Tree Utility.' + speaker = Dialogue::Speaker.new(YAML.load_file(tree), false) + speaker.conversation + end + + desc 'edit TREE', 'Edit a new or existing TREE' + def edit(tree = '') + puts 'Welcome to Sapling, a Dialogue Tree Utility.' + if !tree.empty? + puts "Loading tree: #{tree}" + exit if verify_tree(tree) + gardner = Planter::Spade.new(YAML.load_file(tree, false)) + else + puts 'Creating a new tree!' + gardner = Planter::Spade.new(SKELETON_TREE) + end + gardner.plant + end + + desc 'serve TREE', 'Load TREE in a web-based interface' + def serve(tree) + exit if verify_tree(tree) + puts 'Sinatra will be cool.' + end + + desc 'export TREE', 'Save a portable HTML version of TREE' + def export(tree) + exit if verify_tree(tree) + puts 'Cool feature, bro!' + end +end + +Sapling.start(ARGV) diff --git a/sapling.rb b/sapling.rb deleted file mode 100644 index 5e3c9ae..0000000 --- a/sapling.rb +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env ruby - -require 'optparse' -require 'yaml' - -Dir[File.join(__dir__, 'lib', '*.rb')].each { |file| require file } - -# Sapling is the main module for the program. From here, the rest of the world -# starts building. -module Sapling - # CLI is the class for option parsing, and the gateway to the program, on the - # command line - class CLI - # Option parsing, and gateway to either reading and traversing a tree, or - # editing/creating a tree. - def talk(options) - opt_parser = OptionParser.new do |opt| - opt.banner = "Usage: sapling -t FILE\n" \ - "Usage: sapling -e [FILE]" - - opt.on_tail("-h", "--help", "Show this menu") do - puts opt - exit - end - - opt.on("-t", "--talk", - "Begin traversing the provided dialogue tree") do - - if ARGV.empty? - puts "No tree file provided. Please provide a tree file." - puts opt_parser - exit - end - - unless verify_tree(ARGV[0]) - puts "\n#{opt}\n" - exit - end - - puts "Welcome to Sapling, a Dialogue Tree Utility.\n" - speaker = Dialogue::Speaker.new(YAML.load_file(ARGV[0]),false) - speaker.conversation - end - - opt.on("-e", "--edit", - "Create or edit a dialogue tree") do - - if ARGV.empty? - puts "Creating a new tree." - tree = SKELETON_TREE - else - puts "Using tree at #{ARGV[0]}." - unless verify_tree(ARGV[0]) - puts "\n#{opt}\n" - exit - end - tree = YAML.load_file(ARGV[0]) - end - - puts "Welcome to Sapling, a Dialogue Tree Utility.\n" - gardner = Planter::Spade.new(tree) - gardner.plant - end - - end - - # Handle bad options gracefully - begin - opt_parser.parse!(options) - rescue OptionParser::InvalidOption - puts "Invalid option." - puts opt_parser - exit - end - end - end -end - -Sapling::CLI.new.talk(ARGV) From 4e2432ac662cdb1b893f277b04323702b4c1b821 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:33:21 -0400 Subject: [PATCH 56/74] Re-org...again... for gemspec --- {bin => lib}/sapling.rb | 8 ++++---- lib/{ => sapling}/dialogue.rb | 0 lib/{ => sapling}/gardner.rb | 0 lib/{ => sapling}/planter.rb | 0 lib/{ => sapling}/utility.rb | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename {bin => lib}/sapling.rb (84%) rename lib/{ => sapling}/dialogue.rb (100%) rename lib/{ => sapling}/gardner.rb (100%) rename lib/{ => sapling}/planter.rb (100%) rename lib/{ => sapling}/utility.rb (100%) diff --git a/bin/sapling.rb b/lib/sapling.rb similarity index 84% rename from bin/sapling.rb rename to lib/sapling.rb index bcbc006..31cbdb5 100644 --- a/bin/sapling.rb +++ b/lib/sapling.rb @@ -3,7 +3,7 @@ require 'thor' require 'yaml' -Dir[File.join(__dir__, 'lib', '*.rb')].each { |file| require file } +Dir[File.join(__dir__, '..', 'lib', '*.rb')].each { |file| require file } # The main Sapling interface. class Sapling < Thor @@ -20,7 +20,7 @@ class Sapling < Thor puts 'Welcome to Sapling, a Dialogue Tree Utility.' if !tree.empty? puts "Loading tree: #{tree}" - exit if verify_tree(tree) + exit unless verify_tree(tree) gardner = Planter::Spade.new(YAML.load_file(tree, false)) else puts 'Creating a new tree!' @@ -31,13 +31,13 @@ class Sapling < Thor desc 'serve TREE', 'Load TREE in a web-based interface' def serve(tree) - exit if verify_tree(tree) + exit unless verify_tree(tree) puts 'Sinatra will be cool.' end desc 'export TREE', 'Save a portable HTML version of TREE' def export(tree) - exit if verify_tree(tree) + exit unless verify_tree(tree) puts 'Cool feature, bro!' end end diff --git a/lib/dialogue.rb b/lib/sapling/dialogue.rb similarity index 100% rename from lib/dialogue.rb rename to lib/sapling/dialogue.rb diff --git a/lib/gardner.rb b/lib/sapling/gardner.rb similarity index 100% rename from lib/gardner.rb rename to lib/sapling/gardner.rb diff --git a/lib/planter.rb b/lib/sapling/planter.rb similarity index 100% rename from lib/planter.rb rename to lib/sapling/planter.rb diff --git a/lib/utility.rb b/lib/sapling/utility.rb similarity index 100% rename from lib/utility.rb rename to lib/sapling/utility.rb From a37b089074ac13b0f998900d32b47c2c5dd7bce4 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:33:46 -0400 Subject: [PATCH 57/74] Add gemspec --- sapling.gemspec | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 sapling.gemspec diff --git a/sapling.gemspec b/sapling.gemspec new file mode 100644 index 0000000..2cea9a9 --- /dev/null +++ b/sapling.gemspec @@ -0,0 +1,13 @@ +Gem::Specification.new do |s| + s.name = 'Sapling' + s.version = '0.1.0' + s.executables << 'sapling' + s.date = '2017-10-14' + s.summary = 'A Dialogue Tree Utility' + s.description = 'Create, edit, and traverse Dialogue trees' + s.authors = ['Bill Niblock'] + s.email = 'azulien@gmail.com' + s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] + s.homepage = 'http://www.theinternetvagabond.com/sapling/' + s.license = 'MIT' +end From 7a7f06485f904329495e11fb02a9c1b91ce6fbb1 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:34:21 -0400 Subject: [PATCH 58/74] sapling.rb: Update for gemspec - Modify required gems in accordance with re-org - Fix minor logic bug for 'read' command - Remove start command; placed into executable in bin/ --- lib/sapling.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 31cbdb5..2025207 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -3,13 +3,13 @@ require 'thor' require 'yaml' -Dir[File.join(__dir__, '..', 'lib', '*.rb')].each { |file| require file } +Dir[File.join(__dir__, 'sapling', '*.rb')].each { |file| require file } # The main Sapling interface. class Sapling < Thor desc 'read TREE', 'Load and traverse the TREE' def read(tree) - exit if verify_tree(tree) + exit unless verify_tree(tree) puts 'Welcome to Sapling, a Dialogue Tree Utility.' speaker = Dialogue::Speaker.new(YAML.load_file(tree), false) speaker.conversation @@ -41,5 +41,3 @@ class Sapling < Thor puts 'Cool feature, bro!' end end - -Sapling.start(ARGV) From ad3ccc267b84882617cb71e2cdcf46d825104e83 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:35:51 -0400 Subject: [PATCH 59/74] Add sapling executable --- bin/sapling | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 bin/sapling diff --git a/bin/sapling b/bin/sapling new file mode 100755 index 0000000..10d112d --- /dev/null +++ b/bin/sapling @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require 'sapling' + +Sapling.start(ARGV) From e3f400fd067fe1f56865c19213eeed166b6a78a0 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:36:43 -0400 Subject: [PATCH 60/74] Gemfile: Add thor dependency --- Gemfile | 1 + Gemfile.lock | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index fb9733d..f52d7ba 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ source "https://rubygems.org" # Documentation gem "rdoc" gem "redcarpet" +gem "thor" gem "yard" gem "yard-ghpages" diff --git a/Gemfile.lock b/Gemfile.lock index 8830853..bd564d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,6 +18,7 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.8.1) + thor (0.20.0) unicode-display_width (1.2.1) yard (0.9.9) yard-ghpages (0.0.2) @@ -32,8 +33,9 @@ DEPENDENCIES rdoc redcarpet rubocop + thor yard yard-ghpages BUNDLED WITH - 1.13.7 + 1.14.6 From 8683c02448305ca5da280dd3b08d1c51eb0c54ac Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 22:52:22 -0400 Subject: [PATCH 61/74] Update gem name --- sapling.gemspec => sapling-dialogue.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sapling.gemspec => sapling-dialogue.gemspec (92%) diff --git a/sapling.gemspec b/sapling-dialogue.gemspec similarity index 92% rename from sapling.gemspec rename to sapling-dialogue.gemspec index 2cea9a9..99c9d8d 100644 --- a/sapling.gemspec +++ b/sapling-dialogue.gemspec @@ -1,5 +1,5 @@ Gem::Specification.new do |s| - s.name = 'Sapling' + s.name = 'sapling-dialogue' s.version = '0.1.0' s.executables << 'sapling' s.date = '2017-10-14' From 69f189ce596a484487c9a14b103f0bc7c37deeed Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 23:06:29 -0400 Subject: [PATCH 62/74] README: Update with new and corrected information --- README.md | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e8f6073..26a8a4f 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ # Sapling: A Dialogue Tree CLI Utility +[![Gem +Version](https://badge.fury.io/rb/sapling-dialogue.svg)]( +https://badge.fury.io/rb/sapling-dialogue) + Sapling allows for easy creation and use of dialogue trees. A dialogue tree is a series of dialogues which follow sequentially, though with @@ -21,9 +25,9 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices. You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at [trees/example\_quest.yaml]( -var/trees/example_quest.yaml). To run it, just type `sapling -t -trees/example_quest.yaml`. +Tree!". You can find the tree itself at [var/trees/example\_quest.yaml]( +https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml). +To run it, just type `sapling read path/to/example_quest.yaml`. ## Building a New Tree @@ -31,30 +35,35 @@ To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. For more details on the configuration file itself, check out the [Configuration -File documentation](var/docs/config_file.md), or the self-documented -[configuration file example](var/docs/config_file_example.yaml). Alternatively, -you can checkout [Example Quest](var/trees/example_quest.yaml) for a complete -tree. +File documentation]( +http://www.theinternetvagabond.com/sapling/file.config_file.html), or the +self-documented [configuration file example]( +http://www.theinternetvagabond.com/sapling/file.config_file_example.html). +Alternatively, you can checkout [Example Quest]( +https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml) +for a complete tree. ### Manual Edit 1. Open your preferred text editor. -2. Refer to the [Configuration File documentation](var/docs/config_file.md) +2. Refer to the [Configuration File documentation]( +http://www.theinternetvagabond.com/sapling/file.config_file.html) 3. Make your changes. 4. Save your changes. ### Automatic Edit -- Coming Soon(tm)! -1. Run the configuration editor: `sapling --edit [--new][--file FILE]` -2. If you choose to create a new dialogue, `sapling` will generate a new file in - your current directory. +1. Run the configuration editor: `sapling edit [TREE]` +2. If you don't include a TREE, `sapling` will create a new tree in the current + directory. 3. If you choose to modify an existing file, `sapling` will open the tree at the trunk, and show you the first branch. 4. Make your changes. 5. Save your changes. More details on the editor can be found in the [Editor -documentation](var/docs/editor.md). +documentation]( +http://www.theinternetvagabond.com/sapling/file.editor.html). ## Contributing @@ -62,10 +71,12 @@ You can contribute to Sapling by following these instructions: 1. Fork this repository. 2. In your fork, make your changes. 3. Make sure your changes respect the [contribution - guidelines](CONTRIBUTING.md). + guidelines]( + http://www.theinternetvagabond.com/sapling/file.CONTRIBUTING.html). 4. Submit a pull request. ## License Sapling is licensed under the MIT license. The full text can be found in -[LICENSE](LICENSE). +[LICENSE]( +http://www.theinternetvagabond.com/sapling/file.LICENSE.html). From 58bef10e22182c3f32abaf9bcb818827ac473a44 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 23:22:22 -0400 Subject: [PATCH 63/74] README: Add Travis Badge --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 26a8a4f..25ceaf3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,10 @@ [![Gem Version](https://badge.fury.io/rb/sapling-dialogue.svg)]( -https://badge.fury.io/rb/sapling-dialogue) +https://badge.fury.io/rb/sapling-dialogue) [![Build +Status]( +https://travis-ci.org/VagabondAzulien/sapling.svg?branch=master)]( +https://travis-ci.org/VagabondAzulien/sapling) Sapling allows for easy creation and use of dialogue trees. From 321ce557d80f6605fd3d57e4bcb1f881296816da Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 23:40:38 -0400 Subject: [PATCH 64/74] Update YARD docs --- doc/Dialogue.html | 263 ++++++++++++++++- doc/Dialogue/Speaker.html | 316 +++++++++++++------- doc/Gardner.html | 175 ++---------- doc/Planter.html | 4 +- doc/Planter/Plot.html | 347 +++++++++++++++++++++- doc/Planter/Spade.html | 460 ++++++++++++++++++++---------- doc/Sapling.html | 285 +++++++++++++++++- doc/_index.html | 21 +- doc/class_list.html | 2 +- doc/file.CONTRIBUTING.html | 4 +- doc/file.LICENSE.html | 4 +- doc/file.README.html | 36 +-- doc/file.config_file.html | 4 +- doc/file.config_file_example.html | 4 +- doc/file.editor.html | 4 +- doc/index.html | 36 +-- doc/method_list.html | 94 +++++- doc/top-level-namespace.html | 12 +- 18 files changed, 1554 insertions(+), 517 deletions(-) diff --git a/doc/Dialogue.html b/doc/Dialogue.html index a236f14..bf6102a 100644 --- a/doc/Dialogue.html +++ b/doc/Dialogue.html @@ -111,14 +111,273 @@ + +

    + Class Method Summary + collapse +

    + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .display_branch(branch, branch_no, debug = false) ⇒ Object + + + + + +

    +
    + +

    Format and display a branch and the options

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The branch number

      +
      + +
    • + +
    • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
      +

      Status of showing debug information

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/sapling/dialogue.rb', line 23
    +
    +def self.display_branch(branch, branch_no, debug=false)
    +  puts "\n[ Branch: #{branch_no} ]" if debug
    +  puts "\n#{branch["desc"]}\n\n"
    +
    +  branch["options"].each_pair do |k,v|
    +    puts "\t#{k}: #{v.keys[0]}"
    +    puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug
    +  end
    +end
    +
    +
    + +
    +

    + + .display_trunk(trunk, debug = false) ⇒ Object + + + + + +

    +
    + +

    Format and display the trunk

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + trunk + + + (Hash) + + + + — +
      +

      The trunk hash

      +
      + +
    • + +
    • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
      +

      The status of showing debug information

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +
    +
    # File 'lib/sapling/dialogue.rb', line 10
    +
    +def self.display_trunk(trunk, debug=false)
    +  40.times { print "-" }
    +  puts "\n[ Trunk ]\n" if debug
    +  puts "\n#{trunk["trunk"]}"
    +  40.times { print "-" }
    +  puts "\n"
    +end
    +
    +
    + +
    diff --git a/doc/Dialogue/Speaker.html b/doc/Dialogue/Speaker.html index 3bd027f..3e9ed52 100644 --- a/doc/Dialogue/Speaker.html +++ b/doc/Dialogue/Speaker.html @@ -102,8 +102,7 @@

    Overview

    -

    Spealer holds the functionality for viewing and going through a dialogue -tree.

    +

    Speaker holds the functionality for going through a dialogue tree.

    @@ -213,7 +212,31 @@ reached.

  • - #initialize ⇒ Speaker + #get_response(branch) ⇒ Integer + + + + + + + + + + + + + +
    +

    Get a response for the displayed branch.

    +
    + +
  • + + +
  • + + + #initialize(file = "", debug = false) ⇒ Speaker @@ -239,7 +262,7 @@ reached.

  • - #talk(branch) ⇒ Integer + #talk(branch, branch_no) ⇒ Integer @@ -269,7 +292,7 @@ reached.

    - #initializeSpeaker + #initialize(file = "", debug = false) ⇒ Speaker @@ -292,17 +315,17 @@ reached.

     
     
    -15
    -16
    -17
    -18
    +40 +41 +42 +43 -
    # File 'lib/sapling/dialogue.rb', line 15
    +      
    # File 'lib/sapling/dialogue.rb', line 40
     
    -def initialize
    -  @file = ""
    -  @debug = false
    +def initialize(file="", debug=false)
    +  @file = file
    +  @debug = debug
     end
    @@ -342,12 +365,12 @@ reached.

     
     
    -13
    -14
    -15
    +38 +39 +40
    -
    # File 'lib/sapling/dialogue.rb', line 13
    +      
    # File 'lib/sapling/dialogue.rb', line 38
     
     def debug
       @debug
    @@ -385,12 +408,12 @@ reached.

     
     
    -10
    -11
    -12
    +36 +37 +38
    -
    # File 'lib/sapling/dialogue.rb', line 10
    +      
    # File 'lib/sapling/dialogue.rb', line 36
     
     def file
       @file
    @@ -434,36 +457,36 @@ reached.

     
     
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    -30
    -31
    -32
    -33
    -34
    -35
    +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60
    -
    # File 'lib/sapling/dialogue.rb', line 22
    +      
    # File 'lib/sapling/dialogue.rb', line 47
     
     def conversation()
    -  tree = Gardner.grow(@file)
    +  tree = Gardner.prune_trunk(@file)
     
    -  10.times { print "*" }
    -  puts "\n[ Branch: 1 ]" if @debug
    -  next_branch = talk(tree[1])
    +  Dialogue.display_trunk(tree[0], false)
    +  branches = Gardner.prune_branches(tree[1])
    +
    +  next_branch = 1
       until next_branch == 0 do
    -    puts "\n[ Branch: #{next_branch} ]" if @debug
    -    next_branch = talk(tree[next_branch])
    +    next_branch = talk(branches[next_branch], next_branch)
       end
     
    -  puts "\n#{tree[0]["desc"]}"
    +  puts "\n#{branches[0]["desc"]}"
       exit
     end
    @@ -472,9 +495,9 @@ reached.

    -

    +

    - #talk(branch) ⇒ Integer + #get_response(branch) ⇒ Integer @@ -483,7 +506,7 @@ reached.

    -

    Talk displays a branch, the options, and prompts for a response

    +

    Get a response for the displayed branch

    @@ -520,6 +543,127 @@ reached.

    + — +
    +

    the next branch

    +
    + +
  • + + + +
    + + + + +
    +
    +
    +
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +
    +
    # File 'lib/sapling/dialogue.rb', line 93
    +
    +def get_response(branch)
    +  valid_options = branch["options"].keys.join(", ")
    +
    +  print "\n[#{valid_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_i
    +
    +  until branch["options"].keys.include?(response) or response == 0
    +    print "[## Invalid options. "
    +    print "Valid options are #{valid_options}, or 0 to exit."
    +    print "\n[#{valid_options}]> "
    +    response = STDIN.gets.chomp.to_i
    +  end
    +
    +  return response
    +end
    +
    + + +
    +

    + + #talk(branch, branch_no) ⇒ Integer + + + + + +

    +
    + +

    Talk displays a branch, the options, and prompts for a response.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The branch number

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + —

      The number of the next branch

      @@ -535,32 +679,6 @@ reached.

       
       
      -41
      -42
      -43
      -44
      -45
      -46
      -47
      -48
      -49
      -50
      -51
      -52
      -53
      -54
      -55
      -56
      -57
      -58
      -59
      -60
      -61
      -62
      -63
      -64
      -65
      -66
       67
       68
       69
      @@ -569,13 +687,24 @@ reached.

      72 73 74 -75
      +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 -
      # File 'lib/sapling/dialogue.rb', line 41
      -
      -def talk(branch)
      +      
      # File 'lib/sapling/dialogue.rb', line 67
       
      +def talk(branch, branch_no)
         # If there are no options on this branch, we assume it's a terminal
         # branch. Return 0, and end the program.
         if branch["options"].empty?
      @@ -583,31 +712,18 @@ reached.

      return 0 end - valid_options = branch["options"].keys.join(", ") + Dialogue.display_branch(branch, branch_no, @debug) - puts "\n#{branch["desc"]}\n\n" - branch["options"].each_pair do |k,v| - puts "\t#{k}: #{v.keys[0]}" - puts "\t\t [ Goes to branch #{v.values[0]} ]" if @debug + response = get_response(branch) + + unless response == 0 + puts "\n" + 10.times { print "*" } + puts "\n(Your choice: #{branch["options"][response].keys[0]})" + response = branch["options"][response].values[0].to_i end - print "\n[#{valid_options}]> " - STDOUT.flush - response = STDIN.gets.chomp.to_i - - until branch["options"].keys.include?(response) or response == 0 - print "[## Invalid options. " - print "Valid options are #{valid_options}, or 0 to exit." - print "\n[#{valid_options}]> " - response = STDIN.gets.chomp.to_i - end - - - puts "\n" - 10.times { print "*" } - return 0 if response == 0 - puts "\n(Your choice: #{branch["options"][response].keys[0]})" - return branch["options"][response].values[0].to_i + return response end
      @@ -619,9 +735,9 @@ reached.

    diff --git a/doc/Gardner.html b/doc/Gardner.html index 8934804..7e953a8 100644 --- a/doc/Gardner.html +++ b/doc/Gardner.html @@ -112,30 +112,6 @@
  • - .grow(tree) ⇒ Hash - - - - - - - - - - - - - -
    -

    The main method for Sapling.

    -
    - -
  • - - -
  • - - .prune_branches(tree) ⇒ Array @@ -151,7 +127,8 @@
    -

    Parse the branch.

    +

    Parse the tree array into an array of numbered branches, and ordered +leaves.

  • @@ -175,7 +152,7 @@
    -

    Parse the options.

    +

    Parse the leaves of a branch into a numbered hash of options.

    @@ -184,7 +161,7 @@
  • - .prune_trunk(tree) ⇒ Hash + .prune_trunk(tree) ⇒ Array @@ -199,7 +176,7 @@
    -

    Parse the trunk The trunk is like the introduction to the tree.

    +

    Parse the trunk of the tree.

  • @@ -215,92 +192,7 @@
    -

    - - .grow(tree) ⇒ Hash - - - - - -

    -
    - -

    The main method for Sapling. From here, the tree is grown.

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - tree - - - (File) - - - - — -
      -

      The dialogue tree file

      -
      - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Hash) - - - - — -
      -

      The final, constructed data set

      -
      - -
    • - -
    - -
    - - - - -
    -
    -
    -
    -61
    -62
    -63
    -64
    -65
    -66
    -
    -
    # File 'lib/sapling/gardner.rb', line 61
    -
    -def self.grow(tree)
    -    trunk = Gardner.prune_trunk(tree)
    -    branches = Gardner.prune_branches(trunk)
    -
    -    return branches
    -end
    -
    -
    - -
    -

    +

    .prune_branches(tree) ⇒ Array @@ -311,7 +203,8 @@

    -

    Parse the branch

    +

    Parse the tree array into an array of numbered branches, and ordered +leaves.

    @@ -350,7 +243,7 @@ —
    -

    The array of options on the branch.

    +

    An array of numbered branches, with numbered leaves

    @@ -372,8 +265,7 @@ 16 17 18 -19 -20 +19
    # File 'lib/sapling/gardner.rb', line 10
    @@ -387,7 +279,6 @@
       end
     
       return branches
    -
     end
    @@ -406,7 +297,7 @@
    -

    Parse the options

    +

    Parse the leaves of a branch into a numbered hash of options.

    @@ -445,7 +336,7 @@ —
    -

    A has of options

    +

    A numbered hash of options

    @@ -458,6 +349,7 @@
     
     
    +25
     26
     27
     28
    @@ -469,12 +361,10 @@
     34
     35
     36
    -37
    -38
    -39
    +37 -
    # File 'lib/sapling/gardner.rb', line 26
    +      
    # File 'lib/sapling/gardner.rb', line 25
     
     def self.prune_leaves(leaves)
       x = 1
    @@ -488,7 +378,6 @@
       end
     
       return options
    -
     end
    @@ -498,7 +387,7 @@

    - .prune_trunk(tree) ⇒ Hash + .prune_trunk(tree) ⇒ Array @@ -507,7 +396,7 @@

    -

    Parse the trunk The trunk is like the introduction to the tree.

    +

    Parse the trunk of the tree.

    @@ -540,13 +429,13 @@
  • - (Hash) + (Array)
    -

    The tree without the trunk

    +

    The trunk, and the remainder of the tree

  • @@ -559,29 +448,19 @@
     
     
    +43
    +44
    +45
     46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    +47
    -
    # File 'lib/sapling/gardner.rb', line 46
    +      
    # File 'lib/sapling/gardner.rb', line 43
     
     def self.prune_trunk(tree)
       trunk = tree.shift
    -  40.times { print "-" }
    -  puts "\n#{trunk["trunk"]}"
    -  40.times { print "-" }
    -  puts "\n"
    -
    -  return tree
     
    +  return [trunk,tree]
     end
    @@ -593,9 +472,9 @@
    diff --git a/doc/Planter.html b/doc/Planter.html index ae43cdd..9751f5c 100644 --- a/doc/Planter.html +++ b/doc/Planter.html @@ -116,9 +116,9 @@
    diff --git a/doc/Planter/Plot.html b/doc/Planter/Plot.html index d13ec89..9f5851a 100644 --- a/doc/Planter/Plot.html +++ b/doc/Planter/Plot.html @@ -99,8 +99,19 @@ +

    Overview

    +
    + +

    In-memory tree

    +
    +
    +
    + + +
    +

    Instance Attribute Summary collapse

    @@ -192,6 +203,89 @@ + +

    + Instance Method Summary + collapse +

    + + + +

    Instance Attribute Details

    @@ -224,12 +318,12 @@
     
     
    -10
    -11
    -12
    +12 +13 +14 -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def branches
       @branches
    @@ -267,12 +361,12 @@
           
     
     
    -10
    -11
    -12
    +12 +13 +14
    -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def tree
       @tree
    @@ -310,12 +404,12 @@
           
     
     
    -10
    -11
    -12
    +12 +13 +14
    -
    # File 'lib/sapling/planter.rb', line 10
    +      
    # File 'lib/sapling/planter.rb', line 12
     
     def trunk
       @trunk
    @@ -328,12 +422,237 @@
       
    +
    +

    Instance Method Details

    + + +
    +

    + + #edit_branch(branch_no) ⇒ Object + + + + + +

    +
    + +

    Edit a branch on the tree

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/sapling/planter.rb', line 32
    +
    +def edit_branch(branch_no)
    +  puts "Current Branch:\n"
    +  Dialogue.display_branch(@branches[branch_no], branch_no, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_branch = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_branch = @branches[branch_no]["desc"]
    +  end
    +  @branches[branch_no]["desc"] = new_branch
    +end
    +
    +
    + +
    +

    + + #edit_leaf(branch, leaf) ⇒ Object + + + + + +

    +
    + +

    Edit a leaf on a branch, grasshopper

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    • + + leaf + + + (Hash) + + + + — +
      +

      The leaf hash to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +50
    +51
    +52
    +
    +
    # File 'lib/sapling/planter.rb', line 50
    +
    +def edit_leaf(branch, leaf)
    +
    +end
    +
    +
    + +
    +

    + + #edit_trunkObject + + + + + +

    +
    + +

    Edit the trunk of the tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +
    +
    # File 'lib/sapling/planter.rb', line 15
    +
    +def edit_trunk
    +  puts "Current Trunk:\n"
    +  Dialogue.display_trunk(@trunk, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_trunk = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_trunk = @trunk["trunk"]
    +  end
    +  @trunk["trunk"] = new_trunk
    +end
    +
    +
    + +
    + diff --git a/doc/Planter/Spade.html b/doc/Planter/Spade.html index 39dce54..f89eacd 100644 --- a/doc/Planter/Spade.html +++ b/doc/Planter/Spade.html @@ -186,7 +186,7 @@
  • - #edit_branch(branch) ⇒ Object + #get_response(branch) ⇒ Integer @@ -201,7 +201,7 @@
    -

    Edit a branch on the tree.

    +

    Get a response for the displayed branch.

  • @@ -210,13 +210,15 @@
  • - #edit_leaf(branch, leaf) ⇒ Object + #initialize(file) ⇒ Spade + constructor + @@ -225,7 +227,7 @@
    -

    Edit a leaf on a branch, grasshopper.

    +

    A new instance of Spade.

  • @@ -234,7 +236,7 @@
  • - #edit_trunk ⇒ Object + #parse_response(response, branch_no) ⇒ Integer @@ -249,7 +251,7 @@
    -

    Edit the trunk of the tree.

    +

    Parse the response from get_response.

  • @@ -273,8 +275,8 @@
    -

    Establish a new Plot, which is basically an object for storing information -for us.

    +

    Establish and populate a new Plot (in-memory tree), then control the flow +of editing the Plot.

    @@ -283,6 +285,51 @@ for us.

    +
    +

    Constructor Details

    + +
    +

    + + #initialize(file) ⇒ Spade + + + + + +

    +
    + +

    Returns a new instance of Spade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +61
    +62
    +63
    +
    +
    # File 'lib/sapling/planter.rb', line 61
    +
    +def initialize(file)
    +  @file = file
    +end
    +
    +
    + +

    Instance Attribute Details

    @@ -315,12 +362,12 @@ for us.

     
     
    -18
    -19
    -20
    +59 +60 +61 -
    # File 'lib/sapling/planter.rb', line 18
    +      
    # File 'lib/sapling/planter.rb', line 59
     
     def file=(value)
       @file = value
    @@ -385,49 +432,31 @@ gone forever (until next time).

     
     
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97
    -
    # File 'lib/sapling/planter.rb', line 36
    +      
    # File 'lib/sapling/planter.rb', line 87
     
     def dig(branch_no)
       branch = @plot.branches[branch_no]
     
    -  # Print the trunk
    -  40.times { print "-" }
    -  puts "\n[ Trunk ]\n#{@plot.trunk}"
    -  40.times { print "-" }
    -  puts "\n"
    -  10.times { print "*" }
    +  Dialogue.display_trunk(@plot.trunk, true)
    +  Dialogue.display_branch(branch, branch_no, true)
     
    -  # Print the branch and options
    -  puts "\n[ Branch: #{branch_no} ]"
    -  puts "\n#{branch["desc"]}\n\n"
    -  unless branch["options"].empty?
    -    branch["options"].each_pair do |k,v|
    -      puts "\t#{k}: #{v.keys[0]}"
    -      puts "\t\t [ Goes to branch #{v.values[0]} ]"
    -    end
    -  end
    +  response = get_response(branch)
    +  to_branch = parse_response(response, branch_no)
    +
    +  return to_branch
     end
    @@ -435,9 +464,9 @@ gone forever (until next time).

    -

    +

    - #edit_branch(branch) ⇒ Object + #get_response(branch) ⇒ Integer @@ -446,7 +475,7 @@ gone forever (until next time).

    -

    Edit a branch on the tree

    +

    Get a response for the displayed branch

    @@ -460,96 +489,37 @@ gone forever (until next time).

    branch - (Integer) - - - - — -
    -

    The number of the branch to be edited.

    -
    - - - - - - -
    - - - - -
    -
    -
    -
    -65
    -66
    -67
    -
    -
    # File 'lib/sapling/planter.rb', line 65
    -
    -def edit_branch(branch)
    -
    -end
    -
    -
    - -
    -

    - - #edit_leaf(branch, leaf) ⇒ Object - - - - - -

    -
    - -

    Edit a leaf on a branch, grasshopper

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - branch - - - (Integer) - - - - — -
      -

      The number of the branch to be edited.

      -
      - -
    • - -
    • - - leaf - - (Hash)
      -

      The leaf hash to be edited.

      +

      A branch data set

    +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the next branch

      +
      + +
    • + +
    @@ -557,15 +527,45 @@ gone forever (until next time).

     
     
    -73
    -74
    -75
    +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 @@ -573,9 +573,9 @@ gone forever (until next time).

    -

    +

    - #edit_trunkObject + #parse_response(response, branch_no) ⇒ Integer @@ -584,13 +584,67 @@ gone forever (until next time).

    -

    Edit the trunk of the tree

    +

    Parse the response from get_response

    +

    Parameters:

    +
      +
    • + + response + + + (String) + + + + — +
      +

      The option selected

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The currently-displayed branch

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the branch to display

      +
      + +
    • + +
    -
    # File 'lib/sapling/planter.rb', line 73
    +      
    # File 'lib/sapling/planter.rb', line 103
     
    -def edit_leaf(branch, leaf)
    +def get_response(branch)
    +  total_branches = @plot.branches.count - 1
    +  valid_options = ["1-#{total_branches}","t","a","b","x","l","s","q"]
    +  print_options = valid_options.join(",")
     
    +  print "\n[#{print_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_s.downcase
    +
    +  until valid_options.include?(response) or response.to_i.between?(1,total_branches)
    +    print "[## Invalid response. "
    +    print "Valid options are #{print_options}"
    +    print "\n[#{print_options}]> "
    +    response = STDIN.gets.chomp.to_s.downcase
    +  end
    +
    +  return response
     end
    @@ -598,15 +652,95 @@ gone forever (until next time).

     
     
    -58
    -59
    -60
    +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 @@ -625,8 +759,8 @@ gone forever (until next time).

    -

    Establish a new Plot, which is basically an object for storing information -for us. From here, we start gardening.

    +

    Establish and populate a new Plot (in-memory tree), then control the flow +of editing the Plot

    @@ -640,25 +774,37 @@ for us. From here, we start gardening.

     
     
    -22
    -23
    -24
    -25
    -26
    -27
    -28
    -29
    +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80
    @@ -670,9 +816,9 @@ for us. From here, we start gardening.

    diff --git a/doc/Sapling.html b/doc/Sapling.html index 70266ba..ed2ef29 100644 --- a/doc/Sapling.html +++ b/doc/Sapling.html @@ -4,7 +4,7 @@ - Module: Sapling + Class: Sapling — Sapling Documentation @@ -59,13 +59,31 @@ <div class="clear"></div> </div> - <div id="content"><h1>Module: Sapling + <div id="content"><h1>Class: Sapling </h1> <div class="box_info"> + <dl> + <dt>Inherits:</dt> + <dd> + <span class="inheritName">Thor</span> + + <ul class="fullTree"> + <li>Object</li> + + <li class="next">Thor</li> + + <li class="next">Sapling</li> + + </ul> + <a href="#" class="inheritanceTree">show all</a> + + </dd> + </dl> + @@ -86,8 +104,7 @@ <h2>Overview</h2><div class="docstring"> <div class="discussion"> -<p>Sapling is the main module for the program. From here, the rest of the -world starts building.</p> +<p>The main Sapling interface.</p> </div> @@ -95,31 +112,275 @@ world starts building.</p> <div class="tags"> -</div><h2>Defined Under Namespace</h2> -<p class="children"> +</div> + + + + + + + <h2> + Instance Method Summary + <small><a href="#" class="summary_toggle">collapse</a></small> + </h2> + + <ul class="summary"> + + <li class="public "> + <span class="summary_signature"> + <a href="#edit-instance_method" title="#edit (instance method)">#<strong>edit</strong>(tree = '') ⇒ Object </a> + + + + </span> - - <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> - -</p> + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#export-instance_method" title="#export (instance method)">#<strong>export</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#read-instance_method" title="#read (instance method)">#<strong>read</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + + <a href="#serve-instance_method" title="#serve (instance method)">#<strong>serve</strong>(tree) ⇒ Object </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'></div></span> + +</li> + + + </ul> + + + + <div id="instance_method_details" class="method_details_list"> + <h2>Instance Method Details</h2> + + + <div class="method_details first"> + <h3 class="signature first" id="edit-instance_method"> + + #<strong>edit</strong>(tree = '') ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 19</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_edit'>edit</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Welcome to Sapling, a Dialogue Tree Utility.</span><span class='tstring_end'>'</span></span> + <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_tree'>tree</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Loading tree: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tree'>tree</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_gardner'>gardner</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span><span class='rparen'>)</span> + <span class='kw'>else</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Creating a new tree!</span><span class='tstring_end'>'</span></span> + <span class='id identifier rubyid_gardner'>gardner</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#SKELETON_TREE-constant" title="SKELETON_TREE (constant)">SKELETON_TREE</a></span></span><span class='rparen'>)</span> + <span class='kw'>end</span> + <span class='id identifier rubyid_gardner'>gardner</span><span class='period'>.</span><span class='id identifier rubyid_plant'>plant</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="export-instance_method"> + + #<strong>export</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +39 +40 +41 +42</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 39</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_export'>export</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cool feature, bro!</span><span class='tstring_end'>'</span></span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="read-instance_method"> + + #<strong>read</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> +11 +12 +13 +14 +15 +16</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 11</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Welcome to Sapling, a Dialogue Tree Utility.</span><span class='tstring_end'>'</span></span> + <span class='id identifier rubyid_speaker'>speaker</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Dialogue/Speaker.html#initialize-instance_method" title="Dialogue::Speaker#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> + <span class='id identifier rubyid_speaker'>speaker</span><span class='period'>.</span><span class='id identifier rubyid_conversation'>conversation</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> + <h3 class="signature " id="serve-instance_method"> + + #<strong>serve</strong>(tree) ⇒ <tt>Object</tt> + + + + + +</h3><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +33 +34 +35 +36</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/sapling.rb', line 33</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_serve'>serve</span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_exit'>exit</span> <span class='kw'>unless</span> <span class='id identifier rubyid_verify_tree'><span class='object_link'><a href="top-level-namespace.html#verify_tree-instance_method" title="#verify_tree (method)">verify_tree</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_tree'>tree</span><span class='rparen'>)</span> + <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Sinatra will be cool.</span><span class='tstring_end'>'</span></span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + </div> </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/_index.html b/doc/_index.html index 86da46c..ae95d40 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -93,21 +93,6 @@ <td valign='top' width="33%"> - <ul id="alpha_C" class="alpha"> - <li class="letter">C</li> - <ul> - - <li> - <span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> - - <small>(Sapling)</small> - - </li> - - </ul> - </ul> - - <ul id="alpha_D" class="alpha"> <li class="letter">D</li> <ul> @@ -159,7 +144,7 @@ <ul> <li> - <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span> + <span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> </li> @@ -189,9 +174,9 @@ </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/class_list.html b/doc/class_list.html index 4edf910..728036b 100644 --- a/doc/class_list.html +++ b/doc/class_list.html @@ -43,7 +43,7 @@ <ul id="full_list" class="class"> <li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li> -<li id='object_Dialogue' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Dialogue::Speaker' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span> < Object<small class='search_info'>Dialogue</small></div></li></ul></li><li id='object_Gardner' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span><small class='search_info'>Top Level Namespace</small></div></li><li id='object_Planter' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Planter::Plot' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Plot.html" title="Planter::Plot (class)">Plot</a></span> < Object<small class='search_info'>Planter</small></div></li><li id='object_Planter::Spade' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span> < Object<small class='search_info'>Planter</small></div></li></ul></li><li id='object_Sapling' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Sapling::CLI' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Sapling/CLI.html" title="Sapling::CLI (class)">CLI</a></span> < Object<small class='search_info'>Sapling</small></div></li></ul></li> +<li id='object_Dialogue' class='even'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Dialogue::Speaker' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Dialogue/Speaker.html" title="Dialogue::Speaker (class)">Speaker</a></span> < Object<small class='search_info'>Dialogue</small></div></li></ul></li><li id='object_Gardner' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span><small class='search_info'>Top Level Namespace</small></div></li><li id='object_Planter' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Planter::Plot' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Plot.html" title="Planter::Plot (class)">Plot</a></span> < Object<small class='search_info'>Planter</small></div></li><li id='object_Planter::Spade' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Planter/Spade.html" title="Planter::Spade (class)">Spade</a></span> < Object<small class='search_info'>Planter</small></div></li></ul></li><li id='object_Sapling' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> < Thor<small class='search_info'>Top Level Namespace</small></div></li> </ul> </div> diff --git a/doc/file.CONTRIBUTING.html b/doc/file.CONTRIBUTING.html index 9b7f6a2..0a3c9da 100644 --- a/doc/file.CONTRIBUTING.html +++ b/doc/file.CONTRIBUTING.html @@ -74,9 +74,9 @@ feel free to submit an issue or reach out to me directly.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.LICENSE.html b/doc/file.LICENSE.html index 70625c3..0349eb2 100644 --- a/doc/file.LICENSE.html +++ b/doc/file.LICENSE.html @@ -82,9 +82,9 @@ DEALINGS IN THE SOFTWARE.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.README.html b/doc/file.README.html index 1ab7dc9..253301c 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -59,6 +59,10 @@ <div id="content"><div id='filecontents'><h1>Sapling: A Dialogue Tree CLI Utility</h1> +<p><a href="https://badge.fury.io/rb/sapling-dialogue"><img src="https://badge.fury.io/rb/sapling-dialogue.svg" alt="Gem +Version"></a> <a href="https://travis-ci.org/VagabondAzulien/sapling"><img src="https://travis-ci.org/VagabondAzulien/sapling.svg?branch=master" alt="Build +Status"></a></p> + <p>Sapling allows for easy creation and use of dialogue trees.</p> <p>A dialogue tree is a series of dialogues which follow sequentially, though with @@ -75,25 +79,25 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.</p> <p>You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at <a href="var/trees/example_quest.yaml">trees/example_quest.yaml</a>. To run it, just type <code>sapling -t -trees/example_quest.yaml</code>.</p> +Tree!". You can find the tree itself at <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">var/trees/example_quest.yaml</a>. +To run it, just type <code>sapling read path/to/example_quest.yaml</code>.</p> <h2>Building a New Tree</h2> <p>To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the <a href="var/docs/config_file.md">Configuration -File documentation</a>, or the self-documented -<a href="var/docs/config_file_example.yaml">configuration file example</a>. Alternatively, -you can checkout <a href="var/trees/example_quest.yaml">Example Quest</a> for a complete -tree.</p> +For more details on the configuration file itself, check out the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration +File documentation</a>, or the +self-documented <a href="http://www.theinternetvagabond.com/sapling/file.config_file_example.html">configuration file example</a>. +Alternatively, you can checkout <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">Example Quest</a> +for a complete tree.</p> <h3>Manual Edit</h3> <ol> <li>Open your preferred text editor.</li> -<li>Refer to the <a href="var/docs/config_file.md">Configuration File documentation</a></li> +<li>Refer to the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration File documentation</a></li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> @@ -101,16 +105,16 @@ tree.</p> <h3>Automatic Edit -- Coming Soon(tm)!</h3> <ol> -<li>Run the configuration editor: <code>sapling --edit [--new][--file FILE]</code></li> -<li>If you choose to create a new dialogue, <code>sapling</code> will generate a new file in -your current directory.</li> +<li>Run the configuration editor: <code>sapling edit [TREE]</code></li> +<li>If you don't include a TREE, <code>sapling</code> will create a new tree in the current +directory.</li> <li>If you choose to modify an existing file, <code>sapling</code> will open the tree at the trunk, and show you the first branch.</li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> -<p>More details on the editor can be found in the <a href="var/docs/editor.md">Editor +<p>More details on the editor can be found in the <a href="http://www.theinternetvagabond.com/sapling/file.editor.html">Editor documentation</a>.</p> <h2>Contributing</h2> @@ -120,7 +124,7 @@ documentation</a>.</p> <ol> <li>Fork this repository.</li> <li>In your fork, make your changes.</li> -<li>Make sure your changes respect the <a href="CONTRIBUTING.md">contribution +<li>Make sure your changes respect the <a href="http://www.theinternetvagabond.com/sapling/file.CONTRIBUTING.html">contribution guidelines</a>.</li> <li>Submit a pull request.</li> </ol> @@ -128,13 +132,13 @@ guidelines</a>.</li> <h2>License</h2> <p>Sapling is licensed under the MIT license. The full text can be found in -<a href="LICENSE">LICENSE</a>.</p> +<a href="http://www.theinternetvagabond.com/sapling/file.LICENSE.html">LICENSE</a>.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.config_file.html b/doc/file.config_file.html index 03a9d92..725b618 100644 --- a/doc/file.config_file.html +++ b/doc/file.config_file.html @@ -126,9 +126,9 @@ branch", and the program will end after reaching it.</li> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.config_file_example.html b/doc/file.config_file_example.html index 9374e60..e72c020 100644 --- a/doc/file.config_file_example.html +++ b/doc/file.config_file_example.html @@ -100,9 +100,9 @@ </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/file.editor.html b/doc/file.editor.html index f2263ab..ce01b15 100644 --- a/doc/file.editor.html +++ b/doc/file.editor.html @@ -72,9 +72,9 @@ allows for editing all parts of a tree, from the trunk to the leaves.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/index.html b/doc/index.html index 5348f78..19a6d47 100644 --- a/doc/index.html +++ b/doc/index.html @@ -59,6 +59,10 @@ <div id="content"><div id='filecontents'><h1>Sapling: A Dialogue Tree CLI Utility</h1> +<p><a href="https://badge.fury.io/rb/sapling-dialogue"><img src="https://badge.fury.io/rb/sapling-dialogue.svg" alt="Gem +Version"></a> <a href="https://travis-ci.org/VagabondAzulien/sapling"><img src="https://travis-ci.org/VagabondAzulien/sapling.svg?branch=master" alt="Build +Status"></a></p> + <p>Sapling allows for easy creation and use of dialogue trees.</p> <p>A dialogue tree is a series of dialogues which follow sequentially, though with @@ -75,25 +79,25 @@ branch represents a choice taken in the dialogue. Branches flow to each other through leafs, which are the actual choices.</p> <p>You can experience this yourself, by loading "Example Quest! - A Meta Dialogue -Tree!". You can find the tree itself at <a href="var/trees/example_quest.yaml">trees/example_quest.yaml</a>. To run it, just type <code>sapling -t -trees/example_quest.yaml</code>.</p> +Tree!". You can find the tree itself at <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">var/trees/example_quest.yaml</a>. +To run it, just type <code>sapling read path/to/example_quest.yaml</code>.</p> <h2>Building a New Tree</h2> <p>To build a new tree, you have two options. You can manually edit a configuration file, or go through the construction wizard. Either way, the end result is a plain-text configuration file, which can be easily shared, edited, and viewed. -For more details on the configuration file itself, check out the <a href="var/docs/config_file.md">Configuration -File documentation</a>, or the self-documented -<a href="var/docs/config_file_example.yaml">configuration file example</a>. Alternatively, -you can checkout <a href="var/trees/example_quest.yaml">Example Quest</a> for a complete -tree.</p> +For more details on the configuration file itself, check out the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration +File documentation</a>, or the +self-documented <a href="http://www.theinternetvagabond.com/sapling/file.config_file_example.html">configuration file example</a>. +Alternatively, you can checkout <a href="https://github.com/VagabondAzulien/sapling/blob/master/var/trees/example_quest.yaml">Example Quest</a> +for a complete tree.</p> <h3>Manual Edit</h3> <ol> <li>Open your preferred text editor.</li> -<li>Refer to the <a href="var/docs/config_file.md">Configuration File documentation</a></li> +<li>Refer to the <a href="http://www.theinternetvagabond.com/sapling/file.config_file.html">Configuration File documentation</a></li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> @@ -101,16 +105,16 @@ tree.</p> <h3>Automatic Edit -- Coming Soon(tm)!</h3> <ol> -<li>Run the configuration editor: <code>sapling --edit [--new][--file FILE]</code></li> -<li>If you choose to create a new dialogue, <code>sapling</code> will generate a new file in -your current directory.</li> +<li>Run the configuration editor: <code>sapling edit [TREE]</code></li> +<li>If you don't include a TREE, <code>sapling</code> will create a new tree in the current +directory.</li> <li>If you choose to modify an existing file, <code>sapling</code> will open the tree at the trunk, and show you the first branch.</li> <li>Make your changes.</li> <li>Save your changes.</li> </ol> -<p>More details on the editor can be found in the <a href="var/docs/editor.md">Editor +<p>More details on the editor can be found in the <a href="http://www.theinternetvagabond.com/sapling/file.editor.html">Editor documentation</a>.</p> <h2>Contributing</h2> @@ -120,7 +124,7 @@ documentation</a>.</p> <ol> <li>Fork this repository.</li> <li>In your fork, make your changes.</li> -<li>Make sure your changes respect the <a href="CONTRIBUTING.md">contribution +<li>Make sure your changes respect the <a href="http://www.theinternetvagabond.com/sapling/file.CONTRIBUTING.html">contribution guidelines</a>.</li> <li>Submit a pull request.</li> </ol> @@ -128,13 +132,13 @@ guidelines</a>.</li> <h2>License</h2> <p>Sapling is licensed under the MIT license. The full text can be found in -<a href="LICENSE">LICENSE</a>.</p> +<a href="http://www.theinternetvagabond.com/sapling/file.LICENSE.html">LICENSE</a>.</p> </div></div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> diff --git a/doc/method_list.html b/doc/method_list.html index a22cb7c..52443d6 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -78,24 +78,56 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_branch-instance_method" title="Planter::Spade#edit_branch (method)">#edit_branch</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Dialogue.html#display_branch-class_method" title="Dialogue.display_branch (method)">display_branch</a></span> + <small>Dialogue</small> </div> </li> <li class="even "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_leaf-instance_method" title="Planter::Spade#edit_leaf (method)">#edit_leaf</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Dialogue.html#display_trunk-class_method" title="Dialogue.display_trunk (method)">display_trunk</a></span> + <small>Dialogue</small> </div> </li> <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#edit_trunk-instance_method" title="Planter::Spade#edit_trunk (method)">#edit_trunk</a></span> - <small>Planter::Spade</small> + <span class='object_link'><a href="Sapling.html#edit-instance_method" title="Sapling#edit (method)">#edit</a></span> + <small>Sapling</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_branch-instance_method" title="Planter::Plot#edit_branch (method)">#edit_branch</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_leaf-instance_method" title="Planter::Plot#edit_leaf (method)">#edit_leaf</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Planter/Plot.html#edit_trunk-instance_method" title="Planter::Plot#edit_trunk (method)">#edit_trunk</a></span> + <small>Planter::Plot</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#export-instance_method" title="Sapling#export (method)">#export</a></span> + <small>Sapling</small> </div> </li> @@ -110,8 +142,24 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Gardner.html#grow-class_method" title="Gardner.grow (method)">grow</a></span> - <small>Gardner</small> + <span class='object_link'><a href="Planter/Spade.html#get_response-instance_method" title="Planter::Spade#get_response (method)">#get_response</a></span> + <small>Planter::Spade</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Dialogue/Speaker.html#get_response-instance_method" title="Dialogue::Speaker#get_response (method)">#get_response</a></span> + <small>Dialogue::Speaker</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Planter/Spade.html#initialize-instance_method" title="Planter::Spade#initialize (method)">#initialize</a></span> + <small>Planter::Spade</small> </div> </li> @@ -126,7 +174,7 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Planter/Spade.html#plant-instance_method" title="Planter::Spade#plant (method)">#plant</a></span> + <span class='object_link'><a href="Planter/Spade.html#parse_response-instance_method" title="Planter::Spade#parse_response (method)">#parse_response</a></span> <small>Planter::Spade</small> </div> </li> @@ -134,15 +182,15 @@ <li class="even "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_branches-class_method" title="Gardner.prune_branches (method)">prune_branches</a></span> - <small>Gardner</small> + <span class='object_link'><a href="Planter/Spade.html#plant-instance_method" title="Planter::Spade#plant (method)">#plant</a></span> + <small>Planter::Spade</small> </div> </li> <li class="odd "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_leaves-class_method" title="Gardner.prune_leaves (method)">prune_leaves</a></span> + <span class='object_link'><a href="Gardner.html#prune_branches-class_method" title="Gardner.prune_branches (method)">prune_branches</a></span> <small>Gardner</small> </div> </li> @@ -150,7 +198,7 @@ <li class="even "> <div class="item"> - <span class='object_link'><a href="Gardner.html#prune_trunk-class_method" title="Gardner.prune_trunk (method)">prune_trunk</a></span> + <span class='object_link'><a href="Gardner.html#prune_leaves-class_method" title="Gardner.prune_leaves (method)">prune_leaves</a></span> <small>Gardner</small> </div> </li> @@ -158,8 +206,24 @@ <li class="odd "> <div class="item"> - <span class='object_link'><a href="Sapling/CLI.html#talk-instance_method" title="Sapling::CLI#talk (method)">#talk</a></span> - <small>Sapling::CLI</small> + <span class='object_link'><a href="Gardner.html#prune_trunk-class_method" title="Gardner.prune_trunk (method)">prune_trunk</a></span> + <small>Gardner</small> + </div> + </li> + + + <li class="even "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#read-instance_method" title="Sapling#read (method)">#read</a></span> + <small>Sapling</small> + </div> + </li> + + + <li class="odd "> + <div class="item"> + <span class='object_link'><a href="Sapling.html#serve-instance_method" title="Sapling#serve (method)">#serve</a></span> + <small>Sapling</small> </div> </li> diff --git a/doc/top-level-namespace.html b/doc/top-level-namespace.html index 3eae178..f6508e7 100644 --- a/doc/top-level-namespace.html +++ b/doc/top-level-namespace.html @@ -82,10 +82,12 @@ <p class="children"> - <strong class="modules">Modules:</strong> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span>, <span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span>, <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span>, <span class='object_link'><a href="Sapling.html" title="Sapling (module)">Sapling</a></span> + <strong class="modules">Modules:</strong> <span class='object_link'><a href="Dialogue.html" title="Dialogue (module)">Dialogue</a></span>, <span class='object_link'><a href="Gardner.html" title="Gardner (module)">Gardner</a></span>, <span class='object_link'><a href="Planter.html" title="Planter (module)">Planter</a></span> + <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sapling.html" title="Sapling (class)">Sapling</a></span> + </p> @@ -301,8 +303,7 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" 55 56 57 -58 -59</pre> +58</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/sapling/utility.rb', line 43</span> @@ -322,7 +323,6 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" <span class='kw'>end</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='kw'>true</span> - <span class='kw'>end</span></pre> </td> </tr> @@ -334,9 +334,9 @@ can point to branch 0 to immediately exit.</span><span class='tstring_end'>" </div> <div id="footer"> - Generated on Sun May 7 16:58:49 2017 by + Generated on Sat Oct 14 23:40:01 2017 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> - 0.9.9 (ruby-2.2.5). + 0.9.9 (ruby-2.4.2). </div> </div> From 57a0fa9a6e4b76cb1583aa67a6f5dd83fbab8764 Mon Sep 17 00:00:00 2001 From: Bill Niblock <azulien@gmail.com> Date: Sat, 14 Oct 2017 23:40:46 -0400 Subject: [PATCH 65/74] Updated website --- Dialogue.html | 385 ++++++++++++++++ Dialogue/Speaker.html | 745 ++++++++++++++++++++++++++++++ Gardner.html | 482 ++++++++++++++++++++ Planter.html | 126 ++++++ Planter/Plot.html | 660 +++++++++++++++++++++++++++ Planter/Spade.html | 826 ++++++++++++++++++++++++++++++++++ Sapling.html | 388 ++++++++++++++++ Sapling/CLI.html | 335 ++++++++++++++ _index.html | 184 ++++++++ class_list.html | 51 +++ css/common.css | 1 + css/full_list.css | 58 +++ css/style.css | 492 ++++++++++++++++++++ file.CONTRIBUTING.html | 84 ++++ file.LICENSE.html | 92 ++++ file.README.html | 146 ++++++ file.config_file.html | 136 ++++++ file.config_file_example.html | 110 +++++ file.editor.html | 82 ++++ file_list.html | 81 ++++ frames.html | 17 + index.html | 146 ++++++ js/app.js | 248 ++++++++++ js/full_list.js | 216 +++++++++ js/jquery.js | 4 + method_list.html | 267 +++++++++++ top-level-namespace.html | 344 ++++++++++++++ 27 files changed, 6706 insertions(+) create mode 100644 Dialogue.html create mode 100644 Dialogue/Speaker.html create mode 100644 Gardner.html create mode 100644 Planter.html create mode 100644 Planter/Plot.html create mode 100644 Planter/Spade.html create mode 100644 Sapling.html create mode 100644 Sapling/CLI.html create mode 100644 _index.html create mode 100644 class_list.html create mode 100644 css/common.css create mode 100644 css/full_list.css create mode 100644 css/style.css create mode 100644 file.CONTRIBUTING.html create mode 100644 file.LICENSE.html create mode 100644 file.README.html create mode 100644 file.config_file.html create mode 100644 file.config_file_example.html create mode 100644 file.editor.html create mode 100644 file_list.html create mode 100644 frames.html create mode 100644 index.html create mode 100644 js/app.js create mode 100644 js/full_list.js create mode 100644 js/jquery.js create mode 100644 method_list.html create mode 100644 top-level-namespace.html diff --git a/Dialogue.html b/Dialogue.html new file mode 100644 index 0000000..bf6102a --- /dev/null +++ b/Dialogue.html @@ -0,0 +1,385 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<title> + Module: Dialogue + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: Dialogue + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/dialogue.rb
    +
    + +
    + +

    Overview

    +
    + +

    Dialogue is the module for traversing an existing tree.

    + + +
    +
    +
    + + +

    Defined Under Namespace

    +

    + + + + + Classes: Speaker + + +

    + + + + + + + + +

    + Class Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .display_branch(branch, branch_no, debug = false) ⇒ Object + + + + + +

    +
    + +

    Format and display a branch and the options

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The branch number

      +
      + +
    • + +
    • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
      +

      Status of showing debug information

      +
      + +
    • + +
    + + +
    -
    # File 'lib/sapling/planter.rb', line 58
    +      
    # File 'lib/sapling/planter.rb', line 127
     
    -def edit_trunk
    +def parse_response(response, branch_no)
    +  10.times { print "*" }
    +  print "\n(Your choice: "
     
    +  if response.to_i >= 1
    +    print "Change to branch #{response.to_i})\n\n"
    +    return response.to_i
    +
    +  end
    +
    +  case response.to_s.downcase
    +  when "t"
    +    print "Edit the trunk.)\n\n"
    +    @plot.edit_trunk
    +    return branch_no
    +  when "a"
    +    print "Add a new branch.)\n\n"
    +    return branch_no
    +  when "b"
    +    print "Edit the current branch.)\n\n"
    +    @plot.edit_branch(branch_no)
    +    return branch_no
    +  when "x"
    +    print "Delete the current branch.)\n\n"
    +    return branch_no
    +  when "l"
    +    print "Edit leaves of current branch.)\n\n"
    +    return branch_no
    +  when "s"
    +    print "Save changes.)\n\n"
    +    return branch_no
    +  when "q"
    +    print "Quit without saving.)\n\n"
    +    print "Unsaved changes will be lost. Still quit? [y/n]> "
    +    verify = STDIN.gets.chomp.to_s.downcase
    +
    +    return 0 if verify == "y" 
    +    return branch_no
    +  else
    +    print "Unknown option. Returning to current branch.)\n\n"
    +    return branch_no
    +  end
     end
    -
    # File 'lib/sapling/planter.rb', line 22
    +      
    # File 'lib/sapling/planter.rb', line 67
     
     def plant
       @plot = Plot.new
       @plot.tree = @file
    -  @plot.trunk = @file.shift.values[0]
    +  @plot.trunk = @file.shift
       @plot.branches = Gardner.prune_branches(@file)
     
    -  dig(1)
    +  next_branch = dig(1)
    +  until next_branch == 0 do
    +    next_branch = dig(next_branch)
    +  end
    +
    +  puts "\n#{@plot.branches[0]["desc"]}"
    +  exit
     end
    + + + + +
    +
    +
    +
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +
    +
    # File 'lib/sapling/dialogue.rb', line 23
    +
    +def self.display_branch(branch, branch_no, debug=false)
    +  puts "\n[ Branch: #{branch_no} ]" if debug
    +  puts "\n#{branch["desc"]}\n\n"
    +
    +  branch["options"].each_pair do |k,v|
    +    puts "\t#{k}: #{v.keys[0]}"
    +    puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug
    +  end
    +end
    +
    +
    + +
    +

    + + .display_trunk(trunk, debug = false) ⇒ Object + + + + + +

    +
    + +

    Format and display the trunk

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + trunk + + + (Hash) + + + + — +
      +

      The trunk hash

      +
      + +
    • + +
    • + + debug + + + (Boolean) + + + (defaults to: false) + + + — +
      +

      The status of showing debug information

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +
    +
    # File 'lib/sapling/dialogue.rb', line 10
    +
    +def self.display_trunk(trunk, debug=false)
    +  40.times { print "-" }
    +  puts "\n[ Trunk ]\n" if debug
    +  puts "\n#{trunk["trunk"]}"
    +  40.times { print "-" }
    +  puts "\n"
    +end
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/Dialogue/Speaker.html b/Dialogue/Speaker.html new file mode 100644 index 0000000..3e9ed52 --- /dev/null +++ b/Dialogue/Speaker.html @@ -0,0 +1,745 @@ + + + + + + + Class: Dialogue::Speaker + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Dialogue::Speaker + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/dialogue.rb
    +
    + +
    + +

    Overview

    +
    + +

    Speaker holds the functionality for going through a dialogue tree.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #debug ⇒ Object + + + + + + + + + + + + + + + + +
      +

      Status of verbose/debug mode.

      +
      + +
    • + + +
    • + + + #file ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The file, which should be a dialogue tree YAML file.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(file = "", debug = false) ⇒ Speaker + + + + + +

    +
    + +

    Returns a new instance of Speaker

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +40
    +41
    +42
    +43
    +
    +
    # File 'lib/sapling/dialogue.rb', line 40
    +
    +def initialize(file="", debug=false)
    +  @file = file
    +  @debug = debug
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #debugObject + + + + + +

    +
    + +

    Status of verbose/debug mode. True = on; false = off.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +38
    +39
    +40
    +
    +
    # File 'lib/sapling/dialogue.rb', line 38
    +
    +def debug
    +  @debug
    +end
    +
    +
    + + + +
    +

    + + #fileObject + + + + + +

    +
    + +

    The file, which should be a dialogue tree YAML file.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +36
    +37
    +38
    +
    +
    # File 'lib/sapling/dialogue.rb', line 36
    +
    +def file
    +  @file
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #conversationObject + + + + + +

    +
    + +

    Conversation handles navigating the tree, until the option to end is +reached.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +
    +
    # File 'lib/sapling/dialogue.rb', line 47
    +
    +def conversation()
    +  tree = Gardner.prune_trunk(@file)
    +
    +  Dialogue.display_trunk(tree[0], false)
    +  branches = Gardner.prune_branches(tree[1])
    +
    +  next_branch = 1
    +  until next_branch == 0 do
    +    next_branch = talk(branches[next_branch], next_branch)
    +  end
    +
    +  puts "\n#{branches[0]["desc"]}"
    +  exit
    +end
    +
    +
    + +
    +

    + + #get_response(branch) ⇒ Integer + + + + + +

    +
    + +

    Get a response for the displayed branch

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the next branch

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +93
    +94
    +95
    +96
    +97
    +98
    +99
    +100
    +101
    +102
    +103
    +104
    +105
    +106
    +107
    +108
    +
    +
    # File 'lib/sapling/dialogue.rb', line 93
    +
    +def get_response(branch)
    +  valid_options = branch["options"].keys.join(", ")
    +
    +  print "\n[#{valid_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_i
    +
    +  until branch["options"].keys.include?(response) or response == 0
    +    print "[## Invalid options. "
    +    print "Valid options are #{valid_options}, or 0 to exit."
    +    print "\n[#{valid_options}]> "
    +    response = STDIN.gets.chomp.to_i
    +  end
    +
    +  return response
    +end
    +
    +
    + +
    +

    + + #talk(branch, branch_no) ⇒ Integer + + + + + +

    +
    + +

    Talk displays a branch, the options, and prompts for a response.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The branch number

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      The number of the next branch

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +83
    +84
    +85
    +86
    +87
    +
    +
    # File 'lib/sapling/dialogue.rb', line 67
    +
    +def talk(branch, branch_no)
    +  # If there are no options on this branch, we assume it's a terminal
    +  # branch. Return 0, and end the program.
    +  if branch["options"].empty?
    +    puts "\n#{branch["desc"]}\n\n"
    +    return 0
    +  end
    +
    +  Dialogue.display_branch(branch, branch_no, @debug)
    +
    +  response = get_response(branch)
    +
    +  unless response == 0
    +    puts "\n"
    +    10.times { print "*" }
    +    puts "\n(Your choice: #{branch["options"][response].keys[0]})"
    +    response = branch["options"][response].values[0].to_i
    +  end
    +
    +  return response
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/Gardner.html b/Gardner.html new file mode 100644 index 0000000..7e953a8 --- /dev/null +++ b/Gardner.html @@ -0,0 +1,482 @@ + + + + + + + Module: Gardner + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: Gardner + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/gardner.rb
    +
    + +
    + +

    Overview

    +
    + +

    Gardner is the module for working with a dialogue tree file

    + + +
    +
    +
    + + +
    + + + + + + + +

    + Class Method Summary + collapse +

    + + + + + + +
    +

    Class Method Details

    + + +
    +

    + + .prune_branches(tree) ⇒ Array + + + + + +

    +
    + +

    Parse the tree array into an array of numbered branches, and ordered +leaves.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + tree + + + (Array) + + + + — +
      +

      The dialogue tree

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array) + + + + — +
      +

      An array of numbered branches, with numbered leaves

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +
    +
    # File 'lib/sapling/gardner.rb', line 10
    +
    +def self.prune_branches(tree)
    +  branches = { 0 => { "desc" => "Thanks for using Sapling!" } }
    +  tree.each do |b|
    +    branches[b["branch"]["number"]] = {
    +      "desc" => b["branch"]["text"],
    +      "options" => prune_leaves(b["branch"]["leaf"]) }
    +  end
    +
    +  return branches
    +end
    +
    +
    + +
    +

    + + .prune_leaves(leaves) ⇒ Hash + + + + + +

    +
    + +

    Parse the leaves of a branch into a numbered hash of options.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + leaves + + + (Array) + + + + — +
      +

      The option of leaf hashes

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Hash) + + + + — +
      +

      A numbered hash of options

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +
    +
    # File 'lib/sapling/gardner.rb', line 25
    +
    +def self.prune_leaves(leaves)
    +  x = 1
    +  options = {}
    +
    +  return options if leaves.nil?
    +
    +  leaves.each do |l|
    +    options[x] = { l["text"] => l["branch"] }
    +    x += 1
    +  end
    +
    +  return options
    +end
    +
    +
    + +
    +

    + + .prune_trunk(tree) ⇒ Array + + + + + +

    +
    + +

    Parse the trunk of the tree.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + tree + + + (Hash) + + + + — +
      +

      The entire tree

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Array) + + + + — +
      +

      The trunk, and the remainder of the tree

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +43
    +44
    +45
    +46
    +47
    +
    +
    # File 'lib/sapling/gardner.rb', line 43
    +
    +def self.prune_trunk(tree)
    +  trunk = tree.shift
    +
    +  return [trunk,tree]
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/Planter.html b/Planter.html new file mode 100644 index 0000000..9751f5c --- /dev/null +++ b/Planter.html @@ -0,0 +1,126 @@ + + + + + + + Module: Planter + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Module: Planter + + + +

    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/planter.rb
    +
    + +
    + +

    Overview

    +
    + +

    Planter is the module for creating or editing a tree.

    + + +
    +
    +
    + + +

    Defined Under Namespace

    +

    + + + + + Classes: Plot, Spade + + +

    + + + + + + + + + +
    + + + +
    + + \ No newline at end of file diff --git a/Planter/Plot.html b/Planter/Plot.html new file mode 100644 index 0000000..9f5851a --- /dev/null +++ b/Planter/Plot.html @@ -0,0 +1,660 @@ + + + + + + + Class: Planter::Plot + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Planter::Plot + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/planter.rb
    +
    + +
    + +

    Overview

    +
    + +

    In-memory tree

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #branches ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    • + + + #tree ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    • + + + #trunk ⇒ Object + + + + + + + + + + + + + + + + +
      +

      The tree, trunk, and branches.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #branchesObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +12
    +13
    +14
    +
    +
    # File 'lib/sapling/planter.rb', line 12
    +
    +def branches
    +  @branches
    +end
    +
    +
    + + + +
    +

    + + #treeObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +12
    +13
    +14
    +
    +
    # File 'lib/sapling/planter.rb', line 12
    +
    +def tree
    +  @tree
    +end
    +
    +
    + + + +
    +

    + + #trunkObject + + + + + +

    +
    + +

    The tree, trunk, and branches

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +12
    +13
    +14
    +
    +
    # File 'lib/sapling/planter.rb', line 12
    +
    +def trunk
    +  @trunk
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #edit_branch(branch_no) ⇒ Object + + + + + +

    +
    + +

    Edit a branch on the tree

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +
    +
    # File 'lib/sapling/planter.rb', line 32
    +
    +def edit_branch(branch_no)
    +  puts "Current Branch:\n"
    +  Dialogue.display_branch(@branches[branch_no], branch_no, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_branch = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_branch = @branches[branch_no]["desc"]
    +  end
    +  @branches[branch_no]["desc"] = new_branch
    +end
    +
    +
    + +
    +

    + + #edit_leaf(branch, leaf) ⇒ Object + + + + + +

    +
    + +

    Edit a leaf on a branch, grasshopper

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Integer) + + + + — +
      +

      The number of the branch to be edited.

      +
      + +
    • + +
    • + + leaf + + + (Hash) + + + + — +
      +

      The leaf hash to be edited.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +50
    +51
    +52
    +
    +
    # File 'lib/sapling/planter.rb', line 50
    +
    +def edit_leaf(branch, leaf)
    +
    +end
    +
    +
    + +
    +

    + + #edit_trunkObject + + + + + +

    +
    + +

    Edit the trunk of the tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +
    +
    # File 'lib/sapling/planter.rb', line 15
    +
    +def edit_trunk
    +  puts "Current Trunk:\n"
    +  Dialogue.display_trunk(@trunk, true)
    +  print "\n[ =EDITING= ](CTRL-C to abort)> "
    +  STDOUT.flush
    +  begin
    +    new_trunk = STDIN.gets.to_s
    +  rescue Interrupt
    +    puts "\n**Aborting edit**\n\n"
    +    new_trunk = @trunk["trunk"]
    +  end
    +  @trunk["trunk"] = new_trunk
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/Planter/Spade.html b/Planter/Spade.html new file mode 100644 index 0000000..f89eacd --- /dev/null +++ b/Planter/Spade.html @@ -0,0 +1,826 @@ + + + + + + + Class: Planter::Spade + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Planter::Spade + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling/planter.rb
    +
    + +
    + +

    Overview

    +
    + +

    Utilities for editing specific parts of a tree.

    + + +
    +
    +
    + + +
    + + + +

    Instance Attribute Summary collapse

    +
      + +
    • + + + #file ⇒ Object + + + + + + + + + + writeonly + + + + + + + + +
      +

      The file we parse into a tree.

      +
      + +
    • + + +
    + + + + + +

    + Instance Method Summary + collapse +

    + + + + +
    +

    Constructor Details

    + +
    +

    + + #initialize(file) ⇒ Spade + + + + + +

    +
    + +

    Returns a new instance of Spade

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +61
    +62
    +63
    +
    +
    # File 'lib/sapling/planter.rb', line 61
    +
    +def initialize(file)
    +  @file = file
    +end
    +
    +
    + +
    + +
    +

    Instance Attribute Details

    + + + +
    +

    + + #file=(value) ⇒ Object (writeonly) + + + + + +

    +
    + +

    The file we parse into a tree

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +59
    +60
    +61
    +
    +
    # File 'lib/sapling/planter.rb', line 59
    +
    +def file=(value)
    +  @file = value
    +end
    +
    +
    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + #dig(branch_no) ⇒ Object + + + + + +

    +
    + +

    Function for displaying a single branch in debug mode. We also always +display the trunk, since otherwise it's displayed a single time then +gone forever (until next time).

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The number of the branch to be displayed.

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +87
    +88
    +89
    +90
    +91
    +92
    +93
    +94
    +95
    +96
    +97
    +
    +
    # File 'lib/sapling/planter.rb', line 87
    +
    +def dig(branch_no)
    +  branch = @plot.branches[branch_no]
    +
    +  Dialogue.display_trunk(@plot.trunk, true)
    +  Dialogue.display_branch(branch, branch_no, true)
    +
    +  response = get_response(branch)
    +  to_branch = parse_response(response, branch_no)
    +
    +  return to_branch
    +end
    +
    +
    + +
    +

    + + #get_response(branch) ⇒ Integer + + + + + +

    +
    + +

    Get a response for the displayed branch

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + branch + + + (Hash) + + + + — +
      +

      A branch data set

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the next branch

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +103
    +104
    +105
    +106
    +107
    +108
    +109
    +110
    +111
    +112
    +113
    +114
    +115
    +116
    +117
    +118
    +119
    +120
    +
    +
    # File 'lib/sapling/planter.rb', line 103
    +
    +def get_response(branch)
    +  total_branches = @plot.branches.count - 1
    +  valid_options = ["1-#{total_branches}","t","a","b","x","l","s","q"]
    +  print_options = valid_options.join(",")
    +
    +  print "\n[#{print_options}]> "
    +  STDOUT.flush
    +  response = STDIN.gets.chomp.to_s.downcase
    +
    +  until valid_options.include?(response) or response.to_i.between?(1,total_branches)
    +    print "[## Invalid response. "
    +    print "Valid options are #{print_options}"
    +    print "\n[#{print_options}]> "
    +    response = STDIN.gets.chomp.to_s.downcase
    +  end
    +
    +  return response
    +end
    +
    +
    + +
    +

    + + #parse_response(response, branch_no) ⇒ Integer + + + + + +

    +
    + +

    Parse the response from get_response

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + response + + + (String) + + + + — +
      +

      The option selected

      +
      + +
    • + +
    • + + branch_no + + + (Integer) + + + + — +
      +

      The currently-displayed branch

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (Integer) + + + + — +
      +

      the branch to display

      +
      + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +127
    +128
    +129
    +130
    +131
    +132
    +133
    +134
    +135
    +136
    +137
    +138
    +139
    +140
    +141
    +142
    +143
    +144
    +145
    +146
    +147
    +148
    +149
    +150
    +151
    +152
    +153
    +154
    +155
    +156
    +157
    +158
    +159
    +160
    +161
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +
    +
    # File 'lib/sapling/planter.rb', line 127
    +
    +def parse_response(response, branch_no)
    +  10.times { print "*" }
    +  print "\n(Your choice: "
    +
    +  if response.to_i >= 1
    +    print "Change to branch #{response.to_i})\n\n"
    +    return response.to_i
    +
    +  end
    +
    +  case response.to_s.downcase
    +  when "t"
    +    print "Edit the trunk.)\n\n"
    +    @plot.edit_trunk
    +    return branch_no
    +  when "a"
    +    print "Add a new branch.)\n\n"
    +    return branch_no
    +  when "b"
    +    print "Edit the current branch.)\n\n"
    +    @plot.edit_branch(branch_no)
    +    return branch_no
    +  when "x"
    +    print "Delete the current branch.)\n\n"
    +    return branch_no
    +  when "l"
    +    print "Edit leaves of current branch.)\n\n"
    +    return branch_no
    +  when "s"
    +    print "Save changes.)\n\n"
    +    return branch_no
    +  when "q"
    +    print "Quit without saving.)\n\n"
    +    print "Unsaved changes will be lost. Still quit? [y/n]> "
    +    verify = STDIN.gets.chomp.to_s.downcase
    +
    +    return 0 if verify == "y" 
    +    return branch_no
    +  else
    +    print "Unknown option. Returning to current branch.)\n\n"
    +    return branch_no
    +  end
    +end
    +
    +
    + +
    +

    + + #plantObject + + + + + +

    +
    + +

    Establish and populate a new Plot (in-memory tree), then control the flow +of editing the Plot

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +
    +
    # File 'lib/sapling/planter.rb', line 67
    +
    +def plant
    +  @plot = Plot.new
    +  @plot.tree = @file
    +  @plot.trunk = @file.shift
    +  @plot.branches = Gardner.prune_branches(@file)
    +
    +  next_branch = dig(1)
    +  until next_branch == 0 do
    +    next_branch = dig(next_branch)
    +  end
    +
    +  puts "\n#{@plot.branches[0]["desc"]}"
    +  exit
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/Sapling.html b/Sapling.html new file mode 100644 index 0000000..ed2ef29 --- /dev/null +++ b/Sapling.html @@ -0,0 +1,388 @@ + + + + + + + Class: Sapling + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Sapling + + + +

    +
    + +
    +
    Inherits:
    +
    + Thor + +
      +
    • Object
    • + + + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling.rb
    +
    + +
    + +

    Overview

    +
    + +

    The main Sapling interface.

    + + +
    +
    +
    + + +
    + + + + + + + +

    + Instance Method Summary + collapse +

    + + + + + + + +
    +

    Instance Method Details

    + + +
    +

    + + #edit(tree = '') ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'lib/sapling.rb', line 19
    +
    +def edit(tree = '')
    +  puts 'Welcome to Sapling, a Dialogue Tree Utility.'
    +  if !tree.empty?
    +    puts "Loading tree: #{tree}"
    +    exit unless verify_tree(tree)
    +    gardner = Planter::Spade.new(YAML.load_file(tree, false))
    +  else
    +    puts 'Creating a new tree!'
    +    gardner = Planter::Spade.new(SKELETON_TREE)
    +  end
    +  gardner.plant
    +end
    +
    +
    + +
    +

    + + #export(tree) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +39
    +40
    +41
    +42
    +
    +
    # File 'lib/sapling.rb', line 39
    +
    +def export(tree)
    +  exit unless verify_tree(tree)
    +  puts 'Cool feature, bro!'
    +end
    +
    +
    + +
    +

    + + #read(tree) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +11
    +12
    +13
    +14
    +15
    +16
    +
    +
    # File 'lib/sapling.rb', line 11
    +
    +def read(tree)
    +  exit unless verify_tree(tree)
    +  puts 'Welcome to Sapling, a Dialogue Tree Utility.'
    +  speaker = Dialogue::Speaker.new(YAML.load_file(tree), false)
    +  speaker.conversation
    +end
    +
    +
    + +
    +

    + + #serve(tree) ⇒ Object + + + + + +

    + + + + +
    +
    +
    +
    +33
    +34
    +35
    +36
    +
    +
    # File 'lib/sapling.rb', line 33
    +
    +def serve(tree)
    +  exit unless verify_tree(tree)
    +  puts 'Sinatra will be cool.'
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/Sapling/CLI.html b/Sapling/CLI.html new file mode 100644 index 0000000..72677c2 --- /dev/null +++ b/Sapling/CLI.html @@ -0,0 +1,335 @@ + + + + + + + Class: Sapling::CLI + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Class: Sapling::CLI + + + +

    +
    + +
    +
    Inherits:
    +
    + Object + +
      +
    • Object
    • + + + +
    + show all + +
    +
    + + + + + + + + + + + +
    +
    Defined in:
    +
    lib/sapling.rb
    +
    + +
    + +

    Overview

    +
    + +

    CLI is the class for option parsing, and the gateway to the program, on the +command line

    + + +
    +
    +
    + + +
    + + + + + + + +

    + Instance Method Summary + collapse +

    + +
      + +
    • + + + #talk(options) ⇒ Object + + + + + + + + + + + + + +
      +

      Option parsing, and gateway to either reading and traversing a tree, or +editing/creating a tree.

      +
      + +
    • + + +
    + + + + +
    +

    Instance Method Details

    + + +
    +

    + + #talk(options) ⇒ Object + + + + + +

    +
    + +

    Option parsing, and gateway to either reading and traversing a tree, or +editing/creating a tree.

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +31
    +32
    +33
    +34
    +35
    +36
    +37
    +38
    +39
    +40
    +41
    +42
    +43
    +44
    +45
    +46
    +47
    +48
    +49
    +50
    +51
    +52
    +53
    +54
    +55
    +56
    +57
    +58
    +59
    +60
    +61
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +81
    +82
    +
    +
    # File 'lib/sapling.rb', line 21
    +
    +def talk(options)
    +  opt_parser = OptionParser.new do |opt|
    +    opt.banner = "Usage: sapling -t FILE\n" \
    +                 "Usage: sapling -e [FILE]"
    +
    +    opt.on_tail("-h", "--help", "Show this menu") do
    +      puts opt
    +      exit
    +    end
    +
    +    opt.on("-t", "--talk",
    +           "Begin traversing the provided dialogue tree") do
    +
    +      if ARGV.empty?
    +        puts "No tree file provided. Please provide a tree file."
    +        puts opt_parser
    +        exit
    +      end
    +
    +      unless verify_tree(ARGV[0])
    +        puts "\n#{opt}\n"
    +        exit
    +      end
    +
    +      puts "Welcome to Sapling, a Dialogue Tree Utility.\n"
    +      speaker = Dialogue::Speaker.new
    +      speaker.file = YAML.load_file(ARGV[0])
    +      speaker.conversation
    +    end
    +
    +    opt.on("-e", "--edit",
    +           "Create or edit a dialogue tree") do
    +
    +      if ARGV.empty?
    +        puts "Creating a new tree."
    +        tree = SKELETON_TREE
    +      else
    +        puts "Using tree at #{ARGV[0]}."
    +        unless verify_tree(ARGV[0])
    +          puts "\n#{opt}\n"
    +          exit
    +        end
    +        tree = YAML.load_file(ARGV[0])
    +      end
    +
    +      puts "Welcome to Sapling, a Dialogue Tree Utility.\n"
    +      gardner = Planter::Spade.new
    +      gardner.file = tree
    +      gardner.plant
    +    end
    +
    +  end
    +
    +  # Hacky way of dealing with bad options
    +  begin
    +    opt_parser.parse!(options)
    +  rescue OptionParser::InvalidOption
    +    puts "Invalid option."
    +    puts opt_parser
    +    exit
    +  end
    +end
    +
    +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/_index.html b/_index.html new file mode 100644 index 0000000..ae95d40 --- /dev/null +++ b/_index.html @@ -0,0 +1,184 @@ + + + + + + + Sapling Documentation + + + + + + + + + + + + + + + + + + + +
    + + +

    Sapling Documentation

    +
    +

    Alphabetic Index

    + +

    File Listing

    + + +
    +

    Namespace Listing A-Z

    + + + + + + + + + + +
    + + + + + + + + +
      +
    • P
    • + +
    + + + + +
    + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/class_list.html b/class_list.html new file mode 100644 index 0000000..728036b --- /dev/null +++ b/class_list.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + Class List + + + +
    +
    +

    Class List

    + + + +
    + + +
    + + diff --git a/css/common.css b/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/css/full_list.css b/css/full_list.css new file mode 100644 index 0000000..fa35982 --- /dev/null +++ b/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..f682a69 --- /dev/null +++ b/css/style.css @@ -0,0 +1,492 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
      */ +#filecontents li > p, .docstring li > p { margin: 0px; } +#filecontents ul, .docstring ul { padding-left: 20px; } +/* style for
      */ +#filecontents dl, .docstring dl { border: 1px solid #ccc; } +#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; } +#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; } +#filecontents dd > p, .docstring dd > p { margin: 0px; } + +.note { + color: #222; + margin: 20px 0; + padding: 10px; + border: 1px solid #eee; + border-radius: 3px; + display: block; +} +.docstring .note { + border-left-color: #ccc; + border-left-width: 5px; +} +.note.todo { background: #ffffc5; border-color: #ececaa; } +.note.returns_void { background: #efefef; } +.note.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.title.deprecated { background: #ffe5e5; border-color: #e9dada; } +.note.private { background: #ffffc5; border-color: #ececaa; } +.note.title { padding: 3px 6px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; } +.summary_signature + .note.title { margin-left: 7px; } +h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; } +.note.title { background: #efefef; } +.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; } +.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; } +.note.title.private { background: #d5d5d5; border-color: #c5c5c5; } +.note.title.not_defined_here { background: transparent; border: none; font-style: italic; } +.discussion .note { margin-top: 6px; } +.discussion .note:first-child { margin-top: 0; } + +h3.inherited { + font-style: italic; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-weight: normal; + padding: 0; + margin: 0; + margin-top: 12px; + margin-bottom: 3px; + font-size: 13px; +} +p.inherited { + padding: 0; + margin: 0; + margin-left: 25px; +} + +.box_info dl { + margin: 0; + border: 0; + width: 100%; + font-size: 1em; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} +.box_info dl dt { + flex-shrink: 0; + -webkit-flex-shrink: 1; + -ms-flex-shrink: 1; + width: 100px; + text-align: right; + font-weight: bold; + border: 1px solid #aaa; + border-width: 1px 0px 0px 1px; + padding: 6px 0; + padding-right: 10px; +} +.box_info dl dd { + flex-grow: 1; + -webkit-flex-grow: 1; + -ms-flex: 1; + max-width: 420px; + padding: 6px 0; + padding-right: 20px; + border: 1px solid #aaa; + border-width: 1px 1px 0 0; + overflow: hidden; + position: relative; +} +.box_info dl:last-child > * { + border-bottom: 1px solid #aaa; +} +.box_info dl:nth-child(odd) > * { background: #eee; } +.box_info dl:nth-child(even) > * { background: #fff; } +.box_info dl > * { margin: 0; } + +ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; } +.index_inline_list { padding-left: 0; font-size: 1.1em; } + +.index_inline_list li { + list-style: none; + display: inline-block; + padding: 0 12px; + line-height: 30px; + margin-bottom: 5px; +} + +dl.constants { margin-left: 10px; } +dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; } +dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; } +dl.constants .docstring .note:first-child { margin-top: 5px; } + +.summary_desc { + margin-left: 32px; + display: block; + font-family: sans-serif; + font-size: 1.1em; + margin-top: 8px; + line-height: 1.5145em; + margin-bottom: 0.8em; +} +.summary_desc tt { font-size: 0.9em; } +dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; } +dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; } +dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; } +dl.constants .discussion *:first-child { margin-top: 0; } +dl.constants .discussion *:last-child { margin-bottom: 0; } + +.method_details { border-top: 1px dotted #ccc; margin-top: 25px; padding-top: 0; } +.method_details.first { border: 0; margin-top: 5px; } +.method_details.first h3.signature { margin-top: 1em; } +p.signature, h3.signature { + font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace; + padding: 6px 10px; margin-top: 1em; + background: #E8F4FF; border: 1px solid #d8d8e5; border-radius: 5px; +} +p.signature tt, +h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; } +p.signature .overload, +h3.signature .overload { display: block; } +p.signature .extras, +h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; } +p.signature .not_defined_here, +h3.signature .not_defined_here, +p.signature .aliases, +h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; } +p.signature .aliases .names, +h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; } + +.tags .tag_title { font-size: 1.05em; margin-bottom: 0; font-weight: bold; } +.tags .tag_title tt { color: initial; padding: initial; background: initial; } +.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; } +.tags ul li { margin-bottom: 3px; } +.tags ul .name { font-family: monospace; font-weight: bold; } +.tags ul .note { padding: 3px 6px; } +.tags { margin-bottom: 12px; } + +.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; } +.tags .examples .inline p { padding: 0; margin: 0; font-weight: bold; font-size: 1em; } +.tags .examples .inline p:before { content: "▸"; font-size: 1em; margin-right: 5px; } + +.tags .overload .overload_item { list-style: none; margin-bottom: 25px; } +.tags .overload .overload_item .signature { + padding: 2px 8px; + background: #F1F8FF; border: 1px solid #d8d8e5; border-radius: 3px; +} +.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; } +.tags .overload .docstring { margin-top: 15px; } + +.defines { display: none; } + +#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; } + +.showSource { font-size: 0.9em; } +.showSource a, .showSource a:visited { text-decoration: none; color: #666; } + +#content a, #content a:visited { text-decoration: none; color: #05a; } +#content a:hover { background: #ffffa5; } + +ul.summary { + list-style: none; + font-family: monospace; + font-size: 1em; + line-height: 1.5em; + padding-left: 0px; +} +ul.summary a, ul.summary a:visited { + text-decoration: none; font-size: 1.1em; +} +ul.summary li { margin-bottom: 5px; } +.summary .summary_signature { + padding: 4px 8px; + background: #f8f8f8; + border: 1px solid #f0f0f0; + border-radius: 5px; +} +.summary_signature:hover { background: #CFEBFF; border-color: #A4CCDA; cursor: pointer; } +ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;} +ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; } +#content .summary_signature:hover a, +#content .summary_signature:hover a:visited { + background: transparent; + color: #049; +} + +p.inherited a { font-family: monospace; font-size: 0.9em; } +p.inherited { word-spacing: 5px; font-size: 1.2em; } + +p.children { font-size: 1.2em; } +p.children a { font-size: 0.9em; } +p.children strong { font-size: 0.8em; } +p.children strong.modules { padding-left: 5px; } + +ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; } +ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; } +ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,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) no-repeat top center; } +ul.fullTree li:first-child { padding-top: 0; background: transparent; } +ul.fullTree li:last-child { padding-bottom: 0; } +.showAll ul.fullTree { display: block; } +.showAll .inheritName { display: none; } + +#search { position: absolute; right: 12px; top: 0px; z-index: 9000; } +#search a { + display: block; float: left; + padding: 4px 8px; text-decoration: none; color: #05a; fill: #05a; + border: 1px solid #d8d8e5; + border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; + background: #F1F8FF; + box-shadow: -1px 1px 3px #ddd; +} +#search a:hover { background: #f5faff; color: #06b; fill: #06b; } +#search a.active { + background: #568; padding-bottom: 20px; color: #fff; fill: #fff; + border: 1px solid #457; + border-top-left-radius: 5px; border-top-right-radius: 5px; +} +#search a.inactive { color: #999; fill: #999; } +.inheritanceTree, .toggleDefines { + float: right; + border-left: 1px solid #aaa; + position: absolute; top: 0; right: 0; + height: 100%; + background: #f6f6f6; + padding: 5px; + min-width: 55px; + text-align: center; +} + +#menu { font-size: 1.3em; color: #bbb; } +#menu .title, #menu a { font-size: 0.7em; } +#menu .title a { font-size: 1em; } +#menu .title { color: #555; } +#menu a, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; } +#menu a:hover { color: #05a; } + +#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; } +#footer a, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; } +#footer a:hover { color: #05a; } + +#listing ul.alpha { font-size: 1.1em; } +#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; } +#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; } +#listing ul.alpha ul { margin: 0; padding-left: 15px; } +#listing ul small { color: #666; font-size: 0.7em; } + +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } + +#content ul.summary li.deprecated .summary_signature a, +#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; } + +#toc { + position: relative; + float: right; + overflow-x: auto; + right: -3px; + margin-left: 20px; + margin-bottom: 20px; + padding: 20px; padding-right: 30px; + max-width: 300px; + z-index: 5000; + background: #fefefe; + border: 1px solid #ddd; + box-shadow: -2px 2px 6px #bbb; +} +#toc .title { margin: 0; } +#toc ol { padding-left: 1.8em; } +#toc li { font-size: 1.1em; line-height: 1.7em; } +#toc > ol > li { font-size: 1.1em; font-weight: bold; } +#toc ol > ol { font-size: 0.9em; } +#toc ol ol > ol { padding-left: 2.3em; } +#toc ol + li { margin-top: 0.3em; } +#toc.hidden { padding: 10px; background: #fefefe; box-shadow: none; } +#toc.hidden:hover { background: #fafafa; } +#filecontents h1 + #toc.nofloat { margin-top: 0; } +@media (max-width: 560px) { + #toc { + margin-left: 0; + margin-top: 16px; + float: none; + max-width: none; + } +} + +/* syntax highlighting */ +.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; } +#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; } +#filecontents pre.code, .docstring pre.code { display: block; } +.source_code .lines { padding-right: 12px; color: #555; text-align: right; } +#filecontents pre.code, .docstring pre.code, +.tags pre.example { + padding: 9px 14px; + margin-top: 4px; + border: 1px solid #e1e1e8; + background: #f7f7f9; + border-radius: 4px; + font-size: 1em; + overflow-x: auto; + line-height: 1.2em; +} +pre.code { color: #000; tab-size: 2; } +pre.code .info.file { color: #555; } +pre.code .val { color: #036A07; } +pre.code .tstring_content, +pre.code .heredoc_beg, pre.code .heredoc_end, +pre.code .qwords_beg, pre.code .qwords_end, pre.code .qwords_sep, +pre.code .words_beg, pre.code .words_end, pre.code .words_sep, +pre.code .qsymbols_beg, pre.code .qsymbols_end, pre.code .qsymbols_sep, +pre.code .symbols_beg, pre.code .symbols_end, pre.code .symbols_sep, +pre.code .tstring, pre.code .dstring { color: #036A07; } +pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s, +pre.code .rubyid_to_sym, pre.code .rubyid_to_f, +pre.code .dot + pre.code .id, +pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; } +pre.code .comment { color: #0066FF; } +pre.code .const, pre.code .constant { color: #585CF6; } +pre.code .label, +pre.code .symbol { color: #C5060B; } +pre.code .kw, +pre.code .rubyid_require, +pre.code .rubyid_extend, +pre.code .rubyid_include { color: #0000FF; } +pre.code .ivar { color: #318495; } +pre.code .gvar, +pre.code .rubyid_backref, +pre.code .rubyid_nth_ref { color: #6D79DE; } +pre.code .regexp, .dregexp { color: #036A07; } +pre.code a { border-bottom: 1px dotted #bbf; } + +/* Color fix for links */ +#content .summary_desc pre.code .id > .object_link a, /* identifier */ +#content .docstring pre.code .id > .object_link a { color: #0085FF; } +#content .summary_desc pre.code .const > .object_link a, /* constant */ +#content .docstring pre.code .const > .object_link a { color: #585CF6; } diff --git a/file.CONTRIBUTING.html b/file.CONTRIBUTING.html new file mode 100644 index 0000000..0a3c9da --- /dev/null +++ b/file.CONTRIBUTING.html @@ -0,0 +1,84 @@ + + + + + + + File: CONTRIBUTING + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Contributing to Sapling

      + +

      If you actually want to contribute to this software, first off: Thanks! Sapling +is just a side-project, unintended for any significant use.

      + +

      Sapling is written in Ruby, and adheres to the standard Rubocop rules. So long +as your code passes those rules, it should be good. At time of writing, Sapling +has no testing, because I honestly have very little experience writing tests. +Hopefully this changes soon!

      + +

      If you don't know how to program in Ruby, but wish to improve this software, +feel free to submit an issue or reach out to me directly.

      + +

      Thanks again for your interest in Sapling!

      +
      + + + +
      + + \ No newline at end of file diff --git a/file.LICENSE.html b/file.LICENSE.html new file mode 100644 index 0000000..0349eb2 --- /dev/null +++ b/file.LICENSE.html @@ -0,0 +1,92 @@ + + + + + + + File: LICENSE + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +
      +

      MIT License

      + +

      Copyright © 2017 Bill Niblock

      + +

      Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the “Software”), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions:

      + +

      The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software.

      + +

      THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE.

      +
      + + + +
      + + \ No newline at end of file diff --git a/file.README.html b/file.README.html new file mode 100644 index 0000000..253301c --- /dev/null +++ b/file.README.html @@ -0,0 +1,146 @@ + + + + + + + File: README + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Sapling: A Dialogue Tree CLI Utility

      + +

      Gem
+Version Build
+Status

      + +

      Sapling allows for easy creation and use of dialogue trees.

      + +

      A dialogue tree is a series of dialogues which follow sequentially, though with +branching options. Examples include "Choose Your Own Adventure" games, or the +dialogues seen in many video games.

      + +

      Structure

      + +

      A dialogue tree can be broken down into three distinct parts: the trunk, +branches, and leafs. The trunk represents the main structure of the tree. Unlike +a branch, which displays content and options, the trunk provides metadata. +Generally speaking, it is a branch, with the exception that it has no options. A +branch represents a choice taken in the dialogue. Branches flow to each other +through leafs, which are the actual choices.

      + +

      You can experience this yourself, by loading "Example Quest! - A Meta Dialogue +Tree!". You can find the tree itself at var/trees/example_quest.yaml. +To run it, just type sapling read path/to/example_quest.yaml.

      + +

      Building a New Tree

      + +

      To build a new tree, you have two options. You can manually edit a configuration +file, or go through the construction wizard. Either way, the end result is a +plain-text configuration file, which can be easily shared, edited, and viewed. +For more details on the configuration file itself, check out the Configuration +File documentation, or the +self-documented configuration file example. +Alternatively, you can checkout Example Quest +for a complete tree.

      + +

      Manual Edit

      + +
        +
      1. Open your preferred text editor.
      2. +
      3. Refer to the Configuration File documentation
      4. +
      5. Make your changes.
      6. +
      7. Save your changes.
      8. +
      + +

      Automatic Edit -- Coming Soon(tm)!

      + +
        +
      1. Run the configuration editor: sapling edit [TREE]
      2. +
      3. If you don't include a TREE, sapling will create a new tree in the current +directory.
      4. +
      5. If you choose to modify an existing file, sapling will open the tree at the +trunk, and show you the first branch.
      6. +
      7. Make your changes.
      8. +
      9. Save your changes.
      10. +
      + +

      More details on the editor can be found in the Editor +documentation.

      + +

      Contributing

      + +

      You can contribute to Sapling by following these instructions:

      + +
        +
      1. Fork this repository.
      2. +
      3. In your fork, make your changes.
      4. +
      5. Make sure your changes respect the contribution +guidelines.
      6. +
      7. Submit a pull request.
      8. +
      + +

      License

      + +

      Sapling is licensed under the MIT license. The full text can be found in +LICENSE.

      +
      + + + +
      + + \ No newline at end of file diff --git a/file.config_file.html b/file.config_file.html new file mode 100644 index 0000000..725b618 --- /dev/null +++ b/file.config_file.html @@ -0,0 +1,136 @@ + + + + + + + File: Configuration File + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Configuration File Documentation

      + +

      The configuration file for sapling is a standard YAML file. The general +outline looks something like this:

      + +
          ---
      +    -
      +      trunk: "This is a description of the dialogue tree."
      +    -
      +      branch:
      +        number: 1
      +        text: "This is the overall text for the branch."
      +        leaf:
      +          -
      +            text: "This is option 1."
      +            branch: 2
      +          -
      +            text: "This is option 2."
      +            branch: 3
      +    -
      +      branch:
      +        number: 2
      +        text: "This is the overall text for the branch."
      +        leaf:
      +          -
      +            text: "This is option 1."
      +            branch: 1
      +          -
      +            text: "This is option 2."
      +            branch: 3
      +    -
      +      branch:
      +        number: 3
      +        text: "This is the overall text for the branch."
      +
      + +

      Outline

      + +

      Trunk

      + +

      The trunk is a metadata list. Currently, the only information we really care +about is a general description for the tree. Because of this, trunk is the +key, and the description is the value.

      + +

      Branch

      + +

      Branches are the content of a dialogue tree. Each branch has the following +options:

      + +
        +
      • number: The branch number. This is how leaves get around. It must be unique.
      • +
      • text: The text provided by getting to this branch. The first branch is shown +by default when the tree is opened.
      • +
      • leaf: [Optional] The list of options for the branch. Details for leaves are +below. If no leaves are provided, the branch is considered a "terminal +branch", and the program will end after reaching it.
      • +
      + +

      Leaf

      + +

      Leaves are the options of a branch. Each leaf has the following options:

      + +
        +
      • text: The text shown as the option.
      • +
      • branch: The branch this option takes the user to.
      • +
      +
      + + + +
      + + \ No newline at end of file diff --git a/file.config_file_example.html b/file.config_file_example.html new file mode 100644 index 0000000..e72c020 --- /dev/null +++ b/file.config_file_example.html @@ -0,0 +1,110 @@ + + + + + + + File: Example YAML File + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Example Dialogue Tree

      + +
      ---
      +# The trunk is a general introduction to the tree. It shouldn't include any
      +# thematic details, rather a one-liner to let the user know what they're getting
      +# into.
      +-
      +  trunk: "This is a general introduction to the dialogue tree."
      +
      +# Branches are the content of a dialogue tree. Each branch is numbered, and that
      +# number is used as the primary means of navigation. The text of a branch is the
      +# story provided to the user; the result of getting to the branch. The leaves
      +# (the section titled leaf) represent the options. Options are displayed in the
      +# order they appear. Within a leaf, the text is what the option says, and the
      +# branch is the branch number which this option will lead to. Leading to branch
      +# number 0 will immediately exit the program.
      +#
      +# You can have as many branches and leaves as you wish, though having too many
      +# leaves may lead to both display problems, and paralyzing indecision.
      +-
      +  branch:
      +    number: 1
      +    text: "The first branch. Displayed first, by default."
      +    leaf:
      +      -
      +        text: "The first option for this branch. It leads to branch 2"
      +        branch: 2
      +      -
      +        text: "The second branch. It immediately exits the program."
      +        branch: 0
      +
      +# A terminal branch is a branch which has no leaves. This represents an ending.
      +# Once a user hits a terminal branch, the program will display the branch text,
      +# and then redirect the user to branch 0, to exit.
      +-
      +  branch:
      +    number: 2
      +    text: "This is a terminal branch. After displaying this text,
      +      the program will exit."
      +
      +
      + + + +
      + + \ No newline at end of file diff --git a/file.editor.html b/file.editor.html new file mode 100644 index 0000000..ce01b15 --- /dev/null +++ b/file.editor.html @@ -0,0 +1,82 @@ + + + + + + + File: Using the Editor + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Sapling Editor

      + +

      Sapling provides an editor for creating and modifying dialogue trees. The editor +allows for editing all parts of a tree, from the trunk to the leaves.

      + +

      Creating a new tree

      + +

      Pending

      + +

      Editing an existing tree

      + +

      Pending

      +
      + + + +
      + + \ No newline at end of file diff --git a/file_list.html b/file_list.html new file mode 100644 index 0000000..edb69c0 --- /dev/null +++ b/file_list.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + File List + + + +
      +
      +

      File List

      + + + +
      + + +
      + + diff --git a/frames.html b/frames.html new file mode 100644 index 0000000..6d0f27e --- /dev/null +++ b/frames.html @@ -0,0 +1,17 @@ + + + + + Sapling Documentation + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..19a6d47 --- /dev/null +++ b/index.html @@ -0,0 +1,146 @@ + + + + + + + File: README + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Sapling: A Dialogue Tree CLI Utility

      + +

      Gem
+Version Build
+Status

      + +

      Sapling allows for easy creation and use of dialogue trees.

      + +

      A dialogue tree is a series of dialogues which follow sequentially, though with +branching options. Examples include "Choose Your Own Adventure" games, or the +dialogues seen in many video games.

      + +

      Structure

      + +

      A dialogue tree can be broken down into three distinct parts: the trunk, +branches, and leafs. The trunk represents the main structure of the tree. Unlike +a branch, which displays content and options, the trunk provides metadata. +Generally speaking, it is a branch, with the exception that it has no options. A +branch represents a choice taken in the dialogue. Branches flow to each other +through leafs, which are the actual choices.

      + +

      You can experience this yourself, by loading "Example Quest! - A Meta Dialogue +Tree!". You can find the tree itself at var/trees/example_quest.yaml. +To run it, just type sapling read path/to/example_quest.yaml.

      + +

      Building a New Tree

      + +

      To build a new tree, you have two options. You can manually edit a configuration +file, or go through the construction wizard. Either way, the end result is a +plain-text configuration file, which can be easily shared, edited, and viewed. +For more details on the configuration file itself, check out the Configuration +File documentation, or the +self-documented configuration file example. +Alternatively, you can checkout Example Quest +for a complete tree.

      + +

      Manual Edit

      + +
        +
      1. Open your preferred text editor.
      2. +
      3. Refer to the Configuration File documentation
      4. +
      5. Make your changes.
      6. +
      7. Save your changes.
      8. +
      + +

      Automatic Edit -- Coming Soon(tm)!

      + +
        +
      1. Run the configuration editor: sapling edit [TREE]
      2. +
      3. If you don't include a TREE, sapling will create a new tree in the current +directory.
      4. +
      5. If you choose to modify an existing file, sapling will open the tree at the +trunk, and show you the first branch.
      6. +
      7. Make your changes.
      8. +
      9. Save your changes.
      10. +
      + +

      More details on the editor can be found in the Editor +documentation.

      + +

      Contributing

      + +

      You can contribute to Sapling by following these instructions:

      + +
        +
      1. Fork this repository.
      2. +
      3. In your fork, make your changes.
      4. +
      5. Make sure your changes respect the contribution +guidelines.
      6. +
      7. Submit a pull request.
      8. +
      + +

      License

      + +

      Sapling is licensed under the MIT license. The full text can be found in +LICENSE.

      +
      + + + +
      + + \ No newline at end of file diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..b9f2120 --- /dev/null +++ b/js/app.js @@ -0,0 +1,248 @@ +(function() { + +var localStorage = {}, sessionStorage = {}; +try { localStorage = window.localStorage; } catch (e) { } +try { sessionStorage = window.sessionStorage; } catch (e) { } + +function createSourceLinks() { + $('.method_details_list .source_code'). + before("[View source]"); + $('.toggleSource').toggle(function() { + $(this).parent().nextAll('.source_code').slideDown(100); + $(this).text("Hide source"); + }, + function() { + $(this).parent().nextAll('.source_code').slideUp(100); + $(this).text("View source"); + }); +} + +function createDefineLinks() { + var tHeight = 0; + $('.defines').after(" more..."); + $('.toggleDefines').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).prev().css('display', 'inline'); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function() { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + }); +} + +function createFullTreeLinks() { + var tHeight = 0; + $('.inheritanceTree').toggle(function() { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass('showAll'); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function() { + $(this).parent().toggleClass('showAll'); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + }); +} + +function searchFrameButtons() { + $('.full_list_link').click(function() { + toggleSearchFrame(this, $(this).attr('href')); + return false; + }); + window.addEventListener('message', function(e) { + if (e.data === 'navEscape') { + $('#nav').slideUp(100); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); + + $(window).resize(function() { + if ($('#search:visible').length === 0) { + $('#nav').removeAttr('style'); + $('#search a').removeClass('active inactive'); + $(window).focus(); + } + }); +} + +function toggleSearchFrame(id, link) { + var frame = $('#nav'); + $('#search a').removeClass('active').addClass('inactive'); + if (frame.attr('src') === link && frame.css('display') !== "none") { + frame.slideUp(100); + $('#search a').removeClass('active inactive'); + } + else { + $(id).addClass('active').removeClass('inactive'); + if (frame.attr('src') !== link) frame.attr('src', link); + frame.slideDown(100); + } +} + +function linkSummaries() { + $('.summary_signature').click(function() { + document.location = $(this).find('a').attr('href'); + }); +} + +function summaryToggle() { + $('.summary_toggle').click(function(e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $('.summary_toggle').each(function() { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll('ul.summary').first(); + if (next.hasClass('compact')) { + next.toggle(); + next.nextAll('ul.summary').first().toggle(); + } + else if (next.hasClass('summary')) { + var list = $('
        '); + list.html(next.html()); + list.find('.summary_desc, .note').remove(); + list.find('a').each(function() { + $(this).html($(this).find('strong').html()); + $(this).parent().html($(this)[0].outerHTML); + }); + next.before(list); + next.toggle(); + } + }); + return false; + }); + if (localStorage.summaryCollapsed == "collapse") { + $('.summary_toggle').first().click(); + } else { localStorage.summaryCollapsed = "expand"; } +} + +function generateTOC() { + if ($('#filecontents').length === 0) return; + var _toc = $('
          '); + var show = false; + var toc = _toc; + var counter = 0; + var tags = ['h2', 'h3', 'h4', 'h5', 'h6']; + var i; + if ($('#filecontents h1').length > 1) tags.unshift('h1'); + for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; } + var lastTag = parseInt(tags[0][1], 10); + $(tags.join(', ')).each(function() { + if ($(this).parents('.method_details .docstring').length != 0) return; + if (this.id == "filecontents") return; + show = true; + var thisTag = parseInt(this.tagName[1], 10); + if (this.id.length === 0) { + var proposedId = $(this).attr('toc-id'); + if (typeof(proposedId) != "undefined") this.id = proposedId; + else { + var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_'); + if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; } + this.id = proposedId; + } + } + if (thisTag > lastTag) { + for (i = 0; i < thisTag - lastTag; i++) { + var tmp = $('
            '); toc.append(tmp); toc = tmp; + } + } + if (thisTag < lastTag) { + for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent(); + } + var title = $(this).attr('toc-title'); + if (typeof(title) == "undefined") title = $(this).text(); + toc.append('
          1. ' + title + '
          2. '); + lastTag = thisTag; + }); + if (!show) return; + html = ''; + $('#content').prepend(html); + $('#toc').append(_toc); + $('#toc .hide_toc').toggle(function() { + $('#toc .top').slideUp('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }, function() { + $('#toc .top').slideDown('fast'); + $('#toc').toggleClass('hidden'); + $('#toc .title small').toggle(); + }); +} + +function navResizeFn(e) { + if (e.which !== 1) { + navResizeFnStop(); + return; + } + + sessionStorage.navWidth = e.pageX.toString(); + $('.nav_wrap').css('width', e.pageX); + $('.nav_wrap').css('-ms-flex', 'inherit'); +} + +function navResizeFnStop() { + $(window).unbind('mousemove', navResizeFn); + window.removeEventListener('message', navMessageFn, false); +} + +function navMessageFn(e) { + if (e.data.action === 'mousemove') navResizeFn(e.data.event); + if (e.data.action === 'mouseup') navResizeFnStop(); +} + +function navResizer() { + $('#resizer').mousedown(function(e) { + e.preventDefault(); + $(window).mousemove(navResizeFn); + window.addEventListener('message', navMessageFn, false); + }); + $(window).mouseup(navResizeFnStop); + + if (sessionStorage.navWidth) { + navResizeFn({which: 1, pageX: parseInt(sessionStorage.navWidth, 10)}); + } +} + +function navExpander() { + var done = false, timer = setTimeout(postMessage, 500); + function postMessage() { + if (done) return; + clearTimeout(timer); + var opts = { action: 'expand', path: pathId }; + document.getElementById('nav').contentWindow.postMessage(opts, '*'); + done = true; + } + + window.addEventListener('message', function(event) { + if (event.data === 'navReady') postMessage(); + return false; + }, false); +} + +function mainFocus() { + var hash = window.location.hash; + if (hash !== '' && $(hash)[0]) { + $(hash)[0].scrollIntoView(); + } + + setTimeout(function() { $('#main').focus(); }, 10); +} + +$(document).ready(function() { + navResizer(); + navExpander(); + createSourceLinks(); + createDefineLinks(); + createFullTreeLinks(); + searchFrameButtons(); + linkSummaries(); + summaryToggle(); + generateTOC(); + mainFocus(); +}); + +})(); diff --git a/js/full_list.js b/js/full_list.js new file mode 100644 index 0000000..59069c5 --- /dev/null +++ b/js/full_list.js @@ -0,0 +1,216 @@ +(function() { + +var $clicked = $(null); +var searchTimeout = null; +var searchCache = []; +var caseSensitiveMatch = false; +var ignoreKeyCodeMin = 8; +var ignoreKeyCodeMax = 46; +var commandKey = 91; + +RegExp.escape = function(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); +} + +function escapeShortcut() { + $(document).keydown(function(evt) { + if (evt.which == 27) { + window.parent.postMessage('navEscape', '*'); + } + }); +} + +function navResizer() { + $(window).mousemove(function(e) { + window.parent.postMessage({ + action: 'mousemove', event: {pageX: e.pageX, which: e.which} + }, '*'); + }).mouseup(function(e) { + window.parent.postMessage({action: 'mouseup'}, '*'); + }); + window.parent.postMessage("navReady", "*"); +} + +function clearSearchTimeout() { + clearTimeout(searchTimeout); + searchTimeout = null; +} + +function enableLinks() { + // load the target page in the parent window + $('#full_list li').on('click', function(evt) { + $('#full_list li').removeClass('clicked'); + $clicked = $(this); + $clicked.addClass('clicked'); + evt.stopPropagation(); + + if (evt.target.tagName === 'A') return true; + + var elem = $clicked.find('> .item .object_link a')[0]; + var e = evt.originalEvent; + var newEvent = new MouseEvent(evt.originalEvent.type); + newEvent.initMouseEvent(e.type, e.canBubble, e.cancelable, e.view, e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget); + elem.dispatchEvent(newEvent); + evt.preventDefault(); + return false; + }); +} + +function enableToggles() { + // show/hide nested classes on toggle click + $('#full_list a.toggle').on('click', function(evt) { + evt.stopPropagation(); + evt.preventDefault(); + $(this).parent().parent().toggleClass('collapsed'); + highlight(); + }); +} + +function populateSearchCache() { + $('#full_list li .item').each(function() { + var $node = $(this); + var $link = $node.find('.object_link a'); + if ($link.length > 0) { + searchCache.push({ + node: $node, + link: $link, + name: $link.text(), + fullName: $link.attr('title').split(' ')[0] + }); + } + }); +} + +function enableSearch() { + $('#search input').keyup(function(event) { + if (ignoredKeyPress(event)) return; + if (this.value === "") { + clearSearch(); + } else { + performSearch(this.value); + } + }); + + $('#full_list').after(""); +} + +function ignoredKeyPress(event) { + if ( + (event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax) || + (event.keyCode == commandKey) + ) { + return true; + } else { + return false; + } +} + +function clearSearch() { + clearSearchTimeout(); + $('#full_list .found').removeClass('found').each(function() { + var $link = $(this).find('.object_link a'); + $link.text($link.text()); + }); + $('#full_list, #content').removeClass('insearch'); + $clicked.parents().removeClass('collapsed'); + highlight(); +} + +function performSearch(searchString) { + clearSearchTimeout(); + $('#full_list, #content').addClass('insearch'); + $('#noresults').text('').hide(); + partialSearch(searchString, 0); +} + +function partialSearch(searchString, offset) { + var lastRowClass = ''; + var i = null; + for (i = offset; i < Math.min(offset + 50, searchCache.length); i++) { + var item = searchCache[i]; + var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name); + var matchString = buildMatchString(searchString); + var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i"); + if (searchName.match(matchRegexp) == null) { + item.node.removeClass('found'); + item.link.text(item.link.text()); + } + else { + item.node.addClass('found'); + item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1'); + lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2'; + item.link.html(item.name.replace(matchRegexp, "$&")); + } + } + if(i == searchCache.length) { + searchDone(); + } else { + searchTimeout = setTimeout(function() { + partialSearch(searchString, i); + }, 0); + } +} + +function searchDone() { + searchTimeout = null; + highlight(); + if ($('#full_list li:visible').size() === 0) { + $('#noresults').text('No results were found.').hide().fadeIn(); + } else { + $('#noresults').text('').hide(); + } + $('#content').removeClass('insearch'); +} + +function buildMatchString(searchString, event) { + caseSensitiveMatch = searchString.match(/[A-Z]/) != null; + var regexSearchString = RegExp.escape(searchString); + if (caseSensitiveMatch) { + regexSearchString += "|" + + $.map(searchString.split(''), function(e) { return RegExp.escape(e); }). + join('.+?'); + } + return regexSearchString; +} + +function highlight() { + $('#full_list li:visible').each(function(n) { + $(this).removeClass('even odd').addClass(n % 2 == 0 ? 'odd' : 'even'); + }); +} + +/** + * Expands the tree to the target element and its immediate + * children. + */ +function expandTo(path) { + var $target = $(document.getElementById('object_' + path)); + $target.addClass('clicked'); + $target.removeClass('collapsed'); + $target.parentsUntil('#full_list', 'li').removeClass('collapsed'); + if($target[0]) { + window.scrollTo(window.scrollX, $target.offset().top - 250); + highlight(); + } +} + +function windowEvents(event) { + var msg = event.data; + if (msg.action === "expand") { + expandTo(msg.path); + } + return false; +} + +window.addEventListener("message", windowEvents, false); + +$(document).ready(function() { + escapeShortcut(); + navResizer(); + enableLinks(); + enableToggles(); + populateSearchCache(); + enableSearch(); +}); + +})(); diff --git a/js/jquery.js b/js/jquery.js new file mode 100644 index 0000000..198b3ff --- /dev/null +++ b/js/jquery.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
      a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
      "+""+"
      ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
      t
      ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
      ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
      ","
      "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
      ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/method_list.html b/method_list.html new file mode 100644 index 0000000..52443d6 --- /dev/null +++ b/method_list.html @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + Method List + + + +
      +
      +

      Method List

      + + + +
      + + +
      + + diff --git a/top-level-namespace.html b/top-level-namespace.html new file mode 100644 index 0000000..f6508e7 --- /dev/null +++ b/top-level-namespace.html @@ -0,0 +1,344 @@ + + + + + + + Top Level Namespace + + — Sapling Documentation + + + + + + + + + + + + + + + + + + + +
      + + +

      Top Level Namespace + + + +

      +
      + + + + + + + + + + + +
      + +

      Defined Under Namespace

      +

      + + + Modules: Dialogue, Gardner, Planter + + + + Classes: Sapling + + +

      + +

      Constant Summary

      +
      + +
      SKELE_TRUNK_TEXT = +
      +
      + +

      The default trunk text of a new tree

      + + +
      +
      +
      + + +
      +
      +
      "Welcome to the Sapling Editor. For details, please see the
      +documentation!"
      + +
      SKELE_BRANCH_TEXT = +
      +
      + +

      The default first-branch text of a new tree

      + + +
      +
      +
      + + +
      +
      +
      "The first branch is always shown by default. It should act
      +as the introduction to the story. From here, the user enters your world!"
      + +
      SKELE_LEAF_TEXT = +
      +
      + +

      The default first-leaf text of the first branch of a new tree. The leaf +points to it's own branch. The only way out of the program is to either +force-quit or reply with option 0.

      + + +
      +
      +
      + + +
      +
      +
      "Each branch can have any number of leaves, which represent
      +the options a user has on that branch. Each leaf points to another branch, or
      +can point to branch 0 to immediately exit."
      + +
      SKELETON_TREE = +
      +
      + +

      The final tree

      + + +
      +
      +
      + + +
      +
      +
      [
      +  {"trunk" => "#{SKELE_TRUNK_TEXT}"},
      +  {"branch" => {
      +    "number" => 1,
      +    "text" => "#{SKELE_BRANCH_TEXT}",
      +    "leaf" => [{
      +      "text" => "#{SKELE_LEAF_TEXT}",
      +      "branch" => 1
      +      }]
      +    }
      +  }
      +]
      + +
      + + + + + + + + +

      + Instance Method Summary + collapse +

      + + + + + + +
      +

      Instance Method Details

      + + +
      +

      + + #verify_tree(file) ⇒ Boolean + + + + + +

      +
      + +

      Verify that a file is a dialogue tree file.

      + + +
      +
      +
      +

      Parameters:

      +
        + +
      • + + file + + + (File) + + + + — +
        +

        The provided file

        +
        + +
      • + +
      + +

      Returns:

      +
        + +
      • + + + (Boolean) + + + + — +
        +

        True if the file is a tree; false otherwise

        +
        + +
      • + +
      + +
      + + + + +
      +
      +
      +
      +43
      +44
      +45
      +46
      +47
      +48
      +49
      +50
      +51
      +52
      +53
      +54
      +55
      +56
      +57
      +58
      +
      +
      # File 'lib/sapling/utility.rb', line 43
      +
      +def verify_tree(file)
      +  results = []
      +  begin
      +    tree = YAML.load_file(file)
      +    results << tree[0].keys.include?("trunk")
      +    results << tree[1]["branch"].keys.include?("number")
      +    results << tree[1]["branch"].keys.include?("text")
      +    results << tree[1]["branch"].keys.include?("leaf")
      +  rescue
      +    puts "Sorry chummer, I don't think this is a tree."
      +    puts "Verify your YAML file is formatted properly."
      +    results << false
      +  end
      +
      +  results.include?(false) ? false : true
      +end
      +
      + + + + + + + + + + + \ No newline at end of file From 21355173ed6ee14c03a697861676a4f6c5b1dc66 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Sat, 14 Oct 2017 23:41:37 -0400 Subject: [PATCH 66/74] Updated website From 8700f307a7d1efd5d0bff0ab96b16385fd8bb10b Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Wed, 18 Oct 2017 23:46:00 -0400 Subject: [PATCH 67/74] sapling.rb: Rubocop and refactor updates - Fix several rubocop violations - Update functionality to account for gardner refactor --- lib/sapling.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index 2025207..eef7142 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -8,19 +8,20 @@ Dir[File.join(__dir__, 'sapling', '*.rb')].each { |file| require file } # The main Sapling interface. class Sapling < Thor desc 'read TREE', 'Load and traverse the TREE' - def read(tree) - exit unless verify_tree(tree) + def read(file) puts 'Welcome to Sapling, a Dialogue Tree Utility.' - speaker = Dialogue::Speaker.new(YAML.load_file(tree), false) + exit unless verify_tree(file) + tree = Gardner::Plot.new(YAML.load_file(file), false) + speaker = Dialogue::Speaker.new(tree) speaker.conversation end desc 'edit TREE', 'Edit a new or existing TREE' - def edit(tree = '') + def edit(file = '') puts 'Welcome to Sapling, a Dialogue Tree Utility.' if !tree.empty? - puts "Loading tree: #{tree}" - exit unless verify_tree(tree) + puts "Loading tree: #{file}" + exit unless verify_tree(file) gardner = Planter::Spade.new(YAML.load_file(tree, false)) else puts 'Creating a new tree!' From 6e16b250a5839765437290f4021f43aae5306e8c Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Wed, 18 Oct 2017 23:46:52 -0400 Subject: [PATCH 68/74] gardner.rb: Rubocop fixes and refactor changes - Fix several rubocop problems - Update module to more fully encapsulate all dialogue tree handling - Add Plot class for storing all tree data - Add Digiplot class for (eventual) tree editing --- lib/sapling/gardner.rb | 116 +++++++++++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/lib/sapling/gardner.rb b/lib/sapling/gardner.rb index e6184bf..1512076 100644 --- a/lib/sapling/gardner.rb +++ b/lib/sapling/gardner.rb @@ -2,47 +2,95 @@ require 'yaml' # Gardner is the module for working with a dialogue tree file module Gardner + # The Plot class handles a specific tree file. It provides functionality for + # parsing trunks and branches, and provides these as class attributes. + class Plot + # The trunk and branches instance variables + attr_reader :branches, :tree, :trunk - # Parse the tree array into an array of numbered branches, and ordered leaves. - # - # @param tree [Array] The dialogue tree - # @return [Array] An array of numbered branches, with numbered leaves - def self.prune_branches(tree) - branches = { 0 => { "desc" => "Thanks for using Sapling!" } } - tree.each do |b| - branches[b["branch"]["number"]] = { - "desc" => b["branch"]["text"], - "options" => prune_leaves(b["branch"]["leaf"]) } + # Initialize a new Plot from a tree file + # + # @param tree [File] The dialogue tree file + def initialize(file) + @tree = file + prune_trunk + prune_branches end - return branches - end - - # Parse the leaves of a branch into a numbered hash of options. - # - # @param leaves [Array] The option of leaf hashes - # @return [Hash] A numbered hash of options - def self.prune_leaves(leaves) - x = 1 - options = {} - - return options if leaves.nil? - - leaves.each do |l| - options[x] = { l["text"] => l["branch"] } - x += 1 + # Parse the tree array into an array of numbered branches, and ordered + # leaves. + # + # @param tree [File] The dialogue tree + # @return [Array] An array of numbered branches, with numbered leaves + def prune_branches + @branches = { 0 => { 'desc' => 'Thanks for using Sapling!' } } + @tree.each do |b| + @branches[b['branch']['number']] = { + 'desc' => b['branch']['text'], + 'options' => prune_leaves(b['branch']['leaf']) + } + end end - return options + # Parse the leaves of a branch into a numbered hash of options. + # + # @param leaves [Array] The option of leaf hashes + # @return [Hash] A numbered hash of options + def prune_leaves(leaves) + x = 1 + options = {} + + return options if leaves.nil? + + leaves.each do |l| + options[x] = { l['text'] => l['branch'] } + x += 1 + end + + options + end + + # Parse the trunk of the tree. + # + # @return [Array] The trunk, and the remainder of the tree + def prune_trunk + @trunk = @tree.shift + end end - # Parse the trunk of the tree. - # - # @param tree [Hash] The entire tree - # @return [Array] The trunk, and the remainder of the tree - def self.prune_trunk(tree) - trunk = tree.shift + # Digiplot represents a Plot used for editing. The Digiplot functions exactly + # like a Plot, except with additional functionality for over-writing existing + # branches, leaves, and the trunk. + class Digiplot < Plot + # Duplicate the "old" trunk and branches, for restoration purposes + attr_reader :old_branches, :old_trunk - return [trunk,tree] + # Enable editing for the trunk + attr_writer :trunk + + # Initialize a Digiplot just like a Plot, but also copy the trunk and + # branches to "old" instance variables. + def initialize + super + @old_trunk = @trunk + @old_branches = @branches + end + + # Change a branch + # + # @param branch [Integer] the number of the branch to be edited + def branch=(branch, text) + @branches[branch]['desc'] = text + end + + # Change a leaf on a branch, grasshopper + # + # @param branch [Integer] the number of the branch to be edited + # @param leaf [Integer] the number of the leaf to be edited + # @param text [String] the new text for the leaf + # @param target [Integer] the branch number target for the leaf option + def leaf=(branch, leaf, text, target) + @branches[branch]['options'][leaf] = { text => target } + end end end From e85a8828511b4d888836a56c0a5005d9f396a446 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:19:14 -0400 Subject: [PATCH 69/74] dialogue.rb: Rubocop fixes and refactor changes - Fix several Rubocop problems - Update module for gardner refactor - Update all tree references to now reference Gardner::Plot object --- lib/sapling/dialogue.rb | 76 +++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 5ccc010..67fc10f 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -2,16 +2,15 @@ require_relative './gardner' # Dialogue is the module for traversing an existing tree. module Dialogue - # Format and display the trunk # # @param trunk [Hash] The trunk hash # @param debug [Boolean] The status of showing debug information - def self.display_trunk(trunk, debug=false) - 40.times { print "-" } + def self.display_trunk(trunk, debug = false) + 40.times { print '-' } puts "\n[ Trunk ]\n" if debug - puts "\n#{trunk["trunk"]}" - 40.times { print "-" } + puts "\n#{trunk['trunk']}" + 40.times { print '-' } puts "\n" end @@ -20,11 +19,11 @@ module Dialogue # @param branch [Hash] A branch data set # @param branch_no [Integer] The branch number # @param debug [Boolean] Status of showing debug information - def self.display_branch(branch, branch_no, debug=false) + def self.display_branch(branch, branch_no, debug = false) puts "\n[ Branch: #{branch_no} ]" if debug - puts "\n#{branch["desc"]}\n\n" + puts "\n#{branch['desc']}\n\n" - branch["options"].each_pair do |k,v| + branch['options'].each_pair do |k, v| puts "\t#{k}: #{v.keys[0]}" puts "\t\t[ Goes to branch #{v.values[0]} ]\n" if debug end @@ -32,30 +31,27 @@ module Dialogue # Speaker holds the functionality for going through a dialogue tree. class Speaker - # The file, which should be a dialogue tree YAML file. - attr_accessor :file + # The tree, an instance of Gardner::Plot + attr_reader :tree # Status of verbose/debug mode. True = on; false = off. - attr_accessor :debug + attr_reader :debug - def initialize(file="", debug=false) - @file = file + def initialize(tree, debug = false) + @tree = tree @debug = debug end # Conversation handles navigating the tree, until the option to end is # reached. - def conversation() - tree = Gardner.prune_trunk(@file) - - Dialogue.display_trunk(tree[0], false) - branches = Gardner.prune_branches(tree[1]) + def conversation + Dialogue.display_trunk(@tree.trunk, @debug) next_branch = 1 - until next_branch == 0 do - next_branch = talk(branches[next_branch], next_branch) + until next_branch.zero? + next_branch = talk(@tree.branches[next_branch], next_branch) end - puts "\n#{branches[0]["desc"]}" + puts "\n#{@tree.branches[0]['desc']}" exit end @@ -65,25 +61,18 @@ module Dialogue # @param branch_no [Integer] The branch number # @return [Integer] The number of the next branch def talk(branch, branch_no) - # If there are no options on this branch, we assume it's a terminal - # branch. Return 0, and end the program. - if branch["options"].empty? - puts "\n#{branch["desc"]}\n\n" - return 0 - end + return 0 if terminal?(branch) Dialogue.display_branch(branch, branch_no, @debug) response = get_response(branch) - unless response == 0 - puts "\n" - 10.times { print "*" } - puts "\n(Your choice: #{branch["options"][response].keys[0]})" - response = branch["options"][response].values[0].to_i + unless response.zero? + puts "(Your choice: #{branch['options'][response].keys[0]})" + response = branch['options'][response].values[0].to_i end - return response + response end # Get a response for the displayed branch @@ -91,20 +80,33 @@ module Dialogue # @param branch [Hash] A branch data set # @return [Integer] the next branch def get_response(branch) - valid_options = branch["options"].keys.join(", ") + valid_options = branch['options'].keys.join(', ') print "\n[#{valid_options}]> " STDOUT.flush response = STDIN.gets.chomp.to_i - until branch["options"].keys.include?(response) or response == 0 - print "[## Invalid options. " + until branch['options'].keys.include?(response) || response.zero? + print '[## Invalid options. ' print "Valid options are #{valid_options}, or 0 to exit." print "\n[#{valid_options}]> " response = STDIN.gets.chomp.to_i end - return response + response + end + + # Check if a branch is terminal + # + # @param branch [Hash] A branch data set + # @return [Boolean] true if the branch is terminal, false otherwise + def terminal?(branch) + if branch['options'].empty? + puts "\n#{branch['desc']}\n\n" + return true + end + + false end end end From bd45e60bb7b69ef89b5d9bf8248446b446891a7d Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:20:21 -0400 Subject: [PATCH 70/74] utility.rb: Rubocop fixes --- lib/sapling/utility.rb | 44 ++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/sapling/utility.rb b/lib/sapling/utility.rb index 576122a..fa5af53 100644 --- a/lib/sapling/utility.rb +++ b/lib/sapling/utility.rb @@ -7,34 +7,32 @@ # documentation. # The default trunk text of a new tree -SKELE_TRUNK_TEXT = "Welcome to the Sapling Editor. For details, please see the -documentation!" +SKELE_TRUNK_TEXT = 'Welcome to the Sapling Editor. For details, please see the +documentation!'.freeze # The default first-branch text of a new tree -SKELE_BRANCH_TEXT = "The first branch is always shown by default. It should act -as the introduction to the story. From here, the user enters your world!" +SKELE_BRANCH_TEXT = 'The first branch is always shown by default. It should act +as the introduction to the story. From here, the user enters your world!'.freeze # The default first-leaf text of the first branch of a new tree. The leaf points # to it's own branch. The only way out of the program is to either force-quit or # reply with option 0. -SKELE_LEAF_TEXT = "Each branch can have any number of leaves, which represent +SKELE_LEAF_TEXT = 'Each branch can have any number of leaves, which represent the options a user has on that branch. Each leaf points to another branch, or -can point to branch 0 to immediately exit." +can point to branch 0 to immediately exit.'.freeze # The final tree SKELETON_TREE = [ - {"trunk" => "#{SKELE_TRUNK_TEXT}"}, - {"branch" => { - "number" => 1, - "text" => "#{SKELE_BRANCH_TEXT}", - "leaf" => [{ - "text" => "#{SKELE_LEAF_TEXT}", - "branch" => 1 - }] - } - } -] - + { 'trunk' => SKELE_TRUNK_TEXT.to_s }, + { 'branch' => { + 'number' => 1, + 'text' => SKELE_BRANCH_TEXT.to_s, + 'leaf' => [{ + 'text' => SKELE_LEAF_TEXT.to_s, + 'branch' => 1 + }] + } } +].freeze # Verify that a file is a dialogue tree file. # @@ -44,13 +42,13 @@ def verify_tree(file) results = [] begin tree = YAML.load_file(file) - results << tree[0].keys.include?("trunk") - results << tree[1]["branch"].keys.include?("number") - results << tree[1]["branch"].keys.include?("text") - results << tree[1]["branch"].keys.include?("leaf") + results << tree[0].keys.include?('trunk') + results << tree[1]['branch'].keys.include?('number') + results << tree[1]['branch'].keys.include?('text') + results << tree[1]['branch'].keys.include?('leaf') rescue puts "Sorry chummer, I don't think this is a tree." - puts "Verify your YAML file is formatted properly." + puts 'Verify your YAML file is formatted properly.' results << false end From 54f23625a85009228b373d3a5cc59b1f7aa3a537 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:21:03 -0400 Subject: [PATCH 71/74] sapling.rb: Fix argument passing Accidentially moved the debug argument to the Gardner invokation, instead of leaving with the Dialogue invokation. --- lib/sapling.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sapling.rb b/lib/sapling.rb index eef7142..901094b 100644 --- a/lib/sapling.rb +++ b/lib/sapling.rb @@ -11,8 +11,8 @@ class Sapling < Thor def read(file) puts 'Welcome to Sapling, a Dialogue Tree Utility.' exit unless verify_tree(file) - tree = Gardner::Plot.new(YAML.load_file(file), false) - speaker = Dialogue::Speaker.new(tree) + tree = Gardner::Plot.new(YAML.load_file(file)) + speaker = Dialogue::Speaker.new(tree, false) speaker.conversation end From c6c9522a1840324198f46e9b1cc7145b428e6051 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:26:35 -0400 Subject: [PATCH 72/74] Update gem --- sapling-dialogue.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sapling-dialogue.gemspec b/sapling-dialogue.gemspec index 99c9d8d..d48fac4 100644 --- a/sapling-dialogue.gemspec +++ b/sapling-dialogue.gemspec @@ -1,10 +1,10 @@ Gem::Specification.new do |s| s.name = 'sapling-dialogue' - s.version = '0.1.0' + s.version = '0.1.1' s.executables << 'sapling' - s.date = '2017-10-14' + s.date = '2017-10-19' s.summary = 'A Dialogue Tree Utility' - s.description = 'Create, edit, and traverse Dialogue trees' + s.description = 'Create, edit, and traverse dialogue trees' s.authors = ['Bill Niblock'] s.email = 'azulien@gmail.com' s.files = Dir['lib/**/*.rb'] + Dir['bin/*'] From ce2eb89b4487781f604fa7104782603f7219f774 Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:44:41 -0400 Subject: [PATCH 73/74] dialogue.rb: Rubocop ABC fixes --- lib/sapling/dialogue.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/sapling/dialogue.rb b/lib/sapling/dialogue.rb index 67fc10f..f981f52 100644 --- a/lib/sapling/dialogue.rb +++ b/lib/sapling/dialogue.rb @@ -84,16 +84,15 @@ module Dialogue print "\n[#{valid_options}]> " STDOUT.flush - response = STDIN.gets.chomp.to_i + response = STDIN.gets.chomp - until branch['options'].keys.include?(response) || response.zero? - print '[## Invalid options. ' - print "Valid options are #{valid_options}, or 0 to exit." - print "\n[#{valid_options}]> " - response = STDIN.gets.chomp.to_i + until valid_options.include?(response) || response.to_i.zero? + print "[## Invalid options. Valid options are #{valid_options}," \ + "or 0 to exit.\n[#{valid_options}]> " + response = STDIN.gets.chomp end - response + response.to_i end # Check if a branch is terminal From a85673673959c575624634407a33817e0e05023f Mon Sep 17 00:00:00 2001 From: Bill Niblock Date: Thu, 19 Oct 2017 00:48:15 -0400 Subject: [PATCH 74/74] Update Gem -> Version 0.1.2 --- sapling-dialogue.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapling-dialogue.gemspec b/sapling-dialogue.gemspec index d48fac4..3aebab3 100644 --- a/sapling-dialogue.gemspec +++ b/sapling-dialogue.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'sapling-dialogue' - s.version = '0.1.1' + s.version = '0.1.2' s.executables << 'sapling' s.date = '2017-10-19' s.summary = 'A Dialogue Tree Utility'