From 3c1c12ceeba3e1b5c69f2834674cd4b05a59b9eb Mon Sep 17 00:00:00 2001 From: cynthia <7065188-licynthiax@users.noreply.gitlab.com> Date: Mon, 11 Apr 2022 15:41:22 -0700 Subject: [PATCH] readme and license --- LICENSE | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 50 ++++++++++++++++++++++++++++++++ src/main.rs | 19 +++++++++---- 3 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2ee1c21 --- /dev/null +++ b/LICENSE @@ -0,0 +1,82 @@ +My Dear Hawthorne, -- People think that if a man has undergone any hardship, he +should have a reward; but for my part, if I have done the hardest possible day's +work, and then come to sit down in a corner and eat my supper comfortably -- +why, then I don't think I deserve any reward for my hard day's work -- for am I +not now at peace? Is not my supper good? My peace and my supper are my reward, +my dear Hawthorne. So your joy-giving and exultation-breeding letter is not +my reward for my ditcher's work with that book, but is the good goddess's +bonus over and above what was stipulated -- for for not one man in five +cycles, who is wise, will expect appreciative recognition from his fellows, +or any one of them. Appreciation! Recognition! Is Jove appreciated? Why, +ever since Adam, who has got to the meaning of this great allegory -- the +world? Then we pygmies must be content to have our paper allegories but ill +comprehended. I say your appreciation is my glorious gratuity. In my proud, +humble way, -- a shepherd-king, -- I was lord of a little vale in the +solitary Crimea; but you have now given me the crown of India. But on trying +it on my head, I found it fell down on my ears, notwithstanding their +asinine length -- for it's only such ears that sustain such crowns. + +Your letter was handed me last night on the road going to Mr. Morewood's, and I +read it there. Had I been at home, I would have sat down at once and answered +it. In me divine maganimities are spontaneous and instantaneous -- catch them +while you can. The world goes round, and the other side comes up. So now I can't +write what I felt. But I felt pantheistic then -- your heart beat in my ribs and +mine in yours, and both in God's. A sense of unspeakable security is in me this +moment, on account of your having understood the book. I have written a wicked +book, and feel spotless as the lamb. Ineffable socialities are in me. I would +sit down and dine with you and all the gods in old Rome's Pantheon. It is a +strange feeling -- no hopefulness is in it, no despair. Content -- that is it; +and irresponsibility; but without licentious inclination. I speak now of my +profoundest sense of being, not of an incidental feeling. + +Whence come you, Hawthorne? By what right do you drink from my flagon of life? +And when I put it to my lips -- lo, they are yours and not mine. I feel that the +Godhead is broken up like the bread at the Supper, and that we are the pieces. +Hence this infinite fraternity of feeling. Now, sympathizing with the paper, my +angel turns over another page. you did not care a penny for the book. But, now +and then as you read, you understood the pervading thought that impelled the +book -- and that you praised. Was it not so? You were archangel enough to +despise the imperfect body, and embrace the soul. Once you hugged the ugly +Socrates because you saw the flame in the mouth, and heard the rushing of the +demon, -- the familiar, -- and recognized the sound; for you have heard it in +your own solitudes. + +My dear Hawthorne, the atmospheric skepticisms steal into me now, and make me +doubtful of my sanity in writing you thus. But, believe me, I am not mad, most +noble Festus! But truth is ever incoherent, and when the big hearts strike +together, the concussion is a little stunning. Farewell. Don't write a word +about the book. That would be robbing me of my miserly delight. I am heartily +sorry I ever wrote anything about you -- it was paltry. Lord, when shall we be +done growing? As long as we have anything more to do, we have done nothing. +So,now, let us add Moby Dick to our blessing, and step from that. Leviathan is +not the biggest fish; -- I have heard of Krakens. + +This is a long letter, but you are not at all bound to answer it. Possibly, if +you do answer it, and direct it to Herman Melville, you will missend it -- for +the very fingers that now guide this pen are not precisely the same that just +took it up and put it on this paper. Lord, when shall we be done changing? Ah! +it's a long stage, and no inn in sight, and night coming, and the body cold. But +with you for a passenger, I am content and can be happy. I shall leave the +world, I feel, with more satisfaction for having come to know you. Knowing you +persuades me more than the Bible of our immortality. + +What a pity, that, for your plain, bluff letter, you should get such gibberish! +Mention me to Mrs. Hawthorne and to the children, and so, good-by to you, with +my blessing. + +Herman. + +P.S. I can't stop yet. If the world was entirely made up of Magians, I'll tell +you what I should do. I should have a paper-mill established at one end of the +house, and so have an endless riband of foolscap rolling in upon my desk; and +upon that endless riband I should write a thousand -- a million -- billion +thoughts, all under the form of a letter to you. The divine magnet is on you, +and my magnet responds. Which is the biggest? A foolish question -- they are +One. + +H. + +P.P.S. Don't think that by writing me a letter, you shall always be bored with +an immediate reply to it -- and so keep both of us delving over a writing-desk +eternally. No such thing! I sh'n't always answer your letters, and you may do +just as you please. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4c6621d --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# details + +this is a tiny twine-like gamemaking tool using the html details tag. + +## how to use + +to use this tool, you'll need rustc and cargo, which you can download [at the rustlang website](https://rust-lang.org). clone this repo, navigate to it, and run + +``` +cargo run path/to/detail/file +``` + +to generate an html file. + +(sorry you have to download a whole programming language to compile ~200 lines of code. tk: web tool to facilitate this?) + +## markup + +`~title write the title of your game`: this will show up as the page title. + +`~detail start`: this is where your game will start. required. + +`~detail name of a detail`: starts a new detail passage. + +`#name of a detail#`: inserts the text wrapped in `#` as the summary of a `
` tag, and the contents of the `~detail` passage of the same name as its contents. + +`#display text~name of a detail#`: the same as above, except the text before the `~` will be displayed as the summary instead of the passage name. + +you can use markdown in passage text---whatever's supported by [the rust markdown crate](https://crates.io/crates/markdown). this is meant to be a _simple_ way of marking up passages, and wasn't built with more complex markdown features like footnotes, bibliographies, etc. in mind. + +## example .detail file: + +``` +~title cat story + +~detail start +the #cat# sat on the mat + +~detail cat +the cat was very #pretty~pet# and has green eyes + +~detail pet +you pet the cat! it _purred_ pleasantly +``` + +## inspirations/influences + +- [twine](https://twinery.org) +- [tracery](http://tracery.io) +- [soft corruptor](http://cordite.org.au/poetry/game/soft-corruptor/) diff --git a/src/main.rs b/src/main.rs index b837840..8326313 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,12 +126,19 @@ impl Detail { output += &to_html(&piece); } else { let (display, detail_to) = piece.split_once('~').unwrap_or((piece, piece)); - let expand = self.flatten(&detail_to)?; - output += "
"; - output += display; - output += ""; - output += &expand; - output += "
"; + let expand = self.flatten(&detail_to); + match expand { + Some(expand) => { + output += "
"; + output += display; + output += ""; + output += &expand; + output += "
"; + } + None => { + output += detail_to; + } + } } } Some(output)