Re: background color experimentation...

Paul Flint <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
Greetings David Goodger,

On Mon, 13 Feb 2017, David Goodger wrote:

>> In your kind response, you make some interesting points.  I will respond
>> below.
>>
>> On Sun, 12 Feb 2017, David Goodger wrote:
>>
>>> On Fri, Feb 10, 2017 at 6:53 AM, Paul Flint <[email protected]> wrote:
>>>>
>>>> 1. Easy one - make the background color of your choice:
>>>>
>>>> .. raw:: html
>>>>
>>>>    <body style="background-color:#E6E6FA;">
>>>
>>>
>>> You don't need to use the "raw" directive for this. This can be done
>>> easily via a stylesheet:
>>> http://docutils.sourceforge.net/docs/howto/html-stylesheets.html
>>>
>>
>> Very cool.  For openers, I did not know about rst2html.py - Thanks.  BTW
>> nice style in the python code!  I could learn a thing or two from you.
>>
>> That said, my use case is that I have about 100 DVDs (Source Linux Format)
>> that I am putting up on the web. Each DVD has a page that shows the original
>> front and back cover.  What I wanted was that each of these pages display in
>> a color of the season.  My idea was to put together these DVD "base pages"
>> using a bash script (I am a registered bashist.  See http://visualbash.org
>> :^) and cycling through some seasonally appropriate pastel colors to help
>> the user differentiate between the various DVDs.
>>
>> The ".. raw" directive was wildly successful in allowing this page-by-page
>> transition.  Could I advantage myself with the css approach?
>
> You'd have to change the CSS for each page.

Actually what I got to thinking about was a way to add a 
reStructuredText element which would query the css for the appropriate 
background shade...

For example:

   SEASON   BACKGROUND
   spring = a warming color
   summer = a warm color
   fall   = a cooling color
   winter = a cool colr

The Vermont version would of course, also contain:
   Mud Season
   Black Fly Season

> I'm not sure how your raw hack works, since you should end up with
> multiple <body> elements in your output HTML, unless you also changed
> the template. This might render in browsers but it's not valid HTML.
>
Na, I checked.  It over-rode .../_static/alabaster.css

>> This experience has led me to the very disturbing conclusion that you could
>> (and maybe should) write all web pages in reStructuredText.  Should I seek
>> professional help?
>
> No, I don't think so. :-) That's what I do as well, and what many of us do.
>

Hm...

>>>> 2. Less easy one - Postprocessing the html to get the image to open in a
>>>> new tab:
>>>
>>> This has been on the to-do list for a long time, but (a) it's not a
>>> high-frequency request (yours is the first I can recall), and (b) no
>>> obviously correct solution has been proposed. The to-do list has a
>>> proposal to emulate the MoinMoin wiki's use of "^" as a prefix for
>>> this purpose.
>>
>> Interesting bit of extended notation.  I need to think if this would work...
>>
>>> If you want this for every image in all of some subset of your
>>> documents, you could create a custom Writer deriving from the HTML
>>> Writer you already use (or its Sphinx equivalent).
>>>
>>
>> My fix for this was to go directly to the resultant html and patch it there:
>>
>> <start code>
>> sphinx-build -b html ./ test ;
>> sed -i 's/><img/ target="_blank" ><img/g' test/index.html
>> <end code>
>
> That's very risky. It's adding “ target="_blank"” to any tag
> immediately before an <img> tag. Are you sure that they are all <a>
> tags, and always will be?
>
I go away with it... but I was not happy with this monster.

>> (Note what we bashists lack in finesse we make up with gusto... :^)
>
> Reminds me of:
>
>    Some people, when confronted with a problem, think "I know, I'll
> use regular expressions." Now they have two problems.
>
>    — Jamie Zawinski
>
> The same could be said about sed & awk.
>

I shall cherish this and use it with attribution not retribution...

>> Obviously the "MoinMoin" notation would go a step towards a standard wiki
>> markup language, and why not extend ourselves into this maelstrom?
>
> I'm not following you, and I'm a native English speaker. Many on this
> list are not. Repeat in plainer language please?
>

Indeed I once was before I started to program.  MoinMoin being of German 
provenance, it no doubt contains it's own markup syntax.  How much to we 
adopt?  That is my point here.

>> Finally thanks for the Venn diagram, and I expect we should get together in
>> Portland to rub antennae...  Are you up in Montreal?  I love that city!
>
> I used to live near Montreal, now I live in a suburb of the Twin
> Cities of Minnesota. It's only slightly warmer here.
>
Nice, and...


Kindest Regards,



☮ Paul Flint
(802) 479-2360 Home
(802) 595-9365 Cell

/************************************
Based upon email reliability concerns,
please send an acknowledgement in response to this note.

Paul Flint
17 Averill Street
Barre, VT
05641

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.