Esempio n. 1
0
        public static IEnumerable<string> Convert(IEnumerable<string> inputLines)
        {
            yield return "<TAG>";

            var converter = new TextComposing.IO.AozoraBunkoTextConverter();
            var indentParser = new IndentParser();

            foreach (var line in indentParser.ReadLines(inputLines))
            {
                bool isSetIndent = indentParser.IsSetIndent;
                double textIndent = indentParser.CurrentTextIndent;
                double paragraphIndent = indentParser.CurrentParagraphIndent;

                //先頭の開始括弧に対してはさらに二分下げる。
                if (line.Length >= 1 && CharacterClasses.Cl01(new UChar(line[0])))
                {
                    isSetIndent = true;
                    textIndent += 0.5;
                }

                IExchangableText text = converter.Convert(new UString(line));

                var tag = new EdicolorTagConverter();
                text.Accept(tag);
                var result = tag.GetText();
                if (isSetIndent)
                    yield return String.Format("<IDT IL=1 UNIT=C IS={0} TS={1} BS=0.0>{2}</IDT>", textIndent, paragraphIndent, result);
                else
                    yield return result;
            }

            yield return "</TAG>";
        }
Esempio n. 2
0
        private Formatting.ParagraphModel BuildParagraph(UString line, int textIndent, int paragraphIndent)
        {
            line = ApplyLexers(line);
            var exchangableText = _converter.Convert(line);
            var paragraphStyle  = new ParagraphStyle
            {
                FontSize          = _fontSizeByPoint,
                RubyFontSizeRatio = 0.5F, //TODO: 共通化が必要
                Indent            = new ManualParagraphIndentStyle(textIndent, paragraphIndent)
            };
            var paragraph = _exchangableTextImporter.Import(exchangableText, paragraphStyle);

            return(paragraph);
        }
Esempio n. 3
0
        public static IEnumerable <string> Convert(IEnumerable <string> inputLines)
        {
            yield return("<TAG>");

            var converter    = new TextComposing.IO.AozoraBunkoTextConverter();
            var indentParser = new IndentParser();

            foreach (var line in indentParser.ReadLines(inputLines))
            {
                bool   isSetIndent     = indentParser.IsSetIndent;
                double textIndent      = indentParser.CurrentTextIndent;
                double paragraphIndent = indentParser.CurrentParagraphIndent;

                //先頭の開始括弧に対してはさらに二分下げる。
                if (line.Length >= 1 && CharacterClasses.Cl01(new UChar(line[0])))
                {
                    isSetIndent = true;
                    textIndent += 0.5;
                }

                IExchangableText text = converter.Convert(new UString(line));

                var tag = new EdicolorTagConverter();
                text.Accept(tag);
                var result = tag.GetText();
                if (isSetIndent)
                {
                    yield return(String.Format("<IDT IL=1 UNIT=C IS={0} TS={1} BS=0.0>{2}</IDT>", textIndent, paragraphIndent, result));
                }
                else
                {
                    yield return(result);
                }
            }

            yield return("</TAG>");
        }