Short answer: Never (!) copy/paste code into your documentation - as it will be outdated before you hit the save key.
Longer answer (for AsciiDoc):
You can include code fragments be the following scheme:
Instead of explicitely giving the line numbers in the include statements, you can annotate the corresponding source files with comment tags, as shown in the following example:
and then reference this snippet in your documentation as follows: