Skip to content
This repository
Browse code

Fixed utf related highlighter crash [fixes #22]

  • Loading branch information...
commit 8829c572fd8238e3621b1925c76665419f9b48b9 1 parent 0a5fd47
Adam Moore authored
4 bin/yuidoc_highlight.py
@@ -17,6 +17,7 @@
17 17 from pygments.lexers import JavascriptLexer
18 18 from pygments.lexers import PhpLexer
19 19 from pygments.formatters import HtmlFormatter
  20 +import codecs
20 21
21 22 try:
22 23 logging.config.fileConfig(os.path.join(sys.path[0], LOGCONFIG))
@@ -51,7 +52,8 @@ def highlightString(src):
51 52
52 53 def highlightFile(path, file):
53 54 f=open(os.path.join(path, file))
54   - fileStr=StringIO(f.read()).getvalue()
  55 + fileStr = codecs.open( os.path.join(path, file), "r", "utf-8" ).read()
  56 +
55 57 f.close()
56 58 log.info("highlighting " + file)
57 59
30 test/dd.sh
... ... @@ -0,0 +1,30 @@
  1 +#!/bin/sh
  2 +
  3 +##############################################################################
  4 +
  5 +# The location of your yuidoc install
  6 +# yuidoc_home=yahoo/presentation/tools/yuidoc
  7 +# yuidoc_home=~/www/yuidoc/yuidoc
  8 +yuidoc_home=..
  9 +
  10 +src=~/src/yui3/src
  11 +
  12 +parser_in="$src/dd/js"
  13 +
  14 +# The location to output the parser data. This output is a file containing a
  15 +# json string, and copies of the parsed files.
  16 +parser_out=build_tmp/yuidoc_tmp
  17 +
  18 +# The directory to put the html file outputted by the generator
  19 +generator_out=build_tmp/api
  20 +
  21 +# The location of the template files. Any subdirectories here will be copied
  22 +# verbatim to the destination directory.
  23 +template=$yuidoc_home/template
  24 +
  25 +version="localtest"
  26 +
  27 +##############################################################################
  28 +
  29 +$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -s $*
  30 +
30 test/intl.sh
... ... @@ -0,0 +1,30 @@
  1 +#!/bin/sh
  2 +
  3 +##############################################################################
  4 +
  5 +# The location of your yuidoc install
  6 +# yuidoc_home=yahoo/presentation/tools/yuidoc
  7 +# yuidoc_home=~/www/yuidoc/yuidoc
  8 +yuidoc_home=..
  9 +
  10 +src=.
  11 +
  12 +parser_in="$src/intl"
  13 +
  14 +# The location to output the parser data. This output is a file containing a
  15 +# json string, and copies of the parsed files.
  16 +parser_out=build_tmp/yuidoc_tmp
  17 +
  18 +# The directory to put the html file outputted by the generator
  19 +generator_out=build_tmp/api
  20 +
  21 +# The location of the template files. Any subdirectories here will be copied
  22 +# verbatim to the destination directory.
  23 +template=$yuidoc_home/template
  24 +
  25 +version="localtest"
  26 +
  27 +##############################################################################
  28 +
  29 +$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -s $*
  30 +
33 test/intl/intl.js
... ... @@ -0,0 +1,33 @@
  1 +/**
  2 + * The text module lets you format and parse text in many languages from around the world.
  3 + * <p>This module uses the following identifiers:
  4 + * <ul>
  5 + * <li><em>Languages:</em> RFC 4646 language tags, such as "en-GB" (English as used
  6 + * in the United Kingdom), "zh-Hans-CN" (simpified Chinese as used in China).
  7 + * <li><em>Time zones:</em> tz database identifiers, such as "Europe/Berlin"
  8 + * (time zone of Germany), "America/Los_Angeles" (Pacific time zone in the United States),
  9 + * "Asia/Kolkata" (time zone of India).
  10 + * </ul>
  11 + * @module text
  12 + * @requires yahoo, json
  13 + */
  14 +
  15 +/**
  16 + * Provides functionality for formatting date and time information.
  17 + * @class DateFormat
  18 + * @namespace YAHOO.text
  19 + * @constructor
  20 + * @param {Style | Style[] | String} style Style constant or pattern string for the desired date format.
  21 + * @param {String} language The RFC 4646 language tag for the language of the date format.
  22 + * @param {String} timeZone <b>future</b> The tz database identifier for the time zone of the date format.
  23 + * Optional - the browser time zone is used by default.
  24 + */
  25 +
  26 + /**
  27 + * <b>future</b> Calendar month format. Examples:
  28 + * <ul>
  29 + * <li>June 2009
  30 + * <li>2009年6月
  31 + * </ul>
  32 + * @property CALENDAR_MONTH
  33 + */
30 test/json.sh
... ... @@ -0,0 +1,30 @@
  1 +#!/bin/sh
  2 +
  3 +##############################################################################
  4 +
  5 +# The location of your yuidoc install
  6 +# yuidoc_home=yahoo/presentation/tools/yuidoc
  7 +# yuidoc_home=~/www/yuidoc/yuidoc
  8 +yuidoc_home=..
  9 +
  10 +src=~/src/yui3/src
  11 +
  12 +parser_in="$src/io/js $src/json/js"
  13 +
  14 +# The location to output the parser data. This output is a file containing a
  15 +# json string, and copies of the parsed files.
  16 +parser_out=build_tmp/yuidoc_tmp
  17 +
  18 +# The directory to put the html file outputted by the generator
  19 +generator_out=build_tmp/api
  20 +
  21 +# The location of the template files. Any subdirectories here will be copied
  22 +# verbatim to the destination directory.
  23 +template=$yuidoc_home/template
  24 +
  25 +version=test
  26 +
  27 +##############################################################################
  28 +
  29 +$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -v $version -s $*
  30 +

0 comments on commit 8829c57

Please sign in to comment.
Something went wrong with that request. Please try again.