MediaWiki
1.23.5
|
Classes | |
class | Tokenizer |
Functions | |
def | CalculateNewBackgroundPosition (m) |
def | CalculateNewBackgroundPositionX (m) |
def | ChangeLeftToRightToLeft (lines, swap_ltr_rtl_in_url=None, swap_left_right_in_url=None) |
def | FixBackgroundPosition (line) |
def | FixBodyDirectionLtrAndRtl (line) |
def | FixCursorProperties (line) |
def | FixFourPartNotation (line) |
def | FixLeftAndRight (line) |
def | FixLeftAndRightInUrl (line) |
def | FixLtrAndRtlInUrl (line) |
def | main (argv) |
def | setflags (opts) |
def | usage () |
def cssjanus.CalculateNewBackgroundPosition | ( | m | ) |
Fixes horizontal background-position percentages. This function should be used as an argument to re.sub since it needs to perform replacement specific calculations. Args: m: A match object. Returns: A string with the horizontal background position percentage fixed. BG_HORIZONTAL_PERCENTAGE_RE.sub(FixBackgroundPosition, 'background-position: 75% 50%') will return 'background-position: 25% 50%'.
Definition at line 400 of file cssjanus.py.
def cssjanus.CalculateNewBackgroundPositionX | ( | m | ) |
Fixes percent based background-position-x. This function should be used as an argument to re.sub since it needs to perform replacement specific calculations. Args: m: A match object. Returns: A string with the background-position-x percentage fixed. BG_HORIZONTAL_PERCENTAGE_X_RE.sub(CalculateNewBackgroundPosition, 'background-position-x: 75%') will return 'background-position-x: 25%'.
Definition at line 429 of file cssjanus.py.
def cssjanus.ChangeLeftToRightToLeft | ( | lines, | |
swap_ltr_rtl_in_url = None , |
|||
swap_left_right_in_url = None |
|||
) |
Turns lines into a stream and runs the fixing functions against it. Args: lines: An list of CSS lines. swap_ltr_rtl_in_url: Overrides this flag if param is set. swap_left_right_in_url: Overrides this flag if param is set. Returns: The same lines, but with left and right fixes.
Definition at line 451 of file cssjanus.py.
References FixBackgroundPosition(), FixBodyDirectionLtrAndRtl(), FixCursorProperties(), FixFourPartNotation(), FixLeftAndRight(), FixLeftAndRightInUrl(), and FixLtrAndRtlInUrl().
Referenced by main().
def cssjanus.FixBackgroundPosition | ( | line | ) |
Fixes horizontal background percentage values in line. Args: line: A string to fix horizontal background position values in. Returns: line reformatted with the 4 part notations swapped.
Definition at line 384 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixBodyDirectionLtrAndRtl | ( | line | ) |
Replaces ltr with rtl and vice versa ONLY in the body direction. Args: line: A string to replace instances of ltr with rtl. Returns: line with direction: ltr and direction: rtl swapped only in body selector. line = FixBodyDirectionLtrAndRtl('body { direction:ltr }') line will now be 'body { direction:rtl }'.
Definition at line 273 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixCursorProperties | ( | line | ) |
Fixes directional CSS cursor properties. Args: line: A string to fix CSS cursor properties in. Returns: line reformatted with the cursor properties substituted. For example: line = FixCursorProperties('cursor: ne-resize') line will now be 'cursor: nw-resize'.
Definition at line 348 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixFourPartNotation | ( | line | ) |
Fixes the second and fourth positions in 4 part CSS notation. Args: line: A string to fix 4 part CSS notation in. Returns: line reformatted with the 4 part notations swapped. For example: line = FixFourPartNotation('padding: 1px 2px 3px 4px') line will now be 'padding: 1px 4px 3px 2px'.
Definition at line 367 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixLeftAndRight | ( | line | ) |
Replaces left with right and vice versa in line. Args: line: A string in which to perform the replacement. Returns: line with left and right swapped. For example: line = FixLeftAndRight('padding-left: 2px; margin-right: 1px;') line will now be 'padding-right: 2px; margin-left: 1px;'.
Definition at line 291 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixLeftAndRightInUrl | ( | line | ) |
Replaces left with right and vice versa ONLY within background urls. Args: line: A string in which to replace left with right and vice versa. Returns: line with left and right swapped in the url string. For example: line = FixLeftAndRightInUrl('background:url(right.png)') line will now be 'background:url(left.png)'.
Definition at line 310 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.FixLtrAndRtlInUrl | ( | line | ) |
Replaces ltr with rtl and vice versa ONLY within background urls. Args: line: A string in which to replace ltr with rtl and vice versa. Returns: line with left and right swapped. For example: line = FixLtrAndRtlInUrl('background:url(rtl.png)') line will now be 'background:url(ltr.png)'.
Definition at line 329 of file cssjanus.py.
Referenced by ChangeLeftToRightToLeft().
def cssjanus.main | ( | argv | ) |
Sends stdin lines to ChangeLeftToRightToLeft and writes to stdout.
Definition at line 554 of file cssjanus.py.
References ChangeLeftToRightToLeft(), setflags(), and usage().
Referenced by ModernTemplate.execute().
def cssjanus.setflags | ( | opts | ) |
Parse the passed in command line arguments and set the FLAGS global. Args: opts: getopt iterable intercepted from argv.
Definition at line 531 of file cssjanus.py.
References usage().
Referenced by main().
def cssjanus.usage | ( | ) |
Prints out usage information.
Definition at line 520 of file cssjanus.py.
Referenced by main(), setflags(), and UserOptions.showUsageAndExit().
|
private |
Definition at line 17 of file cssjanus.py.
|
private |
Definition at line 18 of file cssjanus.py.
cssjanus.BG_HORIZONTAL_PERCENTAGE_RE |
Definition at line 107 of file cssjanus.py.
cssjanus.BG_HORIZONTAL_PERCENTAGE_X_RE |
Definition at line 116 of file cssjanus.py.
cssjanus.BODY_DIRECTION_LTR_RE |
Definition at line 132 of file cssjanus.py.
cssjanus.BODY_DIRECTION_RTL_RE |
Definition at line 136 of file cssjanus.py.
string cssjanus.BODY_SELECTOR = r'body%s{%s' % (csslex.WHITESPACE, csslex.WHITESPACE) |
Definition at line 122 of file cssjanus.py.
string cssjanus.CHARS_WITHIN_SELECTOR = r'[^\}]*?' |
Definition at line 125 of file cssjanus.py.
string cssjanus.COLOR = r'(%s|%s)' % (csslex.NAME, csslex.HASH) |
Definition at line 87 of file cssjanus.py.
string cssjanus.COLOR_SPACE = r'%s%s' % (COLOR, csslex.SPACE) |
Definition at line 88 of file cssjanus.py.
cssjanus.COMMENT_RE = re.compile('(%s)' % csslex.COMMENT, re.I) |
Definition at line 179 of file cssjanus.py.
cssjanus.CURSOR_EAST_RE = re.compile(LOOKBEHIND_NOT_LETTER + '([ns]?)e-resize') |
Definition at line 99 of file cssjanus.py.
cssjanus.CURSOR_WEST_RE = re.compile(LOOKBEHIND_NOT_LETTER + '([ns]?)w-resize') |
Definition at line 100 of file cssjanus.py.
cssjanus.DIRECTION_LTR_RE = re.compile(r'%s(ltr)' % DIRECTION_RE) |
Definition at line 144 of file cssjanus.py.
string cssjanus.DIRECTION_RE = r'direction%s:%s' % (csslex.WHITESPACE, csslex.WHITESPACE) |
Definition at line 128 of file cssjanus.py.
cssjanus.DIRECTION_RTL_RE = re.compile(r'%s(rtl)' % DIRECTION_RE) |
Definition at line 145 of file cssjanus.py.
dictionary cssjanus.FLAGS |
Definition at line 33 of file cssjanus.py.
cssjanus.FOUR_NOTATION_COLOR_RE |
Definition at line 89 of file cssjanus.py.
cssjanus.FOUR_NOTATION_QUANTITY_RE |
Definition at line 81 of file cssjanus.py.
string cssjanus.LEFT = 'left' |
Definition at line 48 of file cssjanus.py.
Referenced by PostgresField.fromText(), and Language.getDirMark().
cssjanus.LEFT_IN_URL_RE |
Definition at line 162 of file cssjanus.py.
cssjanus.LEFT_RE |
Definition at line 152 of file cssjanus.py.
string cssjanus.LOOKAHEAD_FOR_CLOSING_PAREN |
Definition at line 71 of file cssjanus.py.
string cssjanus.LOOKAHEAD_NOT_CLOSING_PAREN |
Definition at line 69 of file cssjanus.py.
tuple cssjanus.LOOKAHEAD_NOT_OPEN_BRACE |
Definition at line 61 of file cssjanus.py.
string cssjanus.LOOKBEHIND_NOT_LETTER = r'(?<![a-zA-Z])' |
Definition at line 54 of file cssjanus.py.
string cssjanus.LTR = 'ltr' |
Definition at line 46 of file cssjanus.py.
cssjanus.LTR_IN_URL_RE |
Definition at line 170 of file cssjanus.py.
string cssjanus.NOFLIP_ANNOTATION |
Definition at line 185 of file cssjanus.py.
cssjanus.NOFLIP_CLASS_RE |
Definition at line 200 of file cssjanus.py.
cssjanus.NOFLIP_SINGLE_RE |
Definition at line 193 of file cssjanus.py.
string cssjanus.NOFLIP_TOKEN = r'\@noflip' |
Definition at line 181 of file cssjanus.py.
string cssjanus.POSSIBLY_NEGATIVE_QUANTITY = r'((?:-?%s)|(?:inherit|auto))' % csslex.QUANTITY |
Definition at line 77 of file cssjanus.py.
string cssjanus.POSSIBLY_NEGATIVE_QUANTITY_SPACE |
Definition at line 78 of file cssjanus.py.
string cssjanus.RIGHT = 'right' |
Definition at line 49 of file cssjanus.py.
Referenced by Language.getDirMark().
cssjanus.RIGHT_IN_URL_RE |
Definition at line 166 of file cssjanus.py.
cssjanus.RIGHT_RE |
Definition at line 157 of file cssjanus.py.
string cssjanus.RTL = 'rtl' |
Definition at line 47 of file cssjanus.py.
cssjanus.RTL_IN_URL_RE |
Definition at line 174 of file cssjanus.py.
bool cssjanus.SWAP_LEFT_RIGHT_IN_URL_DEFAULT = False |
Definition at line 32 of file cssjanus.py.
bool cssjanus.SWAP_LTR_RTL_IN_URL_DEFAULT = False |
Definition at line 31 of file cssjanus.py.
string cssjanus.TMP_TOKEN = '%sTMP%s' % (TOKEN_DELIMITER, TOKEN_DELIMITER) |
Definition at line 40 of file cssjanus.py.
string cssjanus.TOKEN_DELIMITER = '~' |
Definition at line 37 of file cssjanus.py.
string cssjanus.TOKEN_LINES = '%sJ%s' % (TOKEN_DELIMITER, TOKEN_DELIMITER) |
Definition at line 43 of file cssjanus.py.
string cssjanus.VALID_AFTER_URI_CHARS = r'[\'\"]?%s' % csslex.WHITESPACE |
Definition at line 68 of file cssjanus.py.