User:Kbjarkefur

Revision as of 15:49, 18 January 2018 by Kbjarkefur (talk | contribs) (→‎List example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

About me

Pages on this wiki I frequently need:

List example

Spacing between a list and the following paragraph needs to be increased. And the indentation infront of an ordered list and a non-ordered list should be the same.

  • ul list item 1
  • ul list item 2

Not a part of the list

  1. ol list item 1
  2. ol list item 2

Not a part of the list

Strangely this works with second level bullet points

  • level 1
  • level 1
    • level 2
    • level 2

This text is not a part of the list

Example where his gets confusing where the text after the list looks like a part of the list (problem is not as big with numbered lists as the indentation is bigger, but it still looks weird)

  • The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
  • The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
  • The third purpose is that this file is the main map to the DataWork folder.

Each of these purposes are described in more detail below.

  1. The first reason is that it possible to run all code related to a project by running only one dofile. This is incredible important for replicability.
  2. The second purpose is to set up globals with folder paths that enables dynamic file paths that in turn allows multiple users run the same code, it shortens the file paths as well as making it possible to move files and folders with minimal updates to the code.
  3. The third purpose is that this file is the main map to the DataWork folder.

Each of these purposes are described in more detail below.

Code snippet example

The first example is using the regular <code> tag which is great when writing code in the middle of a sentence:

Ex.1 Use the egen function rowtotal() when aggregating variables.

However, the <code> tag is not great when writing multiple lines of code because there is a space in the formatting between the lines. It doesn't feel like a single code snippet.

Ex.2

gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0

One solution to this that I found was to use the <pre> tag. Multiple lines displays really nice (and I like the color better):

Ex.3

gen varA = .
replace varA = 1 if gender == 1
replace varA = 0 if gender == 0

However, the <pre> tag is no good for when writing code in the middle of a sentence. Ex.4 is the same code as Ex.1 but with a <pre> tag instead of a <code> tag (this was supposed to have been on one line):

Ex.4 Use the egen function

rowtotal()

when aggregating variables.


Summary and suggested solution: What I have done in my examples I uploaded today was to use <pre> for multi-line code examples and <code> for inline code examples, but as they look quite different in color I do not think it is a great solution. It won't be obvious that both are code examples. Not our top priority perhaps, but since there will be plenty of code examples we should decide on a standard for how we do this.

Both the <pre> tag and the <code> tag are HTML elements that can be formatted with CSS (I checked the page source and in the HTML they do inteed have those tags). I think Ritesh's team should be able to quite easily format one of them to look more similar to the other. The only issue would be if these tags are used as something else already somewhere on the wiki and changing them will mess up what they are also used for.

I do not like the red in the <code> tag that much as it looks like an error so I'd prefer both of them to be like the <pre> but keep both of them working as they are now in terms of position and line break.