Git Product home page Git Product logo

Comments (6)

klembot avatar klembot commented on July 17, 2024 1

Ah, my mistake. Twine 2 HTML must have an IFID! felt like a non-negotiable error in the console :)

from extwee.

videlais avatar videlais commented on July 17, 2024 1

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.

videlais avatar videlais commented on July 17, 2024

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.

klembot avatar klembot commented on July 17, 2024

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.

videlais avatar videlais commented on July 17, 2024

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.

videlais avatar videlais commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.