Comments (6)
Ah, my mistake. Twine 2 HTML must have an IFID!
felt like a non-negotiable error in the console :)
from extwee.
I'm re-opening this, as I want to revise how parsing of tw-storydata
and tw-passagedata
HTML elements is handled. Parsing should be looser for both elements and should produce more warnings rather than errors for incoming data following the pattern of "parsing is loose and compilation is strict."
from extwee.
That's a spec issue. IFID is a required attribute.
Only name
and IFID
are required, though, so I'd be okay, like with with Twine, of defaulting to "Untitled Story" for the name and generating an IFID and allowing a dev to do so on their own via an exposed method.
from extwee.
That's kind of what I mean here--what if a story is parsed with warnings, but you're required to set required attributes yourself before it's re-exported out? e.g. allow a story to be temporarily invalid so that it can be repaired in code.
from extwee.
You can parse Twine 2 HTML without the required attributes. I added the word "Warning" to the existing warnings, but it was already possible:
import { parseTwine2HTML } from 'extwee';
// Without required `name` and `ifid` attributes.
const s = `<tw-storydata></tw-storydata>`;
// Parse the HTML.
// This will generate warnings for missing `name` and `ifid` attributes.
const story = parseTwine2HTML(s);
// Convert back into HTML.
// This will generate a name, Untitled Story.
// This will generate a new IFID.
console.log(story.toTwine2HTML());
from extwee.
Parsing <tw-passagedata>
elements with missing ifid
or name
attributes will no longer throw errors; they will generate warnings and attempt to use default values.
from extwee.
Related Issues (20)
- Add documentation on CLI
- Add documentation on API
- Add CLI support for de-compiling Twine 1 HTML into Twee 3
- Add browser testing of webpacked Extwee
- Fix: Add a Extwee 2.2.0 release
- Fix: Push Extwee 2.2 to NPM
- Output attributes aren't escaped in HTML or Twee HOT 3
- Consider TypeScript types HOT 4
- Allow publishing stories without a starting passage set HOT 2
- Parsing Twine 2 HTML doesn't unescape passage text HOT 1
- Allow direct access to story passages HOT 1
- Double colons in passage text at the start of a line aren't escaped in Twee output HOT 3
- Stricter Twee output for required and optional StoryData properties
- Consider defaulting Story.zoom to 1, not 0 HOT 1
- Add: StoryFormat parsing should follow the "soft parsing" rule
- Add: Every parse and compile should reference spec or doc
- Add: All objects should be well-documented
- Add: Twine 2 Archive HTML parsing should follow the "soft parsing" rule
- Story types out of sync with changes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extwee.