Description

You can toggle line numbers in print preview.

And what's the bug exactly?

Details

This Wiki.

Discussion

-- OliverSiemoneit 2006-11-19 12:27:34 :

/!\ Sometimes someone wants to embed rendered markup into an other application.

Patch

-- OliverSiemoneit 2006-11-19 20:44:39 : If you use some up-to-date-browser and you are annoyed that "toogle line numbers" is still printed out, try this:

Patch  MoinMoin/theme/__init__.py  (moin 1.5.4-1) as follows:

--- old__init__.py      2006-11-19 21:06:52.000000000 +0100
+++ __init__.py 2006-11-19 20:56:30.000000000 +0100
@@ -83,7 +83,7 @@
     stylesheets_print = (
         # media         basename
         ('all',         'common'),
-        ('all',         'print'),
+        ('all',         'print_ext'),
         )
 
     # Used in slide show mode

Make a copy of print.css and rename it to print_ext.css. You should now have common.css, screen.css, print.css, print_ext.css and projection.css in your themes css folder.

Add to print_ext.css /!\ the following lines:

.codenumbers {
    display: none;
} 

Note: you have to do that for all the themes you intend to use.

Now you can start. E.g. go to SyntaxReference and toggle line numbers as you want. Instead of choosing "printview" in the actions menu, choose print or printpreview in your browsers menu (on most modern browser [not IE] you do not need to call action=print! as far as I can see). In print or printpreview you can now see: There is no text "toggle line numbers" anymore and line numbers a printed out or not as you have choosen on the screen view (Note: This does not work with IE7. Here line numbers are always printed. Thanks MS-guys for that. Works great on Opera and Firefox!)

If you have an archaic browser, you have to use the action=print to get the print view. There is no way to prevent the text "toggle line numbers" from getting printed out. But at least you are able to choose whether to have line numbers or not.

Annotation: You can do the same for the "Show top/bottom links in headings". Therefore you have to provide a css class for the up and down arrows (e.g. css="updown_arrows") in formatter/text_html.py

# TODO: convert this to readable code
        if self.request.user.show_topbottom:
            # TODO change top/bottom refs to content-specific top/bottom refs?
            result = ("%s%s%s%s%s%s%s%s" %
                      (result,
                       kw.get('icons', ''),
                       self.url(1, url="#bottom", css="updown_arrows", do_escape=0),
                       self.icon('bottom'),
                       self.url(0),
                       self.url(1, url="#top", css="updown_arrows", do_escape=0),
                       self.icon('top'),
                       self.url(0)))
        return "%s%s%s" % (result, kw.get('icons', ''), number)show_

In print_ext.css you can then deactivate them by:

.updown_arrows {
    display: none;
} 

Plan


CategoryMoinMoinBugFixed CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/ToggleLineNumbersInPrintPreview (last edited 2007-10-29 19:11:57 by localhost)