public Formatting.ParagraphModel Import(IExchangableText text, ParagraphStyle paragraphStyle)
 {
     var visitor = new Visitor();
     visitor.BeginParagraph(_latinWordMetric, paragraphStyle);
     text.Accept(visitor);
     return visitor.EndParagraph();
 }
Exemple #2
0
        public Formatting.ParagraphModel Import(IExchangableText text, ParagraphStyle paragraphStyle)
        {
            var visitor = new Visitor();

            visitor.BeginParagraph(_latinWordMetric, paragraphStyle);
            text.Accept(visitor);
            return(visitor.EndParagraph());
        }
Exemple #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>");
        }