forked from amazingfate/help
regression from...
commit 6614bedceadcc07ec082c5e926107f27903bda5c
Date: Mon Jan 25 20:07:10 2016 +0100
fix validation errors by round-trip through helpauthoring extension
with git show 6614bedceadcc07ec082c5e926107f27903bda5c | ~/recoverindent.py
import fileinput
import re
import sys
added = []
removed = []
filename = ""
def processlastfile(filename, added, removed):
if len(added) != len(removed):
print "BROKEN"
sys.exit(-2)
if len(removed):
f = open(filename, "rw")
linestring = open(filename, "r").read()
start = 0
for x in range(0, len(added)):
if added[x] == removed[x]:
continue
if added[x].strip() != removed[x].strip():
print "BROKEN"
sys.exit(-2)
if filename == "source/text/sbasic/shared/03080301.xhp" and x == 6:
print "skipping special hunk", removed[x], "in source/text/sbasic/shared/03080301.xhp"
else:
start = linestring.find(added[x], start)
if start == -1:
print "BROKEN"
sys.exit(-2)
linestring = linestring[0:start] + removed[x] + linestring[start + len(added[x]):]
start = start + len(removed[x])
open(filename, "w").write(linestring)
for line in fileinput.input():
if line.startswith("--- a/"):
if filename is not "":
processlastfile(filename, added, removed)
added = []
removed = []
filename = line[6:-1]
elif "role=\"bascode\"" in line:
m = re.search('>(.+?)<', line)
code = m.group(1)
if line.startswith("-"):
removed.append(code)
else:
added.append(code)
processlastfile(filename, added, removed)
which puts the code back the way it was, except for one string
which had changed and was fixed manually afterwards
Change-Id: Ic67abf36bb5d27be58a51ebbf5022830f56dcb37
103 lines
7.8 KiB
XML
103 lines
7.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<helpdocument version="1.0">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
-->
|
|
|
|
<meta>
|
|
<topic id="textsbasicshared03090201xml" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">Do...Loop Statement [Runtime]</title>
|
|
<filename>/text/sbasic/shared/03090201.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
|
|
<body>
|
|
|
|
|
|
<section id="doloop">
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id3156116">
|
|
<bookmark_value>Do...Loop statement</bookmark_value>
|
|
<bookmark_value>While; Do loop</bookmark_value>
|
|
<bookmark_value>Until</bookmark_value>
|
|
<bookmark_value>loops</bookmark_value>
|
|
</bookmark>
|
|
|
|
|
|
<paragraph id="hd_id3156116" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03090201.xhp" name="Do...Loop Statement [Runtime]">Do...Loop Statement [Runtime]</link></paragraph>
|
|
<paragraph id="par_id3109850" role="paragraph" xml-lang="en-US">Repeats the statements between the Do and the Loop statement while the condition is True or until the condition becomes True.</paragraph>
|
|
</section>
|
|
|
|
<paragraph id="hd_id3149119" role="heading" level="2" xml-lang="en-US">Syntax</paragraph>
|
|
<paragraph id="par_id3155150" role="paragraph" xml-lang="en-US">Do [{While | Until} condition = True]</paragraph>
|
|
<paragraph id="par_id3154422" role="paragraph" xml-lang="en-US">statement block</paragraph>
|
|
<paragraph id="par_id3150789" role="paragraph" xml-lang="en-US">[Exit Do]</paragraph>
|
|
<paragraph id="par_id3155805" role="paragraph" xml-lang="en-US">statement block</paragraph>
|
|
<paragraph id="par_id3145090" role="paragraph" xml-lang="en-US">Loop</paragraph>
|
|
<paragraph id="par_id3154749" role="paragraph" xml-lang="en-US">or</paragraph>
|
|
<paragraph id="par_id3150503" role="paragraph" xml-lang="en-US">Do</paragraph>
|
|
<paragraph id="par_id3149762" role="paragraph" xml-lang="en-US">statement block</paragraph>
|
|
<paragraph id="par_id3150984" role="paragraph" xml-lang="en-US">[Exit Do]</paragraph>
|
|
<paragraph id="par_id3143228" role="paragraph" xml-lang="en-US">statement block</paragraph>
|
|
<paragraph id="par_id3149235" role="paragraph" xml-lang="en-US">Loop [{While | Until} condition = True]</paragraph>
|
|
|
|
<paragraph id="hd_id3156024" role="heading" level="2" xml-lang="en-US">Parameters/Elements</paragraph>
|
|
<paragraph id="par_id3156344" role="paragraph" xml-lang="en-US"> <emph>Condition:</emph> A comparison, numeric or string expression, that evaluates either True or False.</paragraph>
|
|
<paragraph id="par_id3149669" role="paragraph" xml-lang="en-US"> <emph>Statement block:</emph> Statements that you want to repeat while or until the condition is True.</paragraph>
|
|
<paragraph id="par_id3150791" role="paragraph" xml-lang="en-US">The <emph>Do...Loop</emph> statement executes a loop as long as, or until, a certain condition is True. The condition for exiting the loop must be entered following either the <emph>Do</emph> or the <emph>Loop</emph> statement. The following examples are valid combinations:</paragraph>
|
|
|
|
<paragraph id="hd_id3154366" role="heading" level="2" xml-lang="en-US">Syntax</paragraph>
|
|
<paragraph id="par_id3145171" role="paragraph" xml-lang="en-US">Do While condition = True</paragraph>
|
|
<paragraph id="par_id3149203" role="paragraph" xml-lang="en-US">...statement block</paragraph>
|
|
<paragraph id="par_id3125864" role="paragraph" xml-lang="en-US">Loop</paragraph>
|
|
<paragraph id="par_id3154124" role="paragraph" xml-lang="en-US">The statement block between the Do While and the Loop statements is repeated so long as the condition is true.</paragraph>
|
|
<paragraph id="par_id3153968" role="paragraph" xml-lang="en-US">Do Until condition = True</paragraph>
|
|
<paragraph id="par_id3154909" role="paragraph" xml-lang="en-US">...statement block</paragraph>
|
|
<paragraph id="par_id3159151" role="paragraph" xml-lang="en-US">Loop</paragraph>
|
|
<paragraph id="par_id3150440" role="paragraph" xml-lang="en-US">The statement block between the Do Until and the Loop statements is repeated if the condition so long as the condition is false.</paragraph>
|
|
<paragraph id="par_id3153952" role="paragraph" xml-lang="en-US">Do</paragraph>
|
|
<paragraph id="par_id3147349" role="paragraph" xml-lang="en-US">...statement block</paragraph>
|
|
<paragraph id="par_id3159153" role="paragraph" xml-lang="en-US">Loop While condition = True</paragraph>
|
|
<paragraph id="par_id3146985" role="paragraph" xml-lang="en-US">The statement block between the Do and the Loop statements repeats so long as the condition is true.</paragraph>
|
|
<paragraph id="par_id3150488" role="paragraph" xml-lang="en-US">Do</paragraph>
|
|
<paragraph id="par_id3153189" role="paragraph" xml-lang="en-US">...statement block</paragraph>
|
|
<paragraph id="par_id3155411" role="paragraph" xml-lang="en-US">Loop Until condition = True</paragraph>
|
|
<paragraph id="par_id3151117" role="paragraph" xml-lang="en-US">The statement block between the Do and the Loop statements repeats until the condition is true.</paragraph>
|
|
<paragraph id="par_id3149484" role="paragraph" xml-lang="en-US">Use the <emph>Exit Do</emph> statement to unconditionally end the loop. You can add this statement anywhere in a <emph>Do</emph>...<emph>Loop</emph> statement. You can also define an exit condition using the <emph>If...Then</emph> structure as follows:</paragraph>
|
|
<paragraph id="par_id3149262" role="paragraph" xml-lang="en-US">Do...</paragraph>
|
|
<paragraph id="par_id3149298" role="paragraph" xml-lang="en-US">statements</paragraph>
|
|
<paragraph id="par_id3145646" role="paragraph" xml-lang="en-US">If condition = True Then Exit Do</paragraph>
|
|
<paragraph id="par_id3154490" role="paragraph" xml-lang="en-US">statements</paragraph>
|
|
<paragraph id="par_id3153159" role="paragraph" xml-lang="en-US">Loop...</paragraph>
|
|
|
|
<paragraph id="hd_id3147396" role="heading" level="2" xml-lang="en-US">Example</paragraph>
|
|
<bascode>
|
|
<paragraph id="par_idm1341080208" role="bascode" localize="false" xml-lang="en-US">Sub ExampleDoLoop</paragraph>
|
|
<paragraph id="par_idm1341078976" role="bascode" localize="false" xml-lang="en-US">Dim sFile As String</paragraph>
|
|
<paragraph id="par_idm1341077744" role="bascode" localize="false" xml-lang="en-US">Dim sPath As String</paragraph>
|
|
<paragraph id="par_idm1341076512" role="bascode" localize="false" xml-lang="en-US"> sPath = "c:\"</paragraph>
|
|
<paragraph id="par_idm1341075280" role="bascode" localize="false" xml-lang="en-US"> sFile = Dir$( sPath ,22)</paragraph>
|
|
<paragraph id="par_idm1341074032" role="bascode" localize="false" xml-lang="en-US"> If sFile <> "" Then</paragraph>
|
|
<paragraph id="par_idm1341072656" role="bascode" localize="false" xml-lang="en-US"> Do</paragraph>
|
|
<paragraph id="par_idm1341071456" role="bascode" localize="false" xml-lang="en-US"> MsgBox sFile</paragraph>
|
|
<paragraph id="par_idm1341070208" role="bascode" localize="false" xml-lang="en-US"> sFile = Dir$</paragraph>
|
|
<paragraph id="par_idm1341068960" role="bascode" localize="false" xml-lang="en-US"> Loop Until sFile = ""</paragraph>
|
|
<paragraph id="par_idm1341067712" role="bascode" localize="false" xml-lang="en-US"> End If</paragraph>
|
|
<paragraph id="par_idm1341066480" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
|
|
</bascode>
|
|
</body>
|
|
|
|
</helpdocument> |