Asciidoc inserting Gitlab builder variables when creating the adoc file? - gitlab

Good day all, been reading the various docs at Gitlab and Asciidoc websites and I'm not seeing if there's a way to autofill a variable created in Gitlab that is included in the asciidoc it creates? For example, if I'm pushing code to my branch and it starts the Gitlab builder. I would like to take the author variable with my name in it and when the asciidoc that the builder generates, can I just put {author} for it to auto-fill my name in it?
Not 100% sure I'm understanding how this works exactly, any help would be greatly appreciated.
Thanks

If your Gitlab builder explicitly calls asciidoctor, you can define attributes using the -a flag. For example:
asciidoctor -a author="My Name" contents.adoc
Environment variables can be added in the same way:
asciidoctor -a author="My Name" -a path=$PATH contents.adoc
See the CLI Options page for other options that you can specify during asciidoctor invocation.
If the builder calls other actions that do the building, and you cannot access those actions, then this won't work.
Note that defining the page author is normally handled by including the name (and email address) immediately after the page title (before the first blank line). See the Using the Author Line page for details.
For example:
= Document
Author name
The standard Asciidoctor theme automatically displays the page author immediately after the page title.
For other attributes that are included in the document, or specified as page attributes, you'd need to include {attribute_name} within the page markup to see them.

Related

Referencing repository files at a given commit in gitlab wiki

Gitlab Markdown has support for references to files in the repository structure, like:
[README](doc/README)
or
[README](doc/README#L13)
But are there ways to reference files and lines in these files, but from a given commit, at least in the Wiki ?
Maybe something like:
[README](1ab3fa71:doc/README#L13)
or using the file hash id like:
[README](9a27b101#L13)
To use relative links from wiki to the repository (or wise versa) is not supported officially according to Gitlab's documentation (cited from v11.5, still valid for v15.3):
Note: Relative links do not allow referencing project files in a wiki page or wiki page in a project file. The reason for this is that, in GitLab, wiki is always a separate Git repository. For example, I'm a reference-style link will point the link to wikis/style when the link is inside of a wiki markdown file.
There is, however, a syntax which seems to work currently:
[[README|/../blob/1ab3fa71/doc/README#L13]]
But be aware: all text of the same paragraph will just be lost!
I work around that by phrasing like this, which renders like expected for Gitlab CE v11.3.0 at least:
Here you see xyz:
* [[README|/../blob/1ab3fa71/doc/README#L13]]
The root-anchored link (/../blob/<version>/<path-to-file>) ensures that it works from every Wiki page independently from their nesting depth.
For sure this syntax also works for branch names or any other relative link like /../tree/1ab3fa71/doc for example.
Maybe long after the battle, but I found a workaround : Simply make a link to a page where the README.md is. And that's it !
To get the link simply go to a page which displays the document, copy the URL, make a link to that address, append #L with the line number.
Exemple :
[Readme Pelargos](http://192.168.80.250:10080/project-root/android/Pelargos/blob/develop/README.md#L47)
One way I've found that, for the most part, works is to mouseover the line of code that you want to reference in the relevant file. While doing that, click the link icon that appears in the lefthand-side gutter to copy the line reference. With it copied, you then use a slightly revised version of the path in the copied URI.
Here is an example of a link copied using the gutter icon:
https://gitlab.com/settermjd/mezzio-sms-sender-api/-/blob/main/src/App/src/Handler/SMSReplyHandler.php#L23
This is the revised path that I used in a commit. Note the parent directory reference prior to main/:
/../main/src/App/src/Handler/SMSReplyHandler.php#L23
I realize that the file reference in the gitlab wiki, references files from the wiki repository itself and not from the project repository (source code repository).
However, when you make a reference to a hash, it knows if the hash refers to a commit or a file, so you can make references to a specific file from the project repository.

Chamilo - Search bar into footer

I have a problem with Chamilo 1.9.8. I want to add Google Search bar to a website into the footer, but I don't know which file I have to edit to insert the code, and where that file is situated.
I have never worked with this system, so I am new in this category, please can you help me?
If it's just a matter of updating the footer, you can find it in 1.9.8 in main/template/default/layout/footer.tpl
Note that, for these changes to take effect, you'll have to delete the template caching in archive/twig/ (just delete the contents of that folder) or click the "Archive directory cleanup" link on your Chamilo administration panel.
You can also find useful tips about modifying the templates in the (unfinished) developers documentation here: https://github.com/chamilo/docs/tree/master/1.9/en/developer.
Note that:
you should update to 1.9.10.2 to avoid security flaws
1.9.10 has a way for you to create a copy of the "default" template and configure it in your configuration file (search main/install/configuration.dist.php for $_configuration['default_template']

Liferay login portlet display text change

Change display name in login portlet from “Screen Name” to “Username”. As per discussion in liferay forums I am assuming that it can be done by using creating hook. Is there any easy way to change the display text.
As reported by discussion forum the best way to do it it's a hook. Your choice if you prefer change login jsp or change the "screen-name" resource bundle properties files. Be aware that changing screen-name label affect whole portal and wherever screen-name label was used (not only login portlet).
If you don't want write a hook, you can try to add to Liferay web application a file named Language-ext.properties within the WEB-INF\classes\content (if content dir doesn't exist create it). Edit Language-ext.properties and add a line with screen-name=Username. Restart Liferay. It should works.
Be aware that language specific version of Language properites files takes precedence over "-ext" version and location specific version takes precedence over language version. If your portal-impl contains language/location specific version you have to ovverride it with relative language specific ext file (e.g. Language-ext_en.properties)

How to apply Dreamweaver templates on an existing site

I have an existing site in a path, and I've pointed the DreamWeaver site to it.
Under \templates there is a master.dwt file. But whenever I save this file, none of the html files which should make use of it change. What do I need to do to get DW to update the html files that make use of it? And how does DW know which files should be updated based on the template changing? Does it use an internal store or something because every time I copy the site to another machine, I'll need to link up all the pages to the relevant templates again.
I've tried going into Modify | Templates | Apply, but no templates are listed. I have a .dwt file in the path so why isn't it picking it up??
There's several possible issues in play here:
For Dreamweaver to properly recognize the existence of the template, the folder in the root of the site should be Templates and not templates.
Once Dreamweaver "sees" the Template properly you then need to make sure that the proper code is present in the child HTML files so Dreamweaver knows which files to update via the template. This code takes the form of HTML comments scattered throughout the page. You will always have the following line after the <html> tag:
<!-- InstanceBegin template="/Templates/TemplateName.dwt" codeOutsideHTMLIsLocked="false" -->
After that, editable regions are delineated with code that will look like this:
<!-- InstanceBeginEditable name="someregion" -->
stuff you can edit
<!-- InstanceEndEditable -->
Without the above, the child pages will not respond to the template.
Now for the real bad news. Unless the existing pages match up with the template exactly, you are going to have all kinds of problems getting the template to play nicely with the existing content. Doing Modify | Template | Apply Template to the page when the page is already fully formed will generate a dialog box that asks you map the content to the editable regions in the template. But if the rest of the design elements vary from what the template contains, Dreamweaver will preserve those tags alongside what the template will introduce which usually creates a ton of duplicated tags and broken layouts.
You would be FAR better off creating new, blank pages from the Dreamweaver Template and copy/pasting the contents into the editable area and then overwriting the "old" pages with the Save As command.
I just encountered this issue myself. I realize this original question was posted some time ago, but for anyone who might encounter this problem in the future, I am posting my solution.
If the only changes made to the template relate to one or more elements contained in an attached/linked file (such as a CSS style sheet or JS file), which changes Dreamweaver allows directly from the .dwt template itself, using the style boxes at the side/bottom, then Dreamweaver does not perceive any change to the actual .dwt file itself. If you want those changes to "take effect" and apply them to all pages, you might type a change to the .dwt file itself, click "save all" - undo the change and click "save all" again. This step is really not entirely necessary, as the changes to dependent files can be affected to the website by putting the dependent file to the website.
Also, Dreamweaver will apply changes to CSS/JS dependent files, across the board, but may continue to use a cache, until closed and reopened.

How to generate changelog from Trac

I need to generate changelog from Trac for a specific version as XML and then process it with a custom XSL. It seems one of the default reports is the case (All Tickets By Milestone (Including closed)). However, if i request it as XML (by adding format=rss to the url) the output XML does not contain Status, Resolution, Milestone fields. How do i configure it to contain all the fields? How do you generate your changelogs from Trac to include it in release notes?
1) Please provide a copy of the Query (Click on SQL Query link at the bottom of the page)
What I find strange is that normally you get more columns in the CSV/RSS-XML reports than in the HTML version (see Wiki page TracReports and the extract below)
2) Personally I generate my changelogs directly from Trac into pdf. I personalised the SQL statement as much as possible to get what I want. I prefer to get a result quickly and economically rather than spand a lot of time to get exactly what I want.
===== TracReports extract =====
column -- Hide data. Prepending an underscore ('') to a column name instructs Trac to hide the contents from the HTML output. This is useful for information to be visible only if downloaded in other formats (like CSV or RSS/XML).

Resources