Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
batocera_wiki_code_snippets [2020/03/21 14:53] – lala | batocera_wiki_code_snippets [2023/10/20 08:02] (current) – [Embedded images]: Explain how to avoid font issues in SVG ssokolow | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ~~NOTOC~~ | + | ====== |
- | ====== | + | |
- | ^Symbol | + | <WRAP center round tip> |
- | | {{: | + | A cheat-sheet can be found [[wiki:syntax# |
- | | {{:switch-slider.png? | + | </WRAP> |
- | | {{:: | + | |
- | | {{: | + | |
- | Code can be displayed by using the ''< | ||
- | Icons can be created and distrubuted | + | ===== In-links ===== |
+ | |||
+ | In-links refer to linking to another page on [[:|this wiki]]. When doing so, you don't need to include the %%" | ||
+ | |||
+ | [[wiki: | ||
+ | |||
+ | which is coded as: | ||
+ | |||
+ | < | ||
+ | [[wiki: | ||
+ | </ | ||
+ | |||
+ | ==== In-links to the null namespace ==== | ||
+ | |||
+ | If you're referring to a page that doesn' | ||
+ | |||
+ | [[access_the_batocera_via_ssh|This in-link won't work from particular other pages as there' | ||
+ | |||
+ | which is coded as: | ||
+ | |||
+ | < | ||
+ | [[access_the_batocera_via_ssh|This in-link won't work from particular other pages as there' | ||
+ | </ | ||
+ | |||
+ | You are encouraged to use in-links over hard-coded links, as that will allow the wiki to automatically update the link should the page name ever change in the future. | ||
+ | |||
+ | ==== Section linking ==== | ||
+ | |||
+ | If you'd like to link to a particular section in the page, add a hash (#) followed by the name of the section in all lower-case and with under-scores replacing spaces (special characters are usually just completely omitted). For example: | ||
+ | |||
+ | [[wiki: | ||
+ | |||
+ | which is coded as: | ||
+ | |||
+ | < | ||
+ | [[wiki: | ||
+ | </ | ||
+ | |||
+ | For links that simply refer to another [[# | ||
+ | |||
+ | < | ||
+ | [[# | ||
+ | </ | ||
+ | |||
+ | Sections are identified by their name alone, irrelevant of how nested they are inside of other headers. If there are multiple sections with the same name in the same page, they are identified by having a digit added to the end of them. | ||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | You can always click the little " | ||
+ | </ | ||
+ | |||
+ | ===== Inter-wiki links ===== | ||
+ | |||
+ | Let's face it, Wikipedia is a great source of information for technical aspects at times. If you ever need to link to a Wikipedia page specifically, | ||
+ | |||
+ | [[wp> | ||
+ | |||
+ | which is invoked by | ||
+ | |||
+ | < | ||
+ | [[wp> | ||
+ | </ | ||
+ | |||
+ | Note that you don't need to include the full URL, just the Wikipedia page title. It also appears with the Wikipedia icon, isn't that neat? | ||
+ | |||
+ | This also works for embedding Youtube videos using only their video ID, like so: | ||
+ | |||
+ | {{youtube> | ||
+ | |||
+ | which is invoked by | ||
+ | |||
+ | < | ||
+ | {{youtube> | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Currently, embedding Youtube links is bugged. When the mouse hovers over the " | ||
+ | </ | ||
+ | |||
+ | ===== Embedded images ===== | ||
+ | |||
+ | Images can be added to a page if needed. Keep in mind that visuals should be in addition to the written explanation, | ||
+ | |||
+ | %%{{: | ||
+ | |||
+ | For example, the "north button" | ||
+ | |||
+ | ^ Symbol ^ Code ^ Note ^ | ||
+ | | {{: | ||
+ | | {{: | ||
+ | | {{:: | ||
+ | | {{: | ||
+ | | {{: | ||
+ | | {{: | ||
+ | | {{: | ||
+ | | {{: | ||
+ | |||
+ | Icons can be created and distributed | ||
+ | |||
+ | Scalable Vector Graphics (SVG) files are also good for creating/ | ||
+ | |||
+ | Sample SVG file: | ||
+ | {{: | ||
+ | |||
+ | The wiki's media manager can actually accept SVG files even though it doesn' | ||
+ | |||
+ | However, by using the official DokuWiki [[https:// | ||
+ | |||
+ | [{{ wiki: | ||
+ | |||
+ | [{{ wiki: | ||
+ | |||
+ | ===== Embedded videos ===== | ||
+ | |||
+ | It is recommended to convert the video to a WEBM with a resolution of 655x368 to prepare it for embedding into the wiki page and not have interruptions during playback. With that said, the wiki supports many video formats (check what you can upload in the media uploading tool) and the resolution will always be downscaled to whatever size you specify in the embed code itself. For example: | ||
+ | |||
+ | < | ||
+ | {{URL-to-video? | ||
+ | </ | ||
+ | |||
+ | This would result in the video looking similar to this: | ||
+ | |||
+ | {{blog: | ||
+ | |||
+ | <WRAP center round tip> | ||
+ | A quick way to record videos from Batocera itself is to sign in via SSH and run the '' | ||
+ | </ | ||
+ | |||
+ | ===== Unformatted code ===== | ||
+ | |||
+ | Code can be displayed by using the ''< | ||
+ | |||
+ | < | ||
+ | %%print (" | ||
+ | </ | ||
+ | |||
+ | You can create downloadable files by specifying its file-name as a parameter in the %%< | ||
+ | |||
+ | <code java script.js> | ||
+ | Here is my Javascript code. | ||
+ | </ | ||
+ | |||
+ | would become | ||
+ | |||
+ | <code java script.js> | ||
+ | Here is my Javascript code. | ||
+ | </ | ||
+ | |||
+ | If you just want a raw text file without syntax highlighting, | ||
+ | |||
+ | ===== No formatting ===== | ||
+ | |||
+ | It is also possible to ask the wiki to not apply formatting to a specific element by surrounding it by ''< | ||
+ | |||
+ | For example, writing down the following: | ||
+ | |||
+ | **%%echo ' | ||
+ | |||
+ | will display as | ||
+ | |||
+ | **echo ' | ||
+ | |||
+ | transforming the %%>> | ||
+ | |||
+ | **< | ||
+ | |||
+ | ===== Display tables (vertical bar method) ===== | ||
+ | |||
+ | The more common way of displaying tables in this wiki is through the use of vertical bars (|) and carats (^). These keys are available with '' | ||
+ | |||
+ | Headers are identified by beginning with a carat. Regular elements begin with vertical bars. Elements that aren't closed with another carat or bar will be discarded. For example: | ||
+ | |||
+ | < | ||
+ | ^ Header 1 ^ Attribute 2 ^ Notes ^ | ||
+ | | Emulator 1 | '' | ||
+ | | Emulator 2 | '' | ||
+ | | Emulator 3 | | ||
+ | | Emulator 4 | ||
+ | </ | ||
+ | |||
+ | would appear as | ||
+ | |||
+ | ^ Header 1 ^ Attribute 2 ^ Notes ^ | ||
+ | | Emulator 1 | '' | ||
+ | | Emulator 2 | '' | ||
+ | | Emulator 3 | | ||
+ | | Emulator 4 | ||
+ | |||
+ | Alignment is handled by using double white spaces on the side of the element you want it to align to. For example: | ||
+ | |||
+ | < | ||
+ | | This element at the top isn't a header, and is right aligned. | An empty element is below this one. | | ||
+ | ^ But this one is. Headers don't have to only be at the top, but should in most cases. | ||
+ | ^ Any element can be closed with either a bar or a carat, it doesn' | ||
+ | </ | ||
+ | |||
+ | would appear as | ||
+ | |||
+ | | This element at the top isn't a header, and is right aligned. | An empty element is below this one. | | ||
+ | ^ But this one is. Headers don't have to only be at the top, but should in most cases. | ||
+ | ^ Any element can be closed with either a bar or a carat, it doesn' | ||
+ | |||
+ | ===== Display tables (csv) ===== | ||
+ | |||
+ | One easy way to display a table is to use a comma separated values (csv) structure. Think of it like a 2-D spreadsheet, | ||
+ | |||
+ | Putting a CSV structure inside the %%< | ||
+ | |||
+ | < | ||
+ | Picodrive, Master system/ | ||
+ | Genesis plus GX, Master system/ | ||
+ | |||
+ | and add the %%< | ||
+ | |||
+ | < | ||
+ | Emulator name, Emulated system, Original manufacturer | ||
+ | Picodrive, Master system/ | ||
+ | Genesis plus GX, Master system/ | ||
+ | </ | ||
+ | |||
+ | it will then display as this | ||
+ | |||
+ | < | ||
+ | Emulator name, Emulated system, Original manufacturer | ||
+ | Picodrive, Master system/ | ||
+ | Genesis plus GX, Master system/ | ||
+ | </ | ||
+ | |||
+ | ===== Adding a collapsible section ===== | ||
+ | |||
+ | With the addition of the collapsible sidebar via the [[https:// | ||
+ | |||
+ | The beginning of a section has to be marked with %%--> Title%%'' | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Sections can be closed by using %%<--%% on a new line. Sections can also be nested. Example: | ||
+ | |||
+ | < | ||
+ | --> Section 1 without preview (recommended)# | ||
+ | |||
+ | First level content. This can be pretty much anything. | ||
+ | * If ending with an list such as a bullet list, remember to add one space after the list so as to avoid syntax errors, like so: | ||
+ | |||
+ | --> Second level nested section# | ||
+ | |||
+ | Second level content. It's also just good practice to use a spare extra line when closing a section, though it's not always necessary. | ||
+ | |||
+ | <-- | ||
+ | |||
+ | First level content continues. | ||
+ | |||
+ | <-- | ||
+ | |||
+ | --> [[: | ||
+ | |||
+ | If the user clicks the blue text, they will both simultaneously open the section and be taken to the linked page. If the instead click only the box around the text, they will just open the text instead. This is really only useful for the sidebar. Does not work with section-specific in-links (ones that require a %%#%%), as that conflicts with the '' | ||
+ | |||
+ | --> [[: | ||
+ | |||
+ | Notice how it instead shows the syntax instead of actually linking? | ||
+ | |||
+ | <-- | ||
+ | |||
+ | <-- | ||
+ | |||
+ | --> Section with a preview on hover. Not recommended for general use. | ||
+ | |||
+ | Here's a bunch of text in some code. | ||
+ | |||
+ | <-- | ||
+ | </ | ||
+ | |||
+ | which would appear like so: | ||
+ | |||
+ | --> Section 1 without preview (recommended)# | ||
+ | |||
+ | First level content. This can be pretty much anything. | ||
+ | * If ending with an list such as a bullet list, remember to add one space after the list so as to avoid syntax errors, like so: | ||
+ | |||
+ | --> Second level nested section# | ||
+ | |||
+ | Second level content. It's also just good practice to use a spare extra line when closing a section, though it's not always necessary. | ||
+ | |||
+ | <-- | ||
+ | |||
+ | First level content continues. | ||
+ | |||
+ | <-- | ||
+ | |||
+ | --> [[: | ||
+ | |||
+ | If the user clicks the blue text, they will both simultaneously open the section and be taken to the linked page. If the instead click only the box around the text, they will just open the text instead. This is really only useful for the sidebar. Does not work with section-specific in-links (ones that require a %%#%%), as that conflicts with the '' | ||
+ | |||
+ | --> [[: | ||
+ | |||
+ | Notice how it instead shows the syntax instead of actually linking? | ||
+ | |||
+ | <-- | ||
+ | |||
+ | <-- | ||
+ | |||
+ | --> Section with a preview on hover. Not recommended for general use. | ||
+ | |||
+ | Here's a bunch of text in some code. | ||
+ | |||
+ | <-- | ||
+ | |||
+ | ===== File tree ASCII art ===== | ||
+ | |||
+ | When you need to display a folder' | ||
+ | |||
+ | < | ||
+ | roms/ | ||
+ | ├─ psx/ | ||
+ | │ ├─ Final Fantasy VII (Disc 1).bin | ||
+ | │ └─ Final Fantasy VII (Disc 1).cue | ||
+ | └─ Final Fantasy VII (Disc 1).m3u | ||
+ | </ | ||
+ | |||
+ | Although it may be fun to write these out yourself, an automatic tool to create them is available at https:// | ||
===== CSV SAMPLE OUTPUT GOOGLE ===== | ===== CSV SAMPLE OUTPUT GOOGLE ===== | ||
+ | |||
< | < | ||
<csv file=https:// | <csv file=https:// | ||
Line 18: | Line 336: | ||
</ | </ | ||
- | <WRAP center round tip 100%> | + | <WRAP center round tip 90%> |
**To link to a Google spreadsheet: | **To link to a Google spreadsheet: | ||
- Open your spreadsheet in Google Docs. | - Open your spreadsheet in Google Docs. | ||
Line 33: | Line 351: | ||
</ | </ | ||
+ | ===== Embed a website into a wiki page ===== | ||
+ | |||
+ | Batocera wiki supports iframes, showing another web page inside of the article. Simple example: | ||
+ | |||
+ | < | ||
+ | {{url> | ||
+ | </ | ||
+ | |||
+ | Full syntax: | ||
+ | |||
+ | < | ||
+ | {{url> | ||
+ | </ | ||
+ | |||
+ | Javascript URLs are not supported. More info at https:// | ||
+ | |||
+ | ===== Templates ===== | ||
+ | |||
+ | ==== Batocera Themes Rules ==== | ||
+ | |||
+ | < | ||
+ | {{ : | ||
+ | {{ : | ||
+ | {{ : | ||
+ | |||
+ | Can't decide? Used the first option. | ||
+ | |||
+ | Authorname [[ https:// | ||
+ | </ | ||
- | ===== CONTROLLERS ===== | + | {{ : |
+ | {{ : | ||
+ | {{ : | ||
- | Items to check! | + | Some suggestions |
- | <csv file=https:// | + | * Themename |
+ | * Authorname | ||
+ | * Link to author? (needed?) | ||
+ | * System List View -> themename_system | ||
+ | * ROM List View -> themename_list | ||
+ | * GRID List View -> themename_grid | ||
+ | * Resolution 1920x1080 | ||
- batocera_wiki_code_snippets.1584798790.txt.gz
- Last modified: 4 years ago
- by lala