public override PassageCode PassageToCode(PassageData passage)
        {
            _input  = passage;
            _output = new PassageCode();

            // Ignore script and stylesheet passages
            if (passage.Tags.Contains("script") || passage.Tags.Contains("stylesheet"))
            {
                _output.Main = "yield break;";
                return(_output);
            }

            Code     = new GeneratedCode();
            NoOutput = false;
            if (passage.Tags.Contains("nobr"))
            {
                Code.Collapsed = true;
            }

            MatchCollection matches = rx_PassageBody.Matches(_input.Body);

            GenerateBody(matches);

            // Get final string
            string code = Code.Buffer.ToString();

            _output.Main = code;

            return(_output);
        }
示例#2
0
        public override PassageCode PassageToCode(PassageData p)
        {
            if (p is HarlowePassageData == false)
            {
                throw new NotSupportedException("HarloweTranscoder called with incompatible passage data");
            }

            StyleCounter = 0;

            _input  = (HarlowePassageData)p;
            _output = new PassageCode();
            Code    = new GeneratedCode();

            GenerateBody(_input.Tokens);

            // Get final string
            string code = Code.Buffer.ToString();

            _output.Main = code;

            return(_output);
        }