Hi Edward,

Thanks for promoting my plugin! I pushed some minor fixes and introduced some new commands at rev 4b98c93.

The new commands are:

preview-expanded-body
preview-expanded-html
print-expanded-body
print-expanded-html

These supplement the existing (print|preview)-tree* commands, by reintroducing the 'expansion' mode. The tree commands perform a simple concatenation of a subtree and children to produce a flat document -- this ignores @others, << sections >>, etc. The 'expanded' commands operate on the currently selected node, and expand it by following @others, @all, << sections >>, etc, stripping any Leo directives and sentinels.

The way Qt handles printing is to send an HTML document to the print dialog. The non *-html commands wrap whatever you've chosen in some HTML wrapper code, and make it monospaced. The *-html commands assume whatever you are printing is a valid, complete HTML document, without the wrapper code from the other commands -- this allows you to stylize your output. It should work well with @rich bodies from Terry's richtext.py plugin. It seems to work without <html>, <body>, etc. tags, but otherwise needs to be valid html.

Attached is a .leo file with a few test cases. Read the <!-- comments --> at the end of the first node, and the differences should become clear.

As c.printingController is available to scripts, the printing.py plugin can be removed. It is important to keep c.printingController available, as this is the key to custom printing modes.

A future enhancement would be to make the stylesheet into an @setting in leoSettings.leo. Custom styling for printed documents should be possible without resorting to raw HTML. For now, the richtext.py plugin works for most cases, though.

-->Jake

On 4/21/2015 5:46 AM, Edward K. Ream wrote:
*Executive Summary*

- leoPrinting.py supports printing commands. Command names have changed.

- Leo's File menu now contains Print Preview and Print submenus. You can infer the new names of the print commands from this menu.

- The various *-html commands do not appear to work. Jake, please tell me what they are supposed to do.

*Details*

The code is unchanged from the printing.py plugin except for packaging:

- c.initObjects sets c.printingController = leoPrinting.PrintingController(c).

The printing /plugin /uses c.thePrintingController, so the plugin could still be used. However, there is, afaik, no difference between the core code and the plugin code. I shall soon remove the printing plugin.

- PrintController.getPublicCommands defines the association between command names and PrintController methods. Here are the new command names::

    preview-body
    preview-html
    preview-node
    preview-tree-bodies
    preview-tree-html
    preview-tree-nodes
    preview-marked-bodies
    preview-marked-html
    preview-marked-nodes

    print-body
    print-html
    print-node
    print-tree-bodies
    print-tree-html
    print-tree-nodes
    print-marked-bodies
    print-marked-html
    print-marked-nodes

Edward
--
You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
<?xml-stylesheet ekr_test ?>
<leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1"; >
<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
<globals body_outline_ratio="0.5" body_secondary_ratio="0.5">
	<global_window_position top="50" left="50" height="500" width="700"/>
	<global_log_window_position top="0" left="0" height="0" width="0"/>
</globals>
<preferences/>
<find_panel_settings/>
<vnodes>
<v t="peckj.20150421102146.1" a="E"><vh>an expanded html node</vh>
<v t="peckj.20150421102238.1"><vh>&lt;&lt; meta &gt;&gt;</vh></v>
<v t="peckj.20150421102146.2" a="E"><vh>h1</vh>
<v t="peckj.20150421102208.1"><vh>h2</vh></v>
</v>
</v>
</vnodes>
<tnodes>
<t tx="peckj.20150421102146.1">@language html
&lt;html&gt;
&lt;&lt; meta &gt;&gt;
&lt;body&gt;
@others
&lt;/body&gt;
&lt;/html&gt;

&lt;!-- calling preview-expanded-html on this produces a pretty document. --&gt;
&lt;!-- calling preview-tree-html on this produces a document with leo directives sprinkled in --&gt;
&lt;!-- calling preview-expanded-body on this produces a document of raw html --&gt;
&lt;!-- calling preview-tree-bodies on this produces a flat, ugly view of the tree (out of order) --&gt;
</t>
<t tx="peckj.20150421102146.2">&lt;h1&gt;This is a &lt;b&gt;test&lt;/b&gt;&lt;/h1&gt;
&lt;p&gt;Does it work?&lt;/p&gt;
&lt;pre&gt;Perhaps...&lt;/pre&gt;</t>
<t tx="peckj.20150421102208.1">&lt;h2&gt;whee&lt;/h2&gt;

What am I doing here?

</t>
<t tx="peckj.20150421102238.1">&lt;head&gt;&lt;title&gt;test!&lt;/title&gt;&lt;/head&gt;</t>
</tnodes>
</leo_file>

Reply via email to