Skip to content

Commit

Permalink
Update extras (syntax files) w/ new docs.
Browse files Browse the repository at this point in the history
Generate the list of symbols for vim & nano syntax files using
docs data + jinja2.

Also refactored the doc handling a bit.
  • Loading branch information
brndnmtthws committed Oct 4, 2022
1 parent aaf2855 commit 670973a
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 92 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(conky_sources ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/build.h)
add_subdirectory(lua)
add_subdirectory(data)
add_subdirectory(doc)
add_subdirectory(extras)

# Include 3rdparty toluapp
add_subdirectory(3rdparty/toluapp)
Expand Down
2 changes: 1 addition & 1 deletion cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ mark_as_advanced(RELEASE)

option(MAINTAINER_MODE "Enable maintainer mode" false)

option(BUILD_DOCS "Build documentation" false)
option(BUILD_DOCS "Build documentation & extras (syntax files for editors)" false)

option(BUILD_I18N "Enable if you want internationalization support" true)
if(BUILD_I18N)
Expand Down
3 changes: 1 addition & 2 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
if(BUILD_DOCS)
add_custom_target(man.md
ALL
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/docgen.py man.md.j2 > ${CMAKE_CURRENT_BINARY_DIR}/man.md
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/man.md
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/render.py man.md.j2 > ${CMAKE_CURRENT_BINARY_DIR}/man.md
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
SOURCES config_settings.yaml variables.yaml lua.yaml man.md.j2
)
Expand Down
6 changes: 4 additions & 2 deletions doc/lua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ values:
desc: |-
This table contains some information about Conky's window.
The following table describes the values contained:
NOTE: This table is only defined when X support is
enabled.
| Key | Value |
|---------------------|---------------------------------------------------------------------------------|
| drawable | Window's drawable (Xlib Drawable), requires Lua extras enabled at compile time. |
Expand All @@ -121,3 +120,6 @@ values:
| text_start_y | The y component of the starting coordinate of text drawing. |
| text_width | The width of the text drawing region. |
| text_height | The height of the text drawing region. |
NOTE: This table is only defined when X support is
enabled.
10 changes: 6 additions & 4 deletions doc/docgen.py → doc/render.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/usr/bin/env python3

import sys
from warnings import filters
import os
import yaml

with open("config_settings.yaml") as file:
base_path = os.path.dirname(os.path.realpath(__file__))

with open(os.path.join(base_path, "config_settings.yaml")) as file:
config_settings = yaml.safe_load(file)

with open("variables.yaml") as file:
with open(os.path.join(base_path, "variables.yaml")) as file:
variables = yaml.safe_load(file)

with open("lua.yaml") as file:
with open(os.path.join(base_path, "lua.yaml")) as file:
lua = yaml.safe_load(file)

data = {
Expand Down
44 changes: 44 additions & 0 deletions extras/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Conky, a system monitor, based on torsmo
#
# Please see COPYING for details
#
# Copyright (c) 2005-2021 Brenden Matthews, et. al. (see AUTHORS) All rights
# reserved.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details. You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

if(BUILD_DOCS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/nano)
add_custom_target(conky.nanorc
ALL
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/render.py nano/conky.nanorc.j2 > ${CMAKE_CURRENT_BINARY_DIR}/nano/conky.nanorc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
SOURCES
${CMAKE_SOURCE_DIR}/doc/variables.yaml
${CMAKE_SOURCE_DIR}/doc/config_settings.yaml
${CMAKE_SOURCE_DIR}/doc/lua.yaml
${CMAKE_CURRENT_SOURCE_DIR}/nano/conky.nanorc.j2
)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/vim/syntax)
add_custom_target(conkyrc.vim
ALL
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/render.py vim/syntax/conkyrc.vim.j2 > ${CMAKE_CURRENT_BINARY_DIR}/vim/syntax/conkyrc.vim
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
SOURCES
${CMAKE_SOURCE_DIR}/doc/variables.yaml
${CMAKE_SOURCE_DIR}/doc/config_settings.yaml
${CMAKE_SOURCE_DIR}/doc/lua.yaml
${CMAKE_CURRENT_SOURCE_DIR}/vim/syntax/conkyrc.vim.j2
)
endif(BUILD_DOCS)
18 changes: 0 additions & 18 deletions extras/nano/conky.nanorc

This file was deleted.

18 changes: 18 additions & 0 deletions extras/nano/conky.nanorc.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##
## Syntax highlighting for conkyrc files.
##
##
syntax "conky" "(\.*conkyrc.*$|conky.conf)"

## Configuration items
color green "\<({{ config_settings['values']|map(attribute="name")|join('|') }})\>"

## Configuration item constants
color yellow "\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\>"

## Variables
color brightblue "\<({{ variables['values']|map(attribute="name")|join('|') }})\>"

color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color brightred "^TEXT$"
65 changes: 0 additions & 65 deletions extras/vim/syntax/conkyrc.vim

This file was deleted.

Loading

0 comments on commit 670973a

Please sign in to comment.