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

Discussion in 'Perl Misc' started by jimiwills@gmail.com, Dec 22, 2013.

  1. Guest

    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. ]]

    In article <>,
    "Jimi Wills" <???> wrote:

    > 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 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


    ---
    , Dec 22, 2013
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Attenborough
    Replies:
    22
    Views:
    2,252
    Mike Treseler
    Mar 13, 2006
  2. Stodge
    Replies:
    0
    Views:
    314
    Stodge
    Dec 22, 2009
  3. Michele Simionato

    Markdown to reStructuredText

    Michele Simionato, Feb 10, 2011, in forum: Python
    Replies:
    1
    Views:
    1,290
    Daniel Stender
    Feb 10, 2011
  4. Michael Granger
    Replies:
    14
    Views:
    156
    David Heinemeier Hansson
    Apr 16, 2004
  5. Guillaume Marcais

    Instiki / Markdown bug (another)

    Guillaume Marcais, Apr 26, 2004, in forum: Ruby
    Replies:
    3
    Views:
    102
    Guillaume Marcais
    Apr 30, 2004
Loading...

Share This Page