Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLPageAssembler #313

Open
cxbrooks opened this issue Jul 19, 2012 · 1 comment
Open

HTMLPageAssembler #313

cxbrooks opened this issue Jul 19, 2012 · 1 comment
Assignees
Labels

Comments

@cxbrooks
Copy link
Member

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#516
From: Elizabeth Latronico <[email protected]>
Reported version: 9.1.devel
CC: [email protected]

Blocker for: BZ#515

@cxbrooks
Copy link
Member Author

HTMLPageAssembler

  • Read through idea from Prof. Lee (below)

  • Ideally, use parser on input file and input content from ports
    -- Create DOM (document object model) from input file
    -- Create new objects from content on ports
    -- Insert new objects into DOM from input file
    -- Look at XMLToken.java and XMLParser.java – already has an XMLParser implemented. Does the XMLParser work on HTML as well? Need DTD (document type definition) for HTML? (Should be a standard one).

  • Look at ExportHTMLAction.java, HTMLModelExporter.java and WebExporter, WebExportable interface
    -- HTMLPageAssembler should implement WebExporter interface
    -- Class diagram checked in under /org/ptango/ptolemy/doc
    -- User would add named input ports and would specify a template file (i.e. class would have a FileParameter variable for the user to specify a file).
    -- Template file is assumed to have some named

    elements

-- Actor would have one output port; complete HTML page would be produced on this output port -- Check for mismatches. Extra
s OK, ports that don’t match any
are a problem -> throw exception -- Create model for energy plus demo using new actor, that allows editing of the parameters for the state machine transitions. Template file would look something like this:

-----Original Message-----
From: Edward A. Lee [mailto:eal@ eecs.berkeley.edu]
Sent: Tuesday, June 12, 2012 12:00 PM
To: Latronico Elizabeth (CR/RTC3.1-NA)
Cc: ptango@ chess.eecs.berkeley.edu
Subject: Re: [Ptango] Web server open issues

I think the way to deal with (8) is:

 Enhance the "export to web" capability (and hence the
 HTMLModelExporter actor) to have a "templatePage"
 parameter. If provided, this template page should
 provide <div id="..."> ... </div> blocks
 and the web exporter will put things there.
 A template should include at least ids end, head,
 and start, probably, although we can just say that
 if you use a template that does not include these,
 then those parts of the HTML will not be generated.

 This requires changing the HTMLTextPosition
 attribute, which currently says:
  • anything_else: Put the text in a separate HTML file
  • named anything_else.
 I think this functionality of sending things to a separate file
 is not really needed, since models can do that anyway with
 a FileWrite actor.  I'm not sure whether any demos use this,
 but I doubt it.  I'll update the documentation now so we don't
 build demos relying on it.

I can tackle the above... I think the write way to do it
is with JavaScript, not with line-by-line parsing parsing
of the HTML template, as currently done in HttpCompositeServiceProvider.
An alternative would be to put in a full HTML parser,
which might actually be a cleaner solution. I'm not sure,
but I suspect that this will require the template to be
not just HTML, but also proper XML (meaning, for example,
that every

has to be terminated with a

).

Actually, if we take the HTML parser approach, then we can provide
another actor:

HTMLPageAssembler: Create input ports with arbitrary names, say
"foo", and provide a template HTML with, say,

,
and the actor inserts the string provided on input foo into
the
block.

The code for this actor could then be reused by the Export to
Web infrastructure.

Thoughts about this?

Edward

@cxbrooks cxbrooks self-assigned this May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant