meludame: zombie-walking stick figure of a man with the text "must have coffee" in all caps. (Default)
meludame ([personal profile] meludame) wrote in [site community profile] dw_dev_training2013-07-24 10:53 pm

Bug 5175: Some styles need subtitles

Hi! I'm [personal profile] meludame, I usuablly dabble in styles-related bug and this is the bug write-up I did for my latest.


Some of the older DW styles do not print the page subtitle even though the option is there on the customize style page. Styles that are concerned are the following:

  • Brittle, Negatives (doesn't print the title either)
  • Skittlish Dreams, Sunday Morning, Transmogrified
Proposed fix:

Edit the layouts concerned to add in the missing feature. Edit the relevant portion of the CSS to make the change as unobtrusive as possible for the user of said styles.

References files:
Files edited:
  • For each layout, styles/$layoutname/layer.s2 (in either dw-free or dw-nonfree).

Bug Diary:

Read through core2.s2 to find the functions printing the title and subtitle of a page. Subsequently, went through each layer.s2 file to find what each styles does in the header area.

The header is masked using CSS only. Title and subtitle styling absent.
FIX: Supplement CSS.
The style overrides Page::print, prints neither title nor subtitle. Styling absent.
FIX: edit Page::print in layer.s2 to add a call to print_global_title() and print_global_subtitle(). Supplement CSS
Skittlish Dreams
The style overrides Page::print, doesn't print the subtitle. Styling insufficient.
FIX: edit Page::print in layer.s2 to add a call to print_global_subtitle(). Supplement CSS.
Sunday Morning
The style overrides Page::print, doesn't print the subtitle. Styling insufficient.
FIX: edit Page::print in layer.s2 to add a call to print_global_subtitle(). Supplement CSS.
The style overrides Page::print, doesn't print the subtitle. Styling insufficient.
FIX: edit Page::print in layer.s2 to add a call to print_global_subtitle(). Supplement CSS.

Where necessary edited the layer.s2 files to add calls to print_global_[sub|]title. Tested the result by updating the database ($LJHOME/bin/upgrading/ --run --populate). Fixed errors and typos until both title and subtitle were displaying on the page.

Tailored the CSS of each new header block in the less intrusive manner possible. Since none of the layout concerned are children of Tabulas Rasa, added any missing core2 variable used in the adequate propgroup sections (property use $prop_name;).

Once satisfied with the changes made, made the last commits and pushed the branches to my forks of dw-free and dw-nonfree using git push origin BRACH_NAME. Once that was done, made a pull request using the github web interface.

As suggested by [personal profile] ninetyd, also made list of css rules for a post for [site community profile] dw_styles explaining what to do to roll back the changes on a per user/layout basis.

#header {display: none;}
#header h1, #header h2 {dislay: none;}
Skittlish Dreams
#header h2 {display: none;}
Sunday Morning
.two-columns .module-section-two {top: 8em;}
#header h1 {padding: 1em;}
#header h2 {display: none;}
#header h2 {display: none;}

Notes, tips and assorted blooper reels:

Forgot to create a git branch in dw-nonfree before starting work on Sunday Morning and Transmogrified. Since dw-free and dw-nonfree are two different repos, bugs needing work on both require a git branch in both, else changes won't be tracked and it will be impossible to commit part of the changes made. Since I still had the files open in my editor, and had made little alteration to them, I was able to backtrack my changes, save them to their initial state and create the git branch before restoring my changes.

When making styles changes it is a good idea to prepare a post to [site community profile] dw_styles to explain how to revert back the changes on a per user/style basis.

When pushing changes to one's repo, one must:

  1. Be at the root of one's local copy of the repo (for ex ~/dw on a dreamhack)
  2. Make sure to be in the branch you want to push (check using git status and if needed use git checkout BRANCH_NAME
  3. Use the following command git push origin BRANCH_NAME

When wanting to update my dreamhack I ran into a slight snafu: my script wouldn't run. I asked for help on IRC and [personal profile] geekosaur explained the problem:

[personal profile] geekosaur: The problem is that DOS/Windows and Unix have different conventions for end of line. That ^M in your error is a symptom of it.
Unix uses control-J, windows uses control-M + control-J so a windows file on unix looks like it has an extra control-M at the end of every line, which if you're lucky is visible as such and if you're not just moves the cursor to the far left of the terminal.

You can convert such files using the command fromdos -b <filepath>.

I found it useful to keep notes of what I did while working on the bug (answers given in IRC, documents and files I consulted, what I did, especially when I messed up with the solution/fix to that if possible) in a markdown formatted text file. It made writing this entry easier.

Resist the temptation to make changes un related to your bugs. It's hard but it's better to either file a new bug if it doesn't exist, or grab the existing one to work on it later. I kept track of the issues I saw in a separate text file.


I would like to thank the members of #dreamwidth and in particular (but non-exhaustively) [personal profile] sophie, [personal profile] kaberett, [personal profile] geekosaur, [personal profile] momijizukamori and [personal profile] ninetyd for their coaching, cheering and reassurances as I worked my way through this bug. Y'all are amazing :)

Note: Another copy of this entry lives in my journal.

kaberett: Overlaid Mars & Venus symbols, with Swiss Army knife tools at other positions around the central circle. (Default)

[personal profile] kaberett 2013-07-24 09:44 pm (UTC)(link)
Woo! Thank you for posting this, and thanks again on a very personal level for having got this fix sorted :D
ninetydegrees: Drawing: a girl's face, with a yellow and green stripe over one eye (Default)

[personal profile] ninetydegrees 2013-07-24 09:51 pm (UTC)(link)
This is fantastic!
aveleh: Close up picture of a vibrantly coloured lime (Default)

[personal profile] aveleh 2013-07-24 11:02 pm (UTC)(link)
This is such a great write-up! And bug-fix and everything :)
denise: Image: Me, facing away from camera, on top of the Castel Sant'Angelo in Rome (Default)

[staff profile] denise 2013-07-24 11:09 pm (UTC)(link)
I love it when people write walkthroughs and work notes like this! Thank you for doing it :)
alierak: (Default)

[personal profile] alierak 2013-07-25 12:32 am (UTC)(link)
Cool, thanks for doing this. FYI your links to core2 are missing an ampersand between "550" and "fmt" (I noticed, because I happened to write my very first S2 layer the other day for Bug 4444 and wanted to see how other people linked to these things).
momijizukamori: Grey tabby cat with paws on keyboard and mouse. The text reads 'code cat is on the job', lolcats-style (CODE CAT)

[personal profile] momijizukamori 2013-07-25 06:39 am (UTC)(link)
Yay! Thank you for taking it on!
liv: Stylised sheep with blue, purple, pink horizontal stripes, and teacup brand, dreams of Dreamwidth (sheeeep)

[personal profile] liv 2013-07-25 08:24 am (UTC)(link)
Gosh, this is a really awesome write-up! And awesome bugfix too, I always shy away from the ones that involve combing through all the old styles, but this really needed fixing. Many thanks!