forked from amazingfate/help
Replacement done with
find . -name \*.xhp -print0 |xargs -0 -P 0 perl -CS -pi -e \
's#(<link[^>]*?) +name *="[^"]*" *( [^>]+|) *>#$1$2>#g'
(note some inconsistencies with space between name and = and also having
empty value, and some more complicated expression to also clear up
double space before/after the attribute)
translation files will be prepped with:
find */helpcontent2 -name \*.po -print0 |xargs -0 -P 0 perl -CS -pi -e \
$'s#(<link[^>]*?) +name=(?:\\\\"[^"]*\\\\"|\'[^\']*\') *( [^>]+|) *(/?>)#$1$2$3#g unless /^#/'
(note that not all languages use the " as quote character for the
attributes, but that also single quotes appera in the po file. Hence
the use of the shell $'string' syntax to be able to quote ' as \'
It also requires to quote the backslash, so that it needs to be escaped
once for the shell, then another time for perl. Also don't work on
obsolete strings (those are prefixed with #~ in the po files)
Also note that <link..></link> gets turned into <link ../> during
translation extraction (along with removal of the space between the
attribute name and the value), so the pattern needs to be slightly
different here)
Change-Id: I95e53a08e6b0095cd894109ea0de154cc4859d8f
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/143713
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
59 lines
5.1 KiB
XML
59 lines
5.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
|
|
|
<!--
|
|
* 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 .
|
|
-->
|
|
|
|
|
|
<helpdocument version="1.0">
|
|
<meta>
|
|
<topic id="textsbasicshared01010210xml" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">Basics</title>
|
|
<filename>/text/sbasic/shared/01010210.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
<body>
|
|
<section id="modular">
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id4488967"><bookmark_value>fundamentals</bookmark_value>
|
|
<bookmark_value>subroutines</bookmark_value>
|
|
<bookmark_value>variables;global and local</bookmark_value>
|
|
<bookmark_value>modules;subroutines and functions</bookmark_value>
|
|
</bookmark><paragraph role="heading" id="hd_id3154927" xml-lang="en-US" level="1"><link href="text/sbasic/shared/01010210.xhp">Basics</link></paragraph>
|
|
<paragraph role="paragraph" id="par_id3156023" xml-lang="en-US">This section provides the fundamentals for working with $[officename] Basic.</paragraph>
|
|
</section>
|
|
<paragraph role="paragraph" id="par_id3147560" xml-lang="en-US">$[officename] Basic code is based on subroutines and functions that are specified between <emph>sub...end sub</emph> and <emph>function...end function</emph> sections. Each Sub or Function can call other Subs and Functions. If you take care to write generic code for a Sub or Function, you can probably re-use it in other programs. See also <link href="text/sbasic/shared/01020300.xhp">Procedures and Functions</link>.</paragraph>
|
|
|
|
<paragraph role="note" id="par_id314756320" xml-lang="en-US">Some restrictions apply for the names of your public variables, subs, and functions. You must not use the same name as one of the modules of the same library.</paragraph>
|
|
|
|
<paragraph role="heading" id="hd_id3150398" xml-lang="en-US" level="2">What is a Sub?</paragraph>
|
|
<paragraph role="paragraph" id="par_id3148797" xml-lang="en-US">
|
|
<emph>Sub</emph> is the short form of <emph>subroutine</emph>, that is used to handle a certain task within a program. Subs are used to split a task into individual procedures. Splitting a program into procedures and sub-procedures enhances readability and reduces the error-proneness. A sub possibly takes some arguments as parameters but does not return any values back to the calling sub or function, for example:</paragraph>
|
|
<paragraph role="code" id="par_id3150868" xml-lang="en-US">DoSomethingWithTheValues(MyFirstValue,MySecondValue)</paragraph>
|
|
<paragraph role="heading" id="hd_id3156282" xml-lang="en-US" level="2">What is a Function?</paragraph>
|
|
<paragraph role="paragraph" id="par_id3156424" xml-lang="en-US">A <emph>function</emph> is essentially a sub, which returns a value. You may use a function at the right side of a variable declaration, or at other places where you normally use values, for example:</paragraph>
|
|
<paragraph role="code" id="par_id3146985" xml-lang="en-US">MySecondValue = myFunction(MyFirstValue)</paragraph>
|
|
<paragraph role="heading" id="hd_id3153364" xml-lang="en-US" level="2">Global and local variables</paragraph>
|
|
<paragraph role="paragraph" id="par_id3151112" xml-lang="en-US">Global variables are valid for all subs and functions inside a module. They are declared at the beginning of a module before the first sub or function starts.</paragraph>
|
|
<paragraph role="paragraph" id="par_id3154012" xml-lang="en-US">Variables that you declare within a sub or function are valid only inside this sub or function. These variables override global variables with the same name and local variables with the same name coming from superordinate subs or functions.</paragraph>
|
|
<paragraph role="heading" id="hd_id3150010" xml-lang="en-US" level="2">Structuring</paragraph>
|
|
<paragraph role="paragraph" id="par_id3153727" xml-lang="en-US">After separating your program into procedures and functions (Subs and Functions), you can save these procedures and functions as files for reuse in other projects. $[officename] Basic supports <link href="text/sbasic/shared/01020500.xhp">Modules and Libraries</link>. Subs and functions are always contained in modules. You can define modules to be global or part of a document. Multiple modules can be combined to a library.</paragraph>
|
|
<paragraph role="paragraph" id="par_id3152578" xml-lang="en-US">You can copy or move subs, functions, modules and libraries from one file to another by using the <link href="text/sbasic/shared/01/06130000.xhp">Macro</link> dialog.</paragraph>
|
|
</body>
|
|
</helpdocument>
|