Proposed Modules: Tk::MDTextBook (renamed: Tk::MIMEApp, Tk::Markdown, Tk::MarkdownTk)


J

jimiwills

A set of modules that allow easy mixing of code types to be interpretted as
a Tk application...
The input is in MIME-multipart/mixed format, and easy entity can be markdown
(displayed formatted
in a Text with options to add Tk windows and behaviours), perl (eval()ed),
yaml (structure made available
to app) or menu in yaml (posted on main mindow).

The purpose of this is to contribute to a compiled program (for
Windows/Mac/Linux) that can run appended scripts in this format. The reason
for having this format is that resources can be included in the one file.
The Markdown stuff
is to allow easy inclusion of controls in the context of a document.


Tk::MDText - a Tk::Text that displays Markdown with Tk "tags" to include
widgets inline.

Tk::MDTextBook - a Tk::NoteBook that reads multipart document and contructs
an app (using MDTexts)

Tk::MDTextBook::Data2Tk - quick sub to make a window and give <DATA> to
Tk::MDTextBook

Does that make sense to anybody?? Here's an example:

E.g.:



use strict;
use Tk::MDTextBook::Data2Tk; # exports one sub:
data2tk;
__DATA__
MIME Version: 1.0
Content-Type: multipart/mixed; boundary=##--##--##--##--##
Title: Window Title

Here is a prologue
--##--##--##--##--##
Content-Type: application/x-ptk.markdown
Title: _Basic MarkDown
ID: Page1

# MarkDown Tk Text Thingy.

## Here is a sub-header

And a paragraph here
because I wanted to
check that it handles stuff
right over several lines.

--##--##--##--##--##
Content-Type: application/x-ptk.markdown
Title: _Tk and Scripting
ID: Page2

##### Tk windows and scripts

Here is my markdown. Here is some stuff in a preformatted block:

field label <Tk::Entry> <-- put stuff here!
another label <Tk::Entry> ... and more
and so on <Tk::Button -text="Here is some text!">

--##--##--##--##--##
Content-Type: application/x-yaml.menu

---
- _File:
- _Exit: exit
- '---' : '---'
- _Help:
- _About: MyPackage::ShowPreamble
- _Help : MyPackage::ShowEpilog

--##--##--##--##--##
Content-Type: application/x-perl

package MyPackage;

## the most useful of the following will get included in the module
itself...

sub myScriptSub {
print "Hello from script sub!\n";
}

sub getObjectList {
my @shelf = @Tk::MDTextBook::Shelf;
my $object = $shelf[$#shelf]; # get the last one!
return $object->{Objects};
}

sub getMW {
return $Tk::MDTextBook::Data2Tk::MW;
}

sub getPreamble {
return getObjectList()->{Main}->{Preamble};
}

sub getEpilog {
return getObjectList()->{Main}->{Epilog};
}

sub ShowPreamble {
getMW()->messageBox(-message=>getPreamble());
}

sub ShowEpilog {
getMW()->messageBox(-message=>getEpilog());
}

--##--##--##--##--##--
Here is the epilogue




---






[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]

Jimi Wills said:
Tk::MDText - a Tk::Text that displays Markdown with Tk "tags" to include
widgets inline.

Does that make sense to anybody?? Here's an example:

The idea sounds interesting and makes sense, but I wonder if there's a
better name for it.

I didn't immediately think of Markdown with MD in this context, but
maybe that doesn't have to be part of the name. The main feature is
including parts in a MIME format, right?

If you still settle on the name you have now, that's fine.

Good luck, :)

--
brian d foy (one of many PAUSE admins), http://pause.perl.org
PAUSE instructions: http://pause.perl.org/pause/query?ACTION=pause_04about
Archives: http://www.xray.mpe.mpg.de/mailing-lists/modules
Please send all messages back to (e-mail address removed) with no CC to me.




---

The idea sounds interesting and makes sense, but I wonder if there's a
better name for it.

Thanks, Brian.
I agree about the names...
I didn't immediately think of Markdown with MD in this context, but
maybe that doesn't have to be part of the name. The main feature is
including parts in a MIME format, right?

how about...

- instead of Tk::MDText...
Tk::Markdown - to display markdown (subset: I'm not going to try to support
inline html!)
Tk::MarkdownTk - a Tk::Markdown that also has the Tk tags functionality...
eg <Tk::Button -text="whatever">

- and instead of MDTextBook...
Tk::MIMEApp - uses MIME multipart to construct an app.

Jimi


---
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top