RvonMassow / xDoc

Xtext documentation Language
33 stars 15 forks source link

The formatting of code fragments is mysterious and unusable (losing carriage returns and indents) in certain conditions #94

Open ainslec opened 10 years ago

ainslec commented 10 years ago

This issue is related to an issue where line feeds and indent levels are lost when certain code is used in a code block.

I enclose a sample .xdoc file and a png image of the html layout (Eclipse Help html format) as it appears. All indents in this example are in the form of tab characters.

_test_bad_codeformatting.xdoc

document[Test]

chapter:One[Test Chapter]

section[Test Section]

code[

# This is a template -- please review every value as per requirement.

one : two {

    ############################
    #    Test                  #
    ############################

    three   = 
    four    = 

    five {

    }

    six \[\] {

        seven : eight {

        }

    }

    ############################
    #      Test 2              #
    ############################

    nine = ten
}

]

This formatting problem has rendered xdoc unusable for my use-case and so I am currently working on a solution to this problem whilst retaining backwards compatibility with the current behaviour.

The answer to this I think is to modify the syntax of a code block so that the user can optionally specify raw whitespace mode (no manual manipulation of indents or whitespace).

xdoc bad format

NOTE : I am currently working on a solution for this issue

ainslec commented 10 years ago

When you have time, please take a look at pull request 95. There are lots of lines in the changed, but if you ignore the lexer/parser changes, it should be quick to review. It is the addition of the 'raw' attribute in the CodeBlock model item, and if true, then use the raw user text rather than reformat / intelligently indent.